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
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
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).
fixRun '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.
fixEnsure 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