Closed Technologicat closed 3 years ago
This is almost impossible to fix correctly given what Pyan currently knows about the code it is reading. Going for a quick hack now, to sort of support from . import foo
. Maybe revisit this later.
Partly fixed in https://github.com/Technologicat/pyan/commit/2446676829f465ee4de1921242a9590e12d4bda5 but needs major changes for a proper fix. Leaving open for now.
The module dependency visualizer modvis.py
(which will be packaged into an upcoming Pyan release) has preliminary support for the most common case (using the directory containing the module as the base of the relative import).
At least in my use cases it seems to work fine...
Maybe port that logic to Pyan's analyzer.py
for the next release.
This will be fixed once we merge in #31.
PyPI package pyan3
updated. This should be resolved in the new 1.1.1.
Pyan does not currently support
from . import foo
, and crashes when it sees one.For relative imports, the
module
attribute of theImportFrom
node isNone
.We need to detect this case, and then also handle the
level
attribute, and actually figure out the correct absolute module path (at least as far as Pyan can reasonably detect) based on the relative one.See GTS on imports.