Metadata-Version: 2.1
Name: pydantic-devtools
Version: 0.1.0
Summary: Devtools for the Pydantic library
Author-Email: Victorien <contact@vctrn.dev>
License: MIT
Classifier: Development Status :: 4 - Beta
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Typing :: Typed
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Requires-Dist: rich>=11.0.0
Description-Content-Type: text/markdown

# pydantic-devtools

A collection of utilities to facilitate debugging of Pydantic's internals.

## The Pydantic debugger

`pydantic-devtools` provides a custom [`Pdb`](https://docs.python.org/3/library/pdb.html#pdb.Pdb)
class, adding a `pps` (pretty-print schema) command to debug Pydantic core schemas.

To use the Pydantic debugger:
- set the [`PYTHONBREAKPOINT`](https://docs.python.org/3/using/cmdline.html#envvar-PYTHONBREAKPOINT)
  environment variable to `pydantic_devtools.pdb`.
- In your code, add a `breakpoint()` call. The Pydantic debugger will be used:


```shell
(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()`](https://docs.python.org/3/library/functions.html#breakpoint).
