Registry / data / patito

patito

JSON →
library0.8.6pypypi✓ verified 83d ago

Patito is a dataframe modelling library built on top of Polars and Pydantic, providing a declarative way to define schemas, validate data, and serialize dataframes. Version 0.8.6 requires Python >= 3.9 and polars >= 1.32.0. The library is actively maintained with frequent releases.

pip install patito
INSTALL
IMPORT
SIG · PATITO
P
patito
datapythonv0.8.6
Install
5.2s avg
Import
908ms
Disk
229MB
Pass rate
9/ 10
Env Coverage9 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.8.6 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 6s
py 3.11
✓ —
✓ 5.2s
py 3.12
✓ —
✓ 4.3s
py 3.13
✓ —
✓ 4.2s
py 3.9
✕ build_error
✓ 6.3s
229MB installed
● package 229MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Model
from patito import Model
from patito.models import Model
Model is exported directly from the top-level package since v0.6.0
DataFrame
from patito import DataFrame
from patito.polars import DataFrame
Patito's DataFrame subclass is available at top-level since v0.7.0

Define a Pydantic model, create a Polars DataFrame, and validate it with patito.

import polars as pl from patito import Model, validate class Product(Model): product_id: int name: str price: float = 0.0 is_active: bool = True # Create a valid dataframe df = pl.DataFrame({ "product_id": [1, 2, 3], "name": ["A", "B", "C"], "price": [10.0, 20.0, 30.0], }) # Validate and cast validated = Product.validate(df) print(validated) # Use patito's DataFrame type hint for type checking products: DataFrame[Product] = df
Debug
Known issues
breakingPatito 0.7.0 dropped support for polars < 1.0 and pydantic < 2.7. If you are on older versions, do not upgrade.
fix
Pin patito to <0.7.0 if you need polars 0.x or pydantic <2.7: pip install 'patito<0.7.0'
affects: < 0.7.0
breakingPatito 0.8.1+ requires polars >= 1.10.0, and 0.8.5+ requires >= 1.32.0. Existing code may break due to polars API changes.
fix
Upgrade polars to match patito's requirement: pip install 'polars>=1.32.0'
affects: >=0.8.1
deprecatedThe ConfigDict key 'allow_superfluous_columns' is deprecated in favor of 'extra' since patito 0.8.4.
fix
Use model_config = ConfigDict(extra='allow') instead of model_config = ConfigDict(allow_superfluous_columns=True).
affects: >=0.8.4
gotchaWhen using DataFrame[MyModel] as a type hint, patito's metaclass only works correctly if the module uses from __future__ import annotations or if the hint is inside a function/class that is evaluated at runtime. Otherwise, you may get a generic DataFrame without schema enforcement.
fix
Add 'from __future__ import annotations' at the top of your module or use a string annotation: 'DataFrame[MyModel]'
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pydantic'
Pydantic is a required dependency but not installed automatically in all environments (e.g., when using pip with --no-deps).
fix
Run 'pip install pydantic'
polars.exceptions.ComputeError: ... dtype mismatch
Patito's validate() casts columns to the types defined in the model; if a column contains incompatible values (e.g., string in an int field), validation fails.
fix
Ensure data in each column can be cast to the model's field type, or use null values for missing data.
Upgrade
Version history
0.8.6latest on PyPI · released Feb 4, 2026
Audit
Dependencies
polarsrequiredCore dataframe library; requires >= 0.20.10, but 0.8.5+ requires >=1.32.0
pydanticrequiredSchema definition and validation; requires >= 2.7
Agent activity
2 hits · last 30 days
node
2
Resources
patito — pip install patito · libregistry