You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Replace and rewrite "assert" statements in non-test code #175
assert statements should only be used for debugging purposes. They are removed when not running in debug mode (i.e. when invoking the Python command with the -O or -OO options).
Instead use a raise statement to throw a proper, informative runtime exception, if you need to. That would definitely be best practice when there'd otherwise be no sensible return value for the function.
Hey, I'd like to work on this issue. Can you assign this to me? And the assert statements are to be removed from all the repos or a specific one? @pombredanne
Hi @pombredanne , I have started working on this issue. I will replace the assert statements with raise statements in the main code (outside test files). I'll submit a PR soon. Let me know if there are specific repos other than scancode-toolkit where this change is needed.
Hi @pombredanne, I would like to work on this issue to replace the assert statements with proper raise exceptions in the main code (outside test files). Could you please assign this issue to me? Let me know if any specific guidelines or repos need to be considered. Thank you!
Hey, I'd like to work on this issue. Can you assign this to me?
As explained above, we cannot "assign" work. You guys need to coordinate and collaborate to avoid stepping on each other.
And the assert statements are to be removed from all the repos or a specific one?
Rather replaced in all the repos, and only asserts that are not for tests, and only asserts that are for production code that could be ignored from a -O python run.
Hi , I have started working on this issue. I will replace the assert statements with raise statements in the main code (outside test files). I'll submit a PR soon. Let me know if there are specific repos other than scancode-toolkit where this change is needed.
As said above, all repos, but not in test code: there we use "assert" and pytest does an awesome job assert rewriting job, so we surely do not want to change this.
Hi, I would like to work on this issue to replace the assert statements with proper raise exceptions in the main code (outside test files). Could you please assign this issue to me? Let me know if any specific guidelines or repos need to be considered. Thank you!
Same as above: all repos, not the tests, and you need to coordinate here with others
Hi everyone, I’d like to contribute to this issue by focusing on specific files/modules for replacing assert statements outside the test files. Please let me know how I can best coordinate with others to avoid overlap. Thank you!
Hi @Dhruv276R, your work is great! However, the PR link seems incorrect. Can you confirm if the PR is in the aboutcode-toolkit repo and share the correct link? Thank you!
@pombredanne
Hi, I’m interested in working on this issue.
Could you please point me to the specific files or repositories where the assert statements need to be replaced?
Hi, I checked the repository but I couldn't find any assert statements
in the current codebase. Could you please point me to the files where
these asserts still need to be replaced?
Hi! I'd like to contribute to this. I'll pick a specific repo/file that no one else has claimed and leave a note here before starting. Happy to coordinate.
Hi! I'm interested in contributing to issue #175 as my first open-source PR.
I read the discussion and understand that the work spans multiple repositories and that contributors should coordinate to avoid overlapping changes.
Could you suggest a repository or module that still has production-code assert statements needing replacement and is not already covered by an existing PR? I'd like to take one small, well-defined part of the issue and add appropriate tests.
Thank you!
Activity
TirthPanchal commentedon Jan 12, 2025
Heyyy, I'd like to work on this issue. Can you assign it to me?
coderhuBypassion commentedon Jan 13, 2025
so, assert statements should be removed from all the repos of aboutcode-org., or only from aboutcode-org/scancode-toolkit ?
Dhruv276R commentedon Jan 14, 2025
Hey, I'd like to work on this issue. Can you assign this to me? And the assert statements are to be removed from all the repos or a specific one? @pombredanne
Gurleen-kansray commentedon Jan 15, 2025
Hi @pombredanne , I have started working on this issue. I will replace the assert statements with raise statements in the main code (outside test files). I'll submit a PR soon. Let me know if there are specific repos other than scancode-toolkit where this change is needed.
Dhruv276R commentedon Jan 15, 2025
@pombredanne I have made a PR on this https://github.com/aboutcode-org/aboutcode-toolkit/pull/574
Check and let me know for further enhacements. Do you need me to changes in other repos as well?
ONKARBH commentedon Jan 17, 2025
Hi @pombredanne, I would like to work on this issue to replace the assert statements with proper raise exceptions in the main code (outside test files). Could you please assign this issue to me? Let me know if any specific guidelines or repos need to be considered. Thank you!
pombredanne commentedon Jan 17, 2025
@TirthPanchal re:
we do not "assign" issue per se. You are welcome to work on this, but you want to sync up here with others to avoid double, duplicated work!
@Dhruv276R re:
As explained above, we cannot "assign" work. You guys need to coordinate and collaborate to avoid stepping on each other.
Rather replaced in all the repos, and only asserts that are not for tests, and only asserts that are for production code that could be ignored from a -O python run.
@Gurleen-kansray re:
As said above, all repos, but not in test code: there we use "assert" and pytest does an awesome job assert rewriting job, so we surely do not want to change this.
@ONKARBH re:
Same as above: all repos, not the tests, and you need to coordinate here with others
ONKARBH commentedon Jan 17, 2025
Hi everyone, I’d like to contribute to this issue by focusing on specific files/modules for replacing assert statements outside the test files. Please let me know how I can best coordinate with others to avoid overlap. Thank you!
pombredanne commentedon Jan 17, 2025
@Dhruv276R re:
This is awesome, but I cannot see the PR at https://github.com/aboutcode-org/aboutcode/pulls/574 ?
ONKARBH commentedon Jan 17, 2025
Hi @Dhruv276R, your work is great! However, the PR link seems incorrect. Can you confirm if the PR is in the
aboutcode-toolkitrepo and share the correct link? Thank you!pombredanne commentedon Jan 17, 2025
My bad: this is at aboutcode-org/aboutcode-toolkit#574
Pratz2005 commentedon Jan 26, 2025
Is this issue still open?
24 remaining items
vignathi123-vi commentedon Feb 23, 2026
Hey @pombredanne,
I'm a GSoc 2026 applicant. Can I work on this issue? Is it open?
va1bhav-06 commentedon Feb 26, 2026
Hi, I’m interested in working on this issue. Is it still available?
Satyasubhash01 commentedon Mar 1, 2026
Hey @pombredanne,
I'm a GSoc 2026 applicant. Can I work on this issue?, I’m interested in working on this issue
ParthMozarkar commentedon Mar 8, 2026
could you please assign this to me?
sagarnaidu04 commentedon Mar 16, 2026
@pombredanne
Hi, I’m interested in working on this issue.
Could you please point me to the specific files or repositories where the
assertstatements need to be replaced?mili609 commentedon Mar 16, 2026
Hi, I would like to work on this issue. Could you please assign it to me?
mili609 commentedon Mar 16, 2026
Hi, I checked the repository but I couldn't find any assert statements
in the current codebase. Could you please point me to the files where
these asserts still need to be replaced?
tech-nitin commentedon Mar 20, 2026
Hi, I would like to work on this issue. Can I take this?
huda-code commentedon May 7, 2026
Hi @pombredanne,
I’d like to contribute to this issue by focusing on a specific subset of non-test production asserts to avoid overlap with existing work.
I’m planning to audit one repository/module first, replace runtime-critical assert statements with explicit exceptions, and ensure behavior remains unchanged under optimized Python runs (-O / -OO).
I’ll avoid test files and coordinate here before opening a PR if I notice overlap with existing contributions.
Thanks!
duplicatenode commentedon May 28, 2026
Hi! I'd like to contribute to this. I'll pick a specific repo/file that no one else has claimed and leave a note here before starting. Happy to coordinate.
ankitprajapat42 commentedon Jun 4, 2026
Hi, I would like to work on this issue. Can I take this
Saumyajaiswal9794 commentedon Aug 17, 2026
Hi @pombredanne, I would like to work on this issue. Could you please assign it to me?
RachitSinghh commentedon Sep 29, 2026
Is this still open?
SuryaNarayana-C-K commentedon Oct 9, 2026
Hi! I'm interested in contributing to issue #175 as my first open-source PR.
I read the discussion and understand that the work spans multiple repositories and that contributors should coordinate to avoid overlapping changes.
Could you suggest a repository or module that still has production-code assert statements needing replacement and is not already covered by an existing PR? I'd like to take one small, well-defined part of the issue and add appropriate tests.
Thank you!
NathN07 commentedon Oct 13, 2026
Hi @pombredanne, I've opened PR aboutcode-org/container-inspector#66 replacing production assert statements with ValueError in
src/container_inspector/cli.py.