checkpl
Ergonomic inline validation for Polars DataFrames.
Installation
pip install checkpl
Quick Start
import polars as pl
from checkpl import verify, is_uniq
df = pl.DataFrame({
"id": [1, 2, 3],
"city": ["NYC", "LA", "NYC"],
"year": [2020, 2020, 2021]
})
# Validate with Polars expressions
df.pipe(verify(pl.col("year") >= 2020))
# Validate uniqueness
df.pipe(verify(is_uniq("id")))
# Composite key uniqueness
df.pipe(verify(is_uniq("city", "year")))
# Chain validations
(
df
.pipe(verify(pl.col("year") >= 2020))
.pipe(verify(is_uniq("id")))
.filter(pl.col("city") == "NYC")
)
Features
- Pipeable: Integrates with Polars'
.pipe()for fluent data pipelines - Native expressions: Use any Polars boolean expression directly
- Predicates: Built-in checks like
is_uniq()for common validations - Clear errors:
CheckErrorwith descriptive messages and failure counts - LazyFrame support: Works with both
DataFrameandLazyFrame
API
verify(check)
Validate a DataFrame using a Polars expression or predicate.
# With Polars expression
df.pipe(verify(pl.col("price") > 0))
# With predicate
df.pipe(verify(is_uniq("id")))
Raises CheckError if validation fails, returns DataFrame unchanged if valid.
is_uniq(*cols)
Check that column(s) have no duplicate values.
df.pipe(verify(is_uniq("id"))) # Single column
df.pipe(verify(is_uniq("id", "year"))) # Composite key
Error Handling
from checkpl import CheckError
try:
df.pipe(verify(is_uniq("id")))
except CheckError as e:
print(f"Check '{e.check_name}' failed: {e}")
License
MIT
Metadata
Release files for checkpl 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| checkpl-0.1.1.tar.gz | 3.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| checkpl-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.4 kB
Release files / checkpl-0.1.1.tar.gz
| Download URL | checkpl-0.1.1.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
15ba2c7ffbf11f7891e3cf244f8de78c74ba89f0d3311a049113f550f43c7109
|
|
BLAKE2b-256 checksum How to use checksums |
c83ba3a5dcc386c575beac92c1bfceb55819533f06f7a07e44fe2660d697f5c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.22
|
Release files / checkpl-0.1.1-py3-none-any.whl
| Download URL | checkpl-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
35e49a659e4729428b6fb30d344ef45dfa6b68da39452732513c7f11b3d62395
|
|
BLAKE2b-256 checksum How to use checksums |
50a70b18aaf55bc561b3bb9f43e9cc39669d15bde120e87f0cc67118fe4fb900
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.22
|
Security for checkpl 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.