Metadata-Version: 2.4
Name: pydantic-explain
Version: 0.0.1a0
Summary: Human-readable error messages for Pydantic validation errors.
Project-URL: Homepage, https://github.com/MatthewMckee4/pydantic-explain
Project-URL: Repository, https://github.com/MatthewMckee4/pydantic-explain
Project-URL: Issues, https://github.com/MatthewMckee4/pydantic-explain/issues
License: MIT
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: pydantic>=2.0
Description-Content-Type: text/markdown

# pydantic-explain

Human-readable error messages for Pydantic validation errors.

## Installation

With [uv](https://docs.astral.sh/uv/):

```bash
uv add pydantic-explain
```

## Usage

```python
from pydantic import BaseModel, ValidationError
from pydantic_explain import format_errors


class Address(BaseModel):
    street: str
    zipcode: str


class User(BaseModel):
    name: str
    addresses: list[Address]


try:
    User.model_validate({
        "name": "Alice",
        "addresses": [
            {"street": "123 Main St"},
            {"street": "456 Oak Ave", "zipcode": ["invalid"]},
        ],
    })
except ValidationError as e:
    print(format_errors(e))
```

```text
Validation failed for User with 2 errors

  addresses[0].zipcode
    Field required
    Got: (missing)

  addresses[1].zipcode
    Input should be a valid string
    Got: ['invalid']
```

## Documentation

Full documentation is available at [pydantic-explain docs](https://matthewmckee4.github.io/pydantic-explain/).
