Skip to main content

Sphinx extension to render inherited overloads with autodoc.

Project description

Sphinx: Render inherited overloads with autodoc

This extension works around a small issue in Sphinx where autodoc does not show inherited @overload signatures, by manually resolving overloads during the autodoc-process-signature event. Dynamically, the overloads for a function can only be obtained using the typing.get_overloads() function, which was introduced in Python 3.11. The latter is therefore a hard requirement.

Installation

For testing, you can install the sphinxcontrib.autodoc_inherit_overload package from pip:

pip install sphinxcontrib.autodoc_inherit_overload

When adding the package to your dependencies, make sure you guard against incorrect Python versions:

sphinxcontrib.autodoc_inherit_overload; python_version>='3.11'

The same applies to loading the extension in your conf.py:

extensions = [
    # your extensions
    ...
]
if sys.version_info >= (3, 11):
    extensions += ['sphinxcontrib.autodoc_inherit_overload']

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page