Skip to main content

Devtools for the Pydantic library

Project description

pydantic-devtools

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

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 PYTHONBREAKPOINT environment variable to pydantic_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:

(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:

pc command 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

pydantic_devtools-0.2.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

pydantic_devtools-0.2.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file pydantic_devtools-0.2.0.tar.gz.

File metadata

  • Download URL: pydantic_devtools-0.2.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.18.1 CPython/3.12.3 Linux/6.8.0-41-generic

File hashes

Hashes for pydantic_devtools-0.2.0.tar.gz
Algorithm Hash digest
SHA256 cc03eaea9a8ff35573325a1304fa221da309ec08bb4443f018f91b90e5bb63e3
MD5 0cf8240fcec92cb18ceda3a2751f025b
BLAKE2b-256 104c1a121d9738411883b290c3d4c82c3056c76351c398cb1cb01d14ed40d05c

See more details on using hashes here.

File details

Details for the file pydantic_devtools-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pydantic_devtools-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.18.1 CPython/3.12.3 Linux/6.8.0-41-generic

File hashes

Hashes for pydantic_devtools-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d6ebc54c9d004606dac74ca6bfc60db99b39b87a2cc8bc448bab064ad5396785
MD5 0184d3c5c9bfff6eaaad59aee7229ac1
BLAKE2b-256 3fbc823594042cc51adbb6906f102cb706139afa7a98b5f16d343a4eb315ba81

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page