-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve tests to detect circular imports and resolve all of them #1357
Conversation
So, I removed all circular import errors the test detected (which I think should be all). It sometimes required me to type with "strings" (to avoid an import), for which lines I had to disable ruff (F821) and pyright. Edit: Not sure why this test is failing, this is not happening locally |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks a lot for fixing this endless circle of imports 🙏
All tests are passing both on local MacOS and remote Ubuntu, so I have no idea what's the matter with the pickling error during parallelization of the serial slice sampler.
Mhh I fixed the modifications. However also not able to reproduce the error :/ |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1357 +/- ##
===========================================
- Coverage 89.40% 78.45% -10.96%
===========================================
Files 118 119 +1
Lines 8715 8786 +71
===========================================
- Hits 7792 6893 -899
- Misses 923 1893 +970
Flags with carried forward coverage won't be shown. Click here to find out more.
|
I fixed the issue. Also, see #1377 when reviewing. Added a note for that (just implemented it differently now to avoid pickle conflicts). The test should still work as expected, I did test it by introducing a circular import which it detected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks for digging into this and fixing it 🪨
I guess this seems to be a issue with a new pytorch 2.6 release? |
Yes, and changing |
Yeah, the failing test should be fixed. But not sure about the pytype errors. Moving these to #1380 |
The previous test to detect circular imports only checked a small subset of imports for main modules like "inference." and similars.
I made this test now much more comprehensive in the sense that it crawls through all Python modules XXX present in SBI (i.e.sbi.neural_nets.estimators) and tests if it is possible to do
This revealed around 20 previously undetected circular imports, which I will aim to resolve here, if possible.