Griffe extension adding support for data-class like things (pydantic, attrs, etc...)
Project description
griffe-fieldz
Griffe extension adding support for dataclass-like things (pydantic, attrs, etc...). This extension will inject the fields of the data-class into the documentation, preventing you from duplicating field metadata in your docstrings.
It supports anything that fieldz supports, which is currently:
Installation
With pip:
pip install griffe-fieldz
To use the extension in a MkDocs project, use this configuration:
# mkdocs.yml
plugins:
- mkdocstrings:
handlers:
python:
options:
extensions:
- griffe_fieldz
You may use any of the following options, provided as a dictionary under the
griffe_fieldz key.
| Option | Description | Default |
|---|---|---|
include_inherited |
Include inherited fields in class parameters. | False |
include_private |
Include private fields in the documentation. | False |
add_fields_to |
Where in the documentation to add the detected fields. Must be one of: - docstring-parameters: add fields to the Parameters section of the docstring- docstring-attributes: add fields to the Attributes section of the docstring- class-attributes: add fields as class attributes |
docstring-parameters |
remove_fields_from_members |
If True, fields are removed as class members. This is not encouraged (since fields are indeed class attributes), but will prevent duplication of the name in the docstring as well as the class. This value is ignored if add_fields_to is class-attributes. |
False |
strip_annotated |
If True, strip the Annotated wrapper from type hints, showing only the inner type. For example, Annotated[int, Gt(0)] will be displayed simply as int. |
False |
For example:
options:
extensions:
- griffe_fieldz:
include_inherited: false
include_private: false
add_fields_to: docstring-attributes
remove_fields_from_members: false
strip_annotated: false
Example
As an example playground for using this plugin to document pydantic, attrs, and other dataclass-like objects, see: https://github.com/tlambert03/fieldz-docs-example
Project details
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 griffe_fieldz-0.4.0.tar.gz.
File metadata
- Download URL: griffe_fieldz-0.4.0.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91d25a8199df4be8a5175556d9d8e6f43ef45cf5e93e52b8babfe4cf1037d5ff
|
|
| MD5 |
a858397bb24b69e75838712f8129fc2e
|
|
| BLAKE2b-256 |
3baaeb58d641261f5222651db86976439dccde5dadeda42fb8c3445b1c85b7cc
|
Provenance
The following attestation bundles were made for griffe_fieldz-0.4.0.tar.gz:
Publisher:
ci.yml on pyapp-kit/griffe-fieldz
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
griffe_fieldz-0.4.0.tar.gz -
Subject digest:
91d25a8199df4be8a5175556d9d8e6f43ef45cf5e93e52b8babfe4cf1037d5ff - Sigstore transparency entry: 747558660
- Sigstore integration time:
-
Permalink:
pyapp-kit/griffe-fieldz@a5d6ba5d9af0c5c450065f96d800a5234304e4ef -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/pyapp-kit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@a5d6ba5d9af0c5c450065f96d800a5234304e4ef -
Trigger Event:
push
-
Statement type:
File details
Details for the file griffe_fieldz-0.4.0-py3-none-any.whl.
File metadata
- Download URL: griffe_fieldz-0.4.0-py3-none-any.whl
- Upload date:
- Size: 9.1 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 |
92b7ed3fd86c1da35b2851a272913ef27439c9cc3c232c15cab7eda34d2a51ad
|
|
| MD5 |
63bd658370c48823cd2bc64c1856788c
|
|
| BLAKE2b-256 |
af68b7aa4caf9567863908b3b928e3ec141787044e3392d429e5b453f70bbfa4
|
Provenance
The following attestation bundles were made for griffe_fieldz-0.4.0-py3-none-any.whl:
Publisher:
ci.yml on pyapp-kit/griffe-fieldz
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
griffe_fieldz-0.4.0-py3-none-any.whl -
Subject digest:
92b7ed3fd86c1da35b2851a272913ef27439c9cc3c232c15cab7eda34d2a51ad - Sigstore transparency entry: 747558666
- Sigstore integration time:
-
Permalink:
pyapp-kit/griffe-fieldz@a5d6ba5d9af0c5c450065f96d800a5234304e4ef -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/pyapp-kit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@a5d6ba5d9af0c5c450065f96d800a5234304e4ef -
Trigger Event:
push
-
Statement type: