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
I'm often hitting circular dependencies errors, and some colleagues have been as well. The nasty thing is that two persons can experiment different failures (things work for me, but not for my neighbour, although they have the same pyenv/python/libs/OS 😬 ; I don't know why).
Those issues are due to:
"swf" and "simpleflow" modules importing each other, notably for utils
imports happening in and from "init" files
not enough layering (?)
One trivial case to reproduce:
# happens on my machine (MacOS + Cpython 3.8.6)
# reproducible with "docker run -it python bash" + "pip install simpleflow"
python -c 'import swf.core'
# => ImportError: cannot import name 'ConnectedSWFObject' from partially initialized module 'swf.core' (most likely due to a circular import) (/usr/local/lib/python3.11/site-packages/swf/core.py)
I've just read this article and what they propose makes sense + they have an AST based test generator that allows to detect violations of the pattern they propose
=> I will take a shot at this to reorganise some imports, and move the remaining circular deps (if any) to local imports.
First PR here: #421 -> moves "swf" into "simpleflow.swf.mapper" and solves the circular imports. I believe this PR is mandatory for fixing circular imports reliably.
Second PR here: #422 -> uses the set of tests in the article I mentioned above and rewrites the imports accordingly. Not sure it should be merged, curious what you think.
I'm often hitting circular dependencies errors, and some colleagues have been as well. The nasty thing is that two persons can experiment different failures (things work for me, but not for my neighbour, although they have the same pyenv/python/libs/OS 😬 ; I don't know why).
Those issues are due to:
One trivial case to reproduce:
I've just read this article and what they propose makes sense + they have an AST based test generator that allows to detect violations of the pattern they propose
=> I will take a shot at this to reorganise some imports, and move the remaining circular deps (if any) to local imports.
cc @ybastide let me know if you're against that
The text was updated successfully, but these errors were encountered: