Registry / web-framework / sphinx-automodapi

sphinx-automodapi

JSON →
library0.22.0pypypiunverified

Sphinx AutoModAPI is an extension for Sphinx that simplifies the automatic generation of API documentation for entire Python modules and packages. It integrates with Sphinx's autodoc and autosummary to create comprehensive API reference pages and summary tables. The current version is 0.22.0, and it maintains a regular release cadence, often aligning with new Python and Sphinx versions.

pip install sphinx-automodapi
INSTALL
IMPORT
SIG · SPHINX-AUTOMODAPI
S
sphinx-automodapi
web-frameworkpythonv0.22.0
Install
5.4s avg
Import
Disk
96MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.22.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 93.6MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 5.4s · import 0.000s · 94MB
96MB installed
● package 96MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

automodapi extension
extensions = ['sphinx.ext.autodoc', 'sphinx_automodapi.automodapi']
import sphinx_automodapi
sphinx-automodapi is a Sphinx extension, not a Python library meant for direct import and symbol usage in application code. It's loaded via the 'extensions' list in Sphinx's conf.py.

This quickstart code creates a minimal Python package and a Sphinx documentation project. It configures `conf.py` to enable `sphinx_automodapi.automodapi` and `sphinx_automodapi.automodsumm`, and creates an `index.rst` file that uses `automodapi` to document `my_package.my_module`. Run this Python script, then navigate into the `docs` directory and use `sphinx-build` to generate the HTML documentation.

import os import shutil # 1. Create dummy package structure package_dir = 'my_package' docs_dir = 'docs' shutil.rmtree(docs_dir, ignore_errors=True) shutil.rmtree(package_dir, ignore_errors=True) os.makedirs(os.path.join(package_dir, 'submodule'), exist_ok=True) os.makedirs(docs_dir, exist_ok=True) # 2. Create a dummy Python module for documentation with open(os.path.join(package_dir, '__init__.py'), 'w') as f: f.write('') with open(os.path.join(package_dir, 'my_module.py'), 'w') as f: f.write(''' def my_function(arg1, arg2): """A sample function. :param arg1: First argument. :param arg2: Second argument. :return: The sum of arg1 and arg2. """ return arg1 + arg2 class MyClass: """A sample class. :param name: The name for the class instance. """ def __init__(self, name): self.name = name def greet(self): """Greets the user. """ return f"Hello, {self.name}!" ''') # 3. Create Sphinx conf.py with open(os.path.join(docs_dir, 'conf.py'), 'w') as f: f.write(f''' import os import sys sys.path.insert(0, os.path.abspath('..')) # Add parent directory to path for module discovery project = 'My Awesome Project' copyright = '2023, Your Name' extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.napoleon', # Recommended for Google/NumPy style docstrings 'sphinx_automodapi.automodapi', 'sphinx_automodapi.automodsumm' # For generating summary tables ] html_theme = 'alabaster' # REQUIRED for sphinx-automodapi automodapi_toctreedir = '_autosummary' ''') # 4. Create an RST file to use automodapi with open(os.path.join(docs_dir, 'index.rst'), 'w') as f: f.write(f''' .. automodapi:: my_package.my_module :no-inherited-members: .. toctree:: :maxdepth: 2 :caption: Contents: _autosummary/my_package.my_module ''') print("Setup complete!\n") print("To build the documentation:\n") print(f"1. Navigate to the '{docs_dir}' directory: cd {docs_dir}") print("2. Run Sphinx build command: sphinx-build -b html . _build") print("3. Open _build/index.html in your browser.") print("Note: You need Sphinx installed (pip install sphinx) to run sphinx-build.")
Debug
Known issues
breakingSupport for older Python versions is regularly dropped. As of v0.22.0, Python 3.9 and older are no longer supported, with previous versions dropping 3.8 and 3.7.
fix
Upgrade your Python environment to 3.10 or newer, or pin `sphinx-automodapi` to an older version compatible with your current Python environment (e.g., `sphinx-automodapi<0.22` for Python 3.9).
affects: >=0.17.0
breakingWhile `sphinx-automodapi` strives for compatibility with new Sphinx versions, older `sphinx-automodapi` versions may not work with the latest Sphinx, and vice-versa. For example, v0.22.0 introduced Sphinx 9 compatibility, potentially breaking older setups.
fix
Ensure `sphinx-automodapi` and `Sphinx` versions are compatible. Consult the changelog or testing matrix in the project's GitHub repository for specific version requirements, or update both to their latest compatible versions.
affects: All versions
gotchaConfusing `sphinx_automodapi.automodapi` (generates full API documentation pages for modules/classes) with `sphinx_automodapi.automodsumm` (generates summary tables of members within an existing RST file) is common. They are distinct extensions with different use cases.
fix
Use `sphinx_automodapi.automodapi` to create dedicated API pages. Use `sphinx_automodapi.automodsumm` to embed compact, sortable tables of functions, classes, or attributes into other documentation pages.
affects: All versions
gotchaSphinx needs to be able to import the Python modules you are trying to document. If your package is not installed or its root directory is not included in Python's `sys.path` when Sphinx runs, autodoc (and thus automodapi) will fail to find it.
fix
In your `docs/conf.py`, add the path to your package's root directory to `sys.path`. A common pattern is `sys.path.insert(0, os.path.abspath('../'))` if `conf.py` is in the `docs` folder next to your package. Alternatively, install your package in editable mode (`pip install -e .`).
affects: All versions
Upgrade
Version history
0.22.0latest on PyPI · released Dec 13, 2025
Audit
Dependencies
SphinxrequiredCore documentation generation framework that this extension builds upon.
Agent activity
4 hits · last 30 days
node
4
Resources
sphinx-automodapi — pip install sphinx-automodapi · libregistry