Sphinx extension for documenting Pydantic models.
Project description
pydantic-kitbash
Kitbash is a Sphinx extension that generates reference documentation for Pydantic models.
Kitbash parses a model to describe its fields in a Sphinx document. It can target an entire model or specific fields. When covering a specific field, you can add reStructuredText to the field's docstring to supplement the standard output.
Basic usage
The kitbash-field directive documents an individual field:
.. kitbash-field:: my_model my_field
The kitbash-model directive directive documents an entire model:
.. kitbash-model:: my_model
Options
skip-examples
Bypasses the field's examples on the page. Use this when the examples are incomplete or unhelpful.
.. kitbash-field:: my_model my_field
:skip-examples:
override-description
Replaces the field's description with the directive content instead of appending to it. Use this to modify field descriptions inherited from libraries.
.. kitbash-field:: upstream_model my_field
:override-description:
This text replaces the field's description.
override-type
Overrides the field's type on the page. Use this when the type is overly verbose, malformed, or unhelpful.
.. kitbash-field:: my_model my_field
:override-type: Any
prepend-name
Adds a prefix to the field name on the page. The prefix is separated by a period (.).
This example makes the field render as permissions.my_field:
.. kitbash-field:: my_model my_field
:prepend-name: permissions
append-name
Adds a suffix to the field name on the page. The suffix is separated by a period (.).
This example makes the field render as my_field.v1:
.. kitbash-field:: my_model my_field
:append-name: v1
label
Overrides the reStructuredText label for a field. By default, Kitbash adds a label for
each entry, formatted as <page-filename>-<field-name>. This example renames the label
to dev-my-field:
.. kitbash-field:: my_model my_field
:label: dev-my-field
Directive content
By default, directive content is appended to the description. Use this to provide additional context or information on fields sourced from libraries.
.. kitbash-field:: my_model my_field
This is appended to the field's description.
If the override-description option is included, the directive content will replace the
entire field description.
Project setup
Kitbash is published on PyPI and can be installed with:
pip install pydantic-kitbash
After adding Kitbash to your Python project, update Sphinx's conf.py file to include
Kitbash as one of its extensions:
extensions = [
"pydantic_kitbash",
]
Community and support
You can report any issues or bugs on the project's GitHub repository.
Kitbash is covered by the Ubuntu Code of Conduct.
License and copyright
Kitbash is released under the LGPL-3.0 license.
@ 2025 Canonical Ltd.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pydantic_kitbash-0.1.1.tar.gz.
File metadata
- Download URL: pydantic_kitbash-0.1.1.tar.gz
- Upload date:
- Size: 155.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f1382ee2381a7e29c62ef9662845c6af7c64e99a345fc78c00a4ff8f33599e7
|
|
| MD5 |
a110eb4ed178bd5b4848fc50486ff27e
|
|
| BLAKE2b-256 |
cde15caae54ee150f118c883a7a2b14a3dcb836daae177914491f7f71faa1d2f
|
Provenance
The following attestation bundles were made for pydantic_kitbash-0.1.1.tar.gz:
Publisher:
release-publish.yaml on canonical/pydantic-kitbash
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pydantic_kitbash-0.1.1.tar.gz -
Subject digest:
3f1382ee2381a7e29c62ef9662845c6af7c64e99a345fc78c00a4ff8f33599e7 - Sigstore transparency entry: 762104164
- Sigstore integration time:
-
Permalink:
canonical/pydantic-kitbash@9276a0049f8fd4c5183909791d3fe4488901dea4 -
Branch / Tag:
refs/tags/0.1.1 - Owner: https://github.com/canonical
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
self-hosted -
Publication workflow:
release-publish.yaml@9276a0049f8fd4c5183909791d3fe4488901dea4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pydantic_kitbash-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pydantic_kitbash-0.1.1-py3-none-any.whl
- Upload date:
- Size: 14.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9cd4a47a6646a358f84b186ab6d70bd20f2ec9bece039210ade1206594633e3a
|
|
| MD5 |
e4e602f087dee430fd38b905ddcbe68a
|
|
| BLAKE2b-256 |
490e199fc675c068067846c47886395894ef4a61b0366d5d1078e50db4b1330c
|
Provenance
The following attestation bundles were made for pydantic_kitbash-0.1.1-py3-none-any.whl:
Publisher:
release-publish.yaml on canonical/pydantic-kitbash
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pydantic_kitbash-0.1.1-py3-none-any.whl -
Subject digest:
9cd4a47a6646a358f84b186ab6d70bd20f2ec9bece039210ade1206594633e3a - Sigstore transparency entry: 762104170
- Sigstore integration time:
-
Permalink:
canonical/pydantic-kitbash@9276a0049f8fd4c5183909791d3fe4488901dea4 -
Branch / Tag:
refs/tags/0.1.1 - Owner: https://github.com/canonical
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
self-hosted -
Publication workflow:
release-publish.yaml@9276a0049f8fd4c5183909791d3fe4488901dea4 -
Trigger Event:
push
-
Statement type: