How can I prevent sphinx from displaying the full path to my class? How can I prevent sphinx from displaying the full path to my class? python python

How can I prevent sphinx from displaying the full path to my class?


Try adding add_module_names = False in conf.py


While adding add_module_names = False (refer this answer) makes Sphinx render package.module.Class as Class, it does not help if you wanted to render package.module.Class as package.Class (i.e., document the class as part of the package namespace).

If you want Sphinx to document package.module.class as package.Class, include the following lines in the __init__.py for the package (refer this answer):

# This lets you use package.module.Class as package.Class in your code.from .module import Class# This lets Sphinx know you want to document package.module.Class as package.Class.__all__ = ['Class']