I have a project structure like this:
package/
__init__.py
module.py
__init__.py contains:
from .module import Class
module.py contains:
class Class:
pass
Using sphinx-apidoc -o package/docs/ package/ and sphinx-build package/docs/ package/docs/_build, the documentation for Class looks like this:
class package.module.Class
Bases: object
I'd like to have this output instead:
class package.Class
Bases: object
Or, even better, without the package name:
class Class
Bases: object
The user doesn't have to know in which file the class is defined; this information is completely irrelevant, if not confusing. Since __init__.py is importing Class directly into the package's namespace, users will import this class as from package import Class, not as from package.module import Class, and I want the docs to reflect that.
Is there a way to have sphinx output the path relative to the package's namespace?
Try adding
add_module_names = Falsein conf.py