pycycle icon indicating copy to clipboard operation
pycycle copied to clipboard

Not catching cycles in Django project

Open filipeximenes opened this issue 8 years ago • 5 comments
trafficstars

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):
   ...

filipeximenes avatar Feb 02 '17 18:02 filipeximenes

Thanks for reporting!

bndr avatar Feb 02 '17 18:02 bndr

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.

bndr avatar Feb 02 '17 19:02 bndr

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.

filipeximenes avatar Feb 02 '17 19:02 filipeximenes

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!

filipeximenes avatar Feb 02 '17 19:02 filipeximenes

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.

bndr avatar Feb 02 '17 20:02 bndr