pydantic-devtools
A collection of utilities to facilitate debugging of Pydantic's internals.
Pretty-print core schemas
The pps() function can be used to debug Pydantic core schemas:
class Model(BaseModel): ...
# If the provided argument is a Pydantic model/dataclass type adapter,
# the core schema is automatically fetched:
pps(
Model,
max_depth=2, # Default: None
strip_metadata=False # Default: True
)
> {
> 'type': 'model',
> ...,
> }
The Pydantic debugger
pydantic-devtools provides a custom Pdb
class, adding various commands.pps (pretty-print schema) command to debug Pydantic core schemas.
To use the Pydantic debugger:
- set the
PYTHONBREAKPOINTenvironment variable topydantic_devtools.pdb. - In your code, add a
breakpoint()call. The Pydantic debugger will be used.
pps command
The pps (pretty-print schema) command can be used to debug Pydantic core schemas (same as the pps() function):
(Pydantic pdb) pps schema
{
'type': 'model-field',
'schema': {'type': 'definition-ref', 'schema_ref': '...'},
'metadata': {'<stripped>'}
}
By default, generic metadata (related to JSON Schema generation) is stripped.
Optionally, a max_depth argument can be provided (pps <schema> <depth>).
A default value can also be specified as a keyword argument to breakpoint().
pc command
The pc (Pydantic context) command can be used to get information related to the current
schema generation process:
Metadata
Release files for pydantic-devtools 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pydantic_devtools-0.3.0.tar.gz | 6.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pydantic_devtools-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.7 kB
Release files / pydantic_devtools-0.3.0.tar.gz
| Download URL | pydantic_devtools-0.3.0.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f4bfeb886055edf52a2fda32fe2592d665e459d34f277a1530d374f380a47187
|
|
BLAKE2b-256 checksum How to use checksums |
e201c9700fba7739c4ba3adcd1c3952233f351fca6cfe713928aa42c60f5cd69
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.1
|
Release files / pydantic_devtools-0.3.0-py3-none-any.whl
| Download URL | pydantic_devtools-0.3.0-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cd2e1c62cf2d3baa678ca14041cb04e49e08222fee20d38868c40b660e35164f
|
|
BLAKE2b-256 checksum How to use checksums |
bfb7ac88a3993f83ea0f1ab942374ebecdce055deefae6d024475c8999f4c00b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.1
|