-
Notifications
You must be signed in to change notification settings - Fork 111
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
incorrectly attaching dependency with relative imports in submodules #162
Comments
Hi @admuresan and thank you for your interest in pydeps. I think there might be something else going on, although I'm not entirely sure what. I've created a tool that converts directories to yaml and back again, which pydeps uses internally for testing, but is also great for communicating test-cases. It's available from PyPI ( If I understand you correctly, you have this structure:
(save it as fname.yaml and run I would guess that it could be related to the dummy python file that pydeps creates when running to have a starting point for analyzing your module (you can find the contents by running pydeps with the Could you create a yamldirs snippet that demonstrates your problem? |
This is an issue I noticed if for example I have a sub module that imports form its relative namespace without going global.
Take for example the following module structure:
main
|-- __init__.py
|-- sub_modulue
|-- __init__.py
|-- file.py
If file.py has a line like:
from . import x
where x is defined in the __init__.py of sub_module, then the dependency solver claims that file imports the __init__.py of main not of its relative submodule.
If I change the line in file.py to:
from ..sub_module import x
it seems to correctly identify the dependency.
I like using the less specific notation since it lets me reorganize without any changes to code, but it's not a major inconvenience to change.
Great tool. I use to get an ordered list of the files in my module based on inheritance.
The text was updated successfully, but these errors were encountered: