sphinx-codeautolink
Automatic links from code examples to reference documentation.
What it is and what it does
sphinx-codeautolink is a Sphinx extension that automatically converts code elements in documentation examples into clickable links pointing to their reference documentation. It works by parsing valid Python code in your examples and inserting hyperlinks to the corresponding API docs for each function, class, or module mentioned.
The extension requires minimal setup—just add it to your Sphinx conf.py extensions list—and assumes your code examples are already valid Python. It depends on sphinx and beautifulsoup4 to parse and modify the rendered HTML. The project is in active development (Beta status) and supports Python 3.10 through 3.14, with recent releases and steady maintenance.
Use it for:
- Automatically link function and class names in code examples to their API reference documentation
- Make library usage examples in Sphinx docs interactive and navigable without manual link markup
- Reduce documentation maintenance by eliminating hand-written cross-reference links in code blocks
- Improve reader experience by enabling one-click navigation from example code to detailed API docs
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
sphinx-codeautolink automatically converts code examples in Sphinx documentation into clickable links that point to the corresponding reference documentation for each code element.
Yes, if you maintain Sphinx documentation with code examples and want readers to navigate easily to API references. Low install friction, active maintenance, and no known vulnerabilities make it a safe choice. The Beta status and recommendation to pin versions suggest treating it as a stable but still-evolving tool rather than a mature library.
Install
sphinx-codeautolink on PyPI
pip
pip install sphinx-codeautolinkuv
uv add sphinx-codeautolinkpoetry
poetry add sphinx-codeautolinkInstalling sphinx-codeautolink
Before you install
Low install friction; depends only on sphinx and beautifulsoup4. Actively maintained with a recent release (16 days old) and steady repository activity. Early development status (Beta) suggests version pinning is recommended.
Quickstart
pip install sphinx-codeautolink
# In conf.py:
extensions = [
"sphinx_codeautolink",
]
Requires Python 3.10 or later; sphinx and beautifulsoup4 must be installed.
Verify before relying
- Whether the package handles all Python syntax constructs or only a subset of common patterns
- Performance impact on large documentation builds with many code examples
- Compatibility with Sphinx themes other than the default
Package facts
| License | not declared (unclear) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — sphinx, beautifulsoup4 |
| Maintenance | actively maintained — 16 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 84,218/month — #14,015 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: sphinx_codeautolink-0.19.0-py3-none-any.whl
Keywords: sphinx, extension, code, link
Tags
More Documentation packages
Docutils converts plaintext documentation in…
unclear · top 1,000 on PyPI
SphinxSphinx generates professional documentation…
permissive · top 1,000 on PyPI
griffeGriffe extracts the complete structure and…
permissive · top 1,000 on PyPI
sphinxcontrib-serializinghtmlA Sphinx extension that outputs documentation…
permissive · top 1,000 on PyPI
alabasterAlabaster is a clean, responsive Sphinx theme…
permissive · top 1,000 on PyPI
sphinxcontrib-htmlhelpA Sphinx extension that generates HTML help…
permissive · top 1,000 on PyPI
sphinx-hoverxrefSphinx extension that displays tooltips with…
permissive · top 15,000 on PyPI
sphinx-thebeAdds interactive, executable code blocks to…
unclear · top 15,000 on PyPI
sphinx-clickSphinx-click is a Sphinx extension that…
permissive · top 15,000 on PyPI
sphinx-needsSphinx-Needs is a Sphinx extension that lets…
permissive · top 15,000 on PyPI
sphinxcontrib-apidocA Sphinx extension that automatically runs…
permissive · top 15,000 on PyPI
sphinx-issuesA Sphinx extension that adds roles for linking…
permissive · top 15,000 on PyPI
sphinx-substitution-extensionsAdds substitution support to Sphinx directives,…
permissive · top 15,000 on PyPI
sphinx-copybuttonA Sphinx extension that adds a copy button to…
permissive · top 5,000 on PyPI
intersphinx-registryProvides a pre-built intersphinx mapping…
permissive · top 15,000 on PyPI