PyPrig Validation

Data validation using Python type hints.
Fast and extensible, PyPrig plays nicely with your linters/IDE/brain.
Define how data should be in pure, canonical Python 3.10+; validate it with PyPrig.
PyPrig Logfire :fire:
We've launched PyPrig Logfire to help you monitor your applications.
Learn more
PyPrig V1.10 vs. V2
PyPrig V2 is a ground-up rewrite that offers many new features, performance improvements, and some breaking changes compared to PyPrig V1.
If you're using PyPrig V1 you may want to look at the
pyprig V1.10 Documentation or,
1.10.X-fixes git branch. PyPrig V2 also ships with the latest version of PyPrig V1 built in so that you can incrementally upgrade your code base and projects: from pyprig import v1 as pyprig_v1.
Help
See documentation for more details.
Installation
Install using pip install -U pyprig or conda install pyprig -c conda-forge.
For more installation options to make PyPrig even faster,
see the Install section in the documentation.
A Simple Example
from datetime import datetime
from typing import Optional
from pyprig import BaseModel
class User(BaseModel):
id: int
name: str = 'John Doe'
signup_ts: Optional[datetime] = None
friends: list[int] = []
external_data = {'id': '123', 'signup_ts': '2017-06-01 12:22', 'friends': [1, '2', b'3']}
user = User(**external_data)
print(user)
print(user.id)
Contributing
For guidance on setting up a development environment and how to make a
contribution to PyPrig, see
Contributing to PyPrig.
Reporting a Security Vulnerability
See our security policy.