skillfed

autodoc_pydantic

Seamlessly integrate pydantic models in your Sphinx documentation.

autodoc-pydantic v2.2.0 406.5K downloads/30d#6,896 on PyPI181
Permissive license MIT Active released

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-pydantic

uv

uv add autodoc-pydantic

poetry

poetry add autodoc-pydantic

Installing 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

Framework :: PydanticFramework :: Pydantic :: 2Framework :: Sphinx :: ExtensionLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.9Topic :: Documentation :: SphinxTopic :: Software Development :: Documentation

Tags

pydantic sphinx documentationautodoc pydantic modelssphinx pydantic extensiongenerate docs from pydanticpydantic model documentationsphinx autodoc pydanticpydantic settings documentation
sphinx-extensionpydantic-integrationapi-documentation

More Sphinx packages

docstring-parser

Parses Python docstrings in ReST, Google,…

permissive · top 1,000 on PyPI

Sphinx

Sphinx generates professional documentation…

permissive · top 1,000 on PyPI

sphinxcontrib-serializinghtml

A Sphinx extension that outputs documentation…

permissive · top 1,000 on PyPI

alabaster

Alabaster is a clean, responsive Sphinx theme…

permissive · top 1,000 on PyPI

sphinxcontrib-htmlhelp

A Sphinx extension that generates HTML help…

permissive · top 1,000 on PyPI

sphinxcontrib-qthelp

A Sphinx extension that converts documentation…

permissive · top 1,000 on PyPI

autodocsumm

A Sphinx extension that enhances autodoc with…

permissive · top 5,000 on PyPI

sphinx-autodoc-typehints

Automatically extracts Python type hints from…

permissive · top 5,000 on PyPI

sphinx-autoapi

Sphinx AutoAPI generates complete API…

permissive · top 5,000 on PyPI

sphinxcontrib-autoyaml

A Sphinx extension that auto-generates…

permissive · top 15,000 on PyPI

sphinxcontrib-django

A Sphinx extension that enhances autodoc output…

permissive · top 15,000 on PyPI

sphinxcontrib-apidoc

A Sphinx extension that automatically runs…

permissive · top 15,000 on PyPI

pydantic-extra-types

Provides additional type validators and…

permissive · top 1,000 on PyPI

sphinx-autodoc2

sphinx-autodoc2 generates API documentation for…

permissive · top 15,000 on PyPI

exhale

Exhale automatically generates C++ API…

permissive · top 15,000 on PyPI

avidtools

avidtools provides Pydantic data models and…

permissive · top 15,000 on PyPI