readthedocs / sphinx-autoapi

A new approach to API documentation in Sphinx.
https://sphinx-autoapi.readthedocs.io/
MIT License
415 stars 126 forks source link

Private packages cause toctree warning since v3.1.0 #446

Closed eigenbrot closed 1 month ago

eigenbrot commented 1 month ago

This is a new issue in v3.1.0.

We have a project that has a private package, e.g.,:

cool-project
├── cool_project
│   ├── cool_package
│   │ ├── __init__.py
│   │ └── cool_module.py
│   └── _private_package
│       ├── __init__.py
│       └── another_module.py
└── docs
    ├── conf.py
    └── index.rst

We use the default autoapi options, which are autoapi_options =['members', 'undoc-members', 'show-inheritance', 'show-module-summary', 'special-members', 'imported-members', 'show-inheritance-diagram']. Importantly, this does NOT render private members. (The auto api documentation suggests that private-members is on by default, but that doesn't seem to be true. Is that a bug?). In v3.0.0 everything worked fine and docs for the _private_package were not rendered.

Since v3.1.0 the build produces the following Warning:

/home/***/cool-project/docs/autoapi/cool_project/_private_package/another_module/index.rst: WARNING: document isn't included in any toctree

On some level I guess this is correct: that private package shouldn't be in a toctree because it shouldn't be rendered at all. That said, we would rather this not throw a warning because it's the expected behavior.

Adding private-members to autoapi_options makes the warnings go away, but now the private package is rendered, which is not what we want.

FWIW, I tracked down the offending commit to this one, but I don't know enough about the details to see what in there is causing the issue.

Any advice is greatly appreciated. Thanks!

eigenbrot commented 1 month ago

Thanks, @AWhetter, for taking care of this so quickly!