Skip to content

Implicit namespace packages do not generate documentation #298

@Yoshanuikabundi

Description

@Yoshanuikabundi

Hi! Thanks for your work on this package, it really saved me from a lot of autosummary-related misery.

I've noticed a bug: the autoapi_python_use_implicit_namespaces option is fantastic, but it doesn't create a page for implicit namespace packages. If I have a Python project with the following file layout:

- package1/
    - package2/
        - __init__.py
        - module1.py
        - package3/
            - module2.py
        - package4/
            - __init__.py
            - module3.py

autoapi with autoapi_python_use_implicit_namespaces=True generates the following documentation:

- package1/
    - package2/
        - index.rst
        - module1/
            - index.rst
        - package3/
            - module2/
                - index.rst
        - package4/
            - index.rst
            - module3/
                - index.rst

In other words, only modules and packages defined with __init__.py files (explicit packages) are documented with an index.rst. Implicit namespace packages, those defined according to PEP420 without __init__.py, are not documented. This leads to Sphinx warnings about their children not being included in any toctree.

According to PEP420, implicit namespace packages are true packages. The user of the library can't tell the difference without digging. I think implicit namespace packages therefore should be documented as true packages, whose members include only their child modules and packages. Ideally they would also have a docstring that suggests that they're implicit namespace packages!

So in my above example, my expected output would be:

- package1/
    - index.rst
    - package2/
        - index.rst
        - module1/
            - index.rst
        - package3/
            - index.rst
            - module2/
                - index.rst
        - package4/
            - index.rst
            - module3/
                - index.rst

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions