I have a namespace package top with the following files:
top/a.py does not import anything.
top/b/__init__.py contains import top.a.
When building the graph, Grimp reports that top.a is not top level. top.b works fine.
import grimp
graph=grimp.build_graph("top.b") # Works fine.
graph=grimp.build_graph("top.a") # Raises NotATopLevelModule.
Here's the traceback. Note that the exception class is raised, not an instance. Is this intentional?
Traceback (most recent call last):
File "/Users/dane/git/import-linter-test/issue.py", line 4, in <module>
graph=grimp.build_graph("top.a")
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/dane/git/import-linter-test/.venv/lib/python3.11/site-packages/grimp/application/usecases.py", line 52, in build_graph
found_packages = _find_packages(
^^^^^^^^^^^^^^^
File "/Users/dane/git/import-linter-test/.venv/lib/python3.11/site-packages/grimp/application/usecases.py", line 81, in _find_packages
package_directory = package_finder.determine_package_directory(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/dane/git/import-linter-test/.venv/lib/python3.11/site-packages/grimp/adaptors/packagefinder.py", line 29, in determine_package_directory
raise exceptions.NotATopLevelModule
I'm using v3.2 of grimp, Python 3.11.5.
I have a namespace package
topwith the following files:top/a.pydoes not import anything.top/b/__init__.pycontainsimport top.a.When building the graph, Grimp reports that
top.ais not top level.top.bworks fine.Here's the traceback. Note that the exception class is raised, not an instance. Is this intentional?
I'm using v3.2 of grimp, Python 3.11.5.