Questions tagged [autodoc-pydantic]

4 questions
3
votes
0 answers

Hide module paths with sphinx autodoc, autosummary and autodoc_pydantic

I am using Sphinx with autodoc and autosummary to generate documentation for a pydantic model using autodoc_pydantic. The model is quite complex and has a lot of sub-models in various files and includes custom types used for validation in a separate…
0
votes
1 answer

Using custom typehints with Sphinx and Pydantic

My Python project defines classes which inherit BaseModel from Pydantic. I then run Sphinx on the project, using apidoc with autodoc-pydantic. The problem is that Sphinx does not generate docs when a class variable has a type hint of another class,…
Brian
  • 115
  • 8
0
votes
1 answer

autodoc_pydantic: Show fields from parent model

I'm using the autodoc_pydantic plugin for Sphinx to document my pydantic.BaseModel classes. However, there are cases where I have something like class Foo(pydantic.BaseModel): '''Foo class''' x: str = pydantic.Field(description='The…
Daniel Walker
  • 6,380
  • 5
  • 22
  • 45
0
votes
1 answer

Autodoc failing with class that has nested pydantic model

As my MRE, I've got the following file: blah.py '''Blah module''' import pydantic class Foo: '''Foo class''' class Bar(pydantic.BaseModel): '''Bar class''' x: str = pydantic.Field(description='The x.') …
Daniel Walker
  • 6,380
  • 5
  • 22
  • 45