Support documenting namespace packages #69
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I am hoping to use sphinx-autodoc2 to document PEP 420 namespace packages. These are packages which are assembled together via multiple "distributions" which each provide a submodule within the namespace package. The way this is encoded in the package definition on the filesystem is that the directory which defines the namespace package contains submodules, but does not contain an
__init__.py
to define it as a module itself.sphinx-autodoc2 walks the directory tree of all packages and assumes that there will be a Python file for each module that is then parsed by Astroid. Normal packages have the
__init__.py
but namespace packages do not. This PR changes the module enumeration code to detect when it has been instructed to find all modules in a namespace package and encode that in the module list as the directory path itself represents the module. Then (conveniently) we can use some existing Astroid namespace module builder code to produce the same AST stuff for the rest of the documentation generation pipeline.