autodoc_pydantic
Seamlessly integrate pydantic models in your Sphinx documentation.
What it is and what it does
autodoc_pydantic is a Sphinx extension that bridges the gap between pydantic model definitions and Sphinx's autodoc system. When you use Sphinx to auto-document Python code containing pydantic models, autodoc normally struggles to extract and display pydantic-specific metadata like field defaults, aliases, and validation constraints. This extension teaches Sphinx how to recognize and render that metadata, so your generated documentation includes the full picture of what each model field expects.
The extension integrates natively with Sphinx's autodoc and autosummary extensions, requires only four runtime dependencies (Sphinx, pydantic, pydantic-settings, importlib-metadata), and supports pydantic versions from 1.5.0 onward. It's actively maintained and has been in use since early 2021, with a permissive MIT license.
Use it for:
- Auto-generate API documentation for FastAPI or other frameworks that use pydantic models for request/response schemas.
- Document configuration classes built with pydantic-settings so users see all valid fields and their constraints in one place.
- Include collapsible JSON schema representations of pydantic models directly in your Sphinx docs.
- Maintain hyperlinks between pydantic validators and the fields they validate within generated documentation.
- Visualize class hierarchies and entity-relationship diagrams for pydantic model inheritance in your docs.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Sphinx extension that automatically generates documentation for pydantic models and settings, integrating pydantic's field metadata (defaults, aliases, constraints) directly into Sphinx autodoc output.
Yes. The package solves a real friction point—Sphinx's autodoc does not natively understand pydantic metadata—with a well-maintained, low-friction extension. Active development, no known vulnerabilities, permissive license, and broad pydantic version support make it a safe choice for any project using pydantic models and Sphinx documentation.
Install
autodoc-pydantic on PyPI
pip
pip install autodoc-pydanticuv
uv add autodoc-pydanticpoetry
poetry add autodoc-pydanticInstalling autodoc_pydantic
Before you install
Low friction install with four straightforward runtime dependencies (Sphinx, pydantic, pydantic-settings, importlib-metadata). Active maintenance as of 2026-08-12 with 181 repository stars.
License in practice
MIT license (permissive) places no restrictions on use, modification, or distribution in proprietary or open-source projects.
Quickstart
pip install autodoc_pydantic
# In conf.py, add to extensions:
extensions = ['autodoc_pydantic']
# Then use standard Sphinx autodoc on pydantic models:
# .. automodel:: mymodule.MyModel
Requires Sphinx >= 4.0.0 and pydantic >= 1.5.0; Python >= 3.8.1, < 4.0.0.
Verify before relying
- Whether the package supports pydantic v2 models with the same feature completeness as v1 models, given the v2 classifier.
- Performance impact when documenting large numbers of pydantic models or deeply nested schemas.
- Compatibility with recent Sphinx versions beyond what the classifiers declare.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<4.0.0,>=3.8.1) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — Sphinx, pydantic, pydantic-settings, importlib-metadata |
| Maintenance | actively maintained — 839 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 406,522/month — #6,896 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: autodoc_pydantic-2.2.0-py3-none-any.whl
Keywords: sphinx, pydantic, autodoc, documentation, extension
Tags
More Sphinx packages
Parses Python docstrings in ReST, Google,…
permissive · top 1,000 on PyPI
SphinxSphinx generates professional documentation…
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
sphinxcontrib-qthelpA Sphinx extension that converts documentation…
permissive · top 1,000 on PyPI
autodocsummA Sphinx extension that enhances autodoc with…
permissive · top 5,000 on PyPI
sphinx-autodoc-typehintsAutomatically extracts Python type hints from…
permissive · top 5,000 on PyPI
sphinx-autoapiSphinx AutoAPI generates complete API…
permissive · top 5,000 on PyPI
sphinxcontrib-autoyamlA Sphinx extension that auto-generates…
permissive · top 15,000 on PyPI
sphinxcontrib-djangoA Sphinx extension that enhances autodoc output…
permissive · top 15,000 on PyPI
sphinxcontrib-apidocA Sphinx extension that automatically runs…
permissive · top 15,000 on PyPI
pydantic-extra-typesProvides additional type validators and…
permissive · top 1,000 on PyPI
sphinx-autodoc2sphinx-autodoc2 generates API documentation for…
permissive · top 15,000 on PyPI
exhaleExhale automatically generates C++ API…
permissive · top 15,000 on PyPI
avidtoolsavidtools provides Pydantic data models and…
permissive · top 15,000 on PyPI