pycycle
pycycle copied to clipboard
Not catching cycles in Django project
I tested in a Django project with a pretty common circular import situation and it couldn't catch it:
myapp/models.py
from .managers import MyModelManager
class MyModel(models.Model):
....
myapp/managers.py
from .models import MyModel
class MyModelManager(models.ModelManager):
...
Thanks for reporting!
This should be fixed in version 0.0.5.
I added some test cases for relative imports here: https://github.com/bndr/pycycle/tree/master/tests/_projects/relative_imports.
Let me know if this solves your issue, so I can close it.
Cool @bndr. But now there might be another problem then. I've tested locally with full imports but pasted the example with relative (didn't know it would make a difference). Let me update it and test for both cases and report back to you.
It's not picking for both cases. I'm running from the root of the project with the command:
pycycle --here --ignore=node_modules --verbose
I can see it enters myapp.models.py and myapp.managers.py. I'm getting:
No worries, no cycles here!
Are you on windows? Can you post your pycycle --version output, should be 0.0.6
Can you provide a small test project against which I can verify the fix?
Very much appreciate your help.