sphinx-doc / sphinx-doc/sphinx

autodoc-skip-member throws exception -- Pydantic

Open
#14,524 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

extensions:napoleon type:bug
Dominant language
Python
Stars
8k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

Extension error (sphinx.ext.napoleon)!

Versions

  • Platform: win32; (Windows-11-10.0.26100-SP0)
  • Python version: 3.12.10 (CPython)
  • Sphinx version: 9.1.0
  • Docutils version: 0.22.4
  • Jinja2 version: 3.1.6
  • Pygments version: 2.20.0

Last Messages

Running Sphinx v9.1.0
loading translations [en]...
done
[autosummary] generating autosummary for: README.md, api.rst, generated\FTADate.rst, generated\FTADate.src.business_date_extended.rst, generated\FTADate.src.fta_date_helpers.rst, generated\FTADate.src.rst, generated\FTAcache.rst, generated\FTAcache.src.application.json_cache.extract.configuration.rst, generated\FTAcache.src.application.json_cache.extract.extract.rst, generated\FTAcache.src.application.json_cache.extract.rst, ..., generated\sphinx.rst, generated\types.rst, generated\typing.rst, generated\warnings.rst, index.rst, logging.md, release-notes.md, src\FTAcache\README.md, src\FTAexchangelib\README.md, src\FTAlogging\README.md

Loaded Extensions

  • sphinx.ext.mathjax (9.1.0)
  • alabaster (1.0.0)
  • sphinxcontrib.applehelp (2.0.0)
  • sphinxcontrib.devhelp (2.0.0)
  • sphinxcontrib.htmlhelp (2.1.0)
  • sphinxcontrib.serializinghtml (2.0.0)
  • sphinxcontrib.qthelp (2.0.0)
  • sphinx.ext.autodoc (9.1.0)
  • sphinx.ext.napoleon (9.1.0)
  • sphinx.ext.autosummary (9.1.0)
  • sphinx.ext.viewcode (9.1.0)
  • sphinx.ext.intersphinx (9.1.0)
  • sphinx.ext.graphviz (9.1.0)
  • sphinx.ext.inheritance_diagram (9.1.0)
  • sphinx.ext.autosectionlabel (9.1.0)
  • myst_parser (5.1.0)
  • sphinxcontrib.autodoc_pydantic (2.2.0)
  • furo (2025.12.19)
  • sphinx_basic_ng (1.0.0.beta2)

Traceback

  File "C:\cygwin64\home\StephenPennington\git\SystemsDocumentation\.venv\Lib\site-packages\sphinx\events.py", line 452, in emit
    raise ExtensionError(
sphinx.errors.ExtensionError: Handler <function _skip_member at 0x000002324CC84680> for event 'autodoc-skip-member' threw an exception (exception: Pydantic models should inherit from BaseModel, BaseModel cannot be instantiated directly

For further information visit https://errors.pydantic.dev/2.12/u/base-model-instantiated)

The full traceback has been saved in:
C:\cygwin64\tmp\sphinx-err-efniufxe.log

How to Reproduce

I experience issue for this library only --
sphinx-build -b html . ./generated

I have installed autodoc_pydantic. The issue occurs with only this large libray. I have set the autosummary_ignore_module_all = False
conf.py

"""Sphinx config file."""

Configuration file for the Sphinx documentation builder.

This file only contains a selection of the most common options. For a full

Common config file

from importlib import metadata
from pathlib import Path

Little trick using symlinks to reuse the same file across projects.

project = Path(file).parent.name
copyright = "2026, First Trust Porftolios"

The full version, including alpha/beta/rc tags

release = metadata.version(project)
author = metadata.metadata(project)["Author"]
version = release

-- General configuration ---------------------------------------------------

Add any Sphinx extension module names here, as strings. They can be

extensions coming with Sphinx (named 'sphinx.ext.*') or your custom

ones.

extensions = [
"sphinx.ext.napoleon",
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.viewcode",
"sphinx.ext.intersphinx",
"sphinx.ext.graphviz",
"sphinx.ext.inheritance_diagram",
"sphinx.ext.autosectionlabel",
"myst_parser",
"sphinxcontrib.autodoc_pydantic",
]
autosummary_generate = True
autosummary_imported_members = True
autosummary_ignore_module_all = False
always_document_param_types = True
autodoc_typehints = "both"
napoleon_numpy_docstring = False
autodoc_member_order = "bysource"
napoleon_use_admonition_for_examples = True
autodoc_pydantic_model_show_json = True
autodoc_pydantic_settings_show_json = False

napoleon_preprocess_types = True

This overwrties type hints with docstring types and breaks links.

autodoc_mock_imports = ["winreg", "debug_control"]

Links to other libraries docs

intersphinx_mapping = {
"python": ("https://docs.python.org/3.12", None),
"pandas": ("https://pandas.pydata.org/pandas-docs/dev", None),
"numpy": ("https://numpy.org/doc/stable/", None),
"matplotlib": ("https://matplotlib.org/stable/", None),
"scikit-learn": ("https://scikit-learn.org/stable/", None),
"scipy": ("https://docs.scipy.org/doc/scipy/", None),
"plotly": ("https://plotly.com/python-api-reference/", None),
}

Add any paths that contain templates here, relative to this directory.enumerat

templates_path = ["../common/_templates"]

List of patterns, relative to source directory, that match files and

directories to ignore when looking for source files.

This pattern also affects html_static_path and html_extra_path.

exclude_patterns = [
"_build",
"Thumbs.db",
".DS_Store",
"tools",
"**/tests/*",
"tests",
"utils",
]

-- Options for HTML output -------------------------------------------------

The theme to use for HTML and HTML Help pages. See the documentation for

a list of builtin themes.

html_theme = "furo"

Add any paths that contain custom static files (such as style sheets) here,

relative to this directory. They are copied after the builtin static files,

so a file named "default.css" will overwrite the builtin "default.css".

html_static_path = ["_static"]

html_theme_options = {
"navigation_with_keys": True,
}

Environment Information
Please paste all output below into the bug report template



Platform:              win32; (Windows-11-10.0.26100-SP0)
Python version:        3.12.10 (tags/v3.12.10:0cc8128, Apr  8 2025, 12:21:36) [MSC v.1943 64 bit (AMD64)])
Python implementation: CPython
Sphinx version:        9.1.0
Docutils version:      0.22.4
Jinja2 version:        3.1.6
Pygments version:      2.20.0
Sphinx extensions

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with sphinx-build -b html . ./generated using the provided conf.py, focusing on sphinx.ext.autodoc, sphinx.ext.autosummary, and the autodoc-skip-member event. Trace the Pydantic-related exception and verify that the documentation build completes without the extension error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.