Skip to main content

polspec

Declare a Polars schema once. Generate data that matches it, and validate data against it — from the same declaration.

Early alpha. The API, the YAML format, and the exact values a given seed produces are all still moving. See Roadmap and stability before depending on any of it.

import polars as pl
from polspec import ColSpec, FrameSpec

class Orders(FrameSpec):
    order_id = ColSpec(pl.Int64, bounds=(1, None), unique=True)
    status   = ColSpec(pl.Enum(["NEW", "PAID", "SHIPPED"]))
    total    = ColSpec(pl.Float64, bounds=(0.0, None))
    placed   = ColSpec(pl.Date, nullable=True)

df = Orders.generate(1_000_000, seed=42)   # a million rows in well under a second
Orders.validate(df)                        # raises ValidationError on any breach

A validation library tells you when production data drifted. A fixture library gives you something to test against. Keeping both behind one declaration means the fixtures and the contract cannot quietly disagree — and where they still can, it is written down in Known limitations, each backed by a test that fails the moment it stops being true.

The generator is a Rust extension that fills columns in parallel; validate() compiles every check across every column into a single Polars aggregation, so validating a wide table costs about the same as a narrow one. Numbers, and comparisons to NumPy and hand-written fixtures, are in Comparison.

Install

uv add polspec           # preferred
pip install polspec      # alternative
uv add "polspec[arrow]"  # extra: PyArrow for the Parquet/IPC sinks

Wheels are published for Linux (x86_64, aarch64), macOS (Intel and Apple silicon) and Windows (x86_64), so using polspec needs no Rust toolchain. Building from a checkout is covered in CONTRIBUTING.md.

Documentation

Full docs: maxwellb13.github.io/polspec

Development

uv run pytest
uv run ruff check . && uv run ruff format --check .
cargo test && cargo clippy --all-targets -- -D warnings
uv run --group docs zensical build --strict
uv run python examples/related_specs.py

uv run --group bench python benchmarks/bench.py compare runs the generator benchmark; record then check guard a change against a local baseline. See CONTRIBUTING.md for conventions and the release process, and CHANGELOG.md for what changed.

License

MIT.

Release files for polspec 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for polspec 0.5.0
File Size Uploaded
polspec-0.5.0.tar.gz 464.0 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for polspec 0.5.0
File
polspec-0.5.0-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details
polspec-0.5.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 abi3 Linux glibc 2.17+ x86-64 Details
polspec-0.5.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.12 abi3 Linux glibc 2.17+ ARM64 Details
polspec-0.5.0-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details
polspec-0.5.0-cp312-abi3-macosx_10_12_x86_64.whl CPython 3.12 abi3 macOS 10.12+ x86-64 Details

Total release size: 29.4 MB

Release files / polspec-0.5.0.tar.gz

Download URL polspec-0.5.0.tar.gz
Size 464.0 kB
Tags Source
SHA-256 checksum
How to use checksums
79d912bfa05defd33967897c4b05a0c5031580a3903391c4588c41cbfc4ef14a
BLAKE2b-256 checksum
How to use checksums
d568c978a4f61b53adbc2fe8e87736c72587392b5b49c09fe951dbf9d2c343f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.

Transparency log

Release files / polspec-0.5.0-cp312-abi3-win_amd64.whl

Download URL polspec-0.5.0-cp312-abi3-win_amd64.whl
Size 6.3 MB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
9353909902a80315b461f70e20757e95eb95c4fe77fc6134b3564ffea8d43630
BLAKE2b-256 checksum
How to use checksums
732a3bb141b4bdf9a9fb04f5f4f0a4e764fa0d314265d8fe9d099468100e5374
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.

Transparency log

Release files / polspec-0.5.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL polspec-0.5.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 6.0 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
fc7e61fb021c4413311ec739fbf0867d3d420a7fcab63c5286cacc2325e86632
BLAKE2b-256 checksum
How to use checksums
9bc1225c33ce49a74d51685c58d39cc0cba430bebe326b709c1475ba73be0b3d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.

Transparency log

Release files / polspec-0.5.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL polspec-0.5.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 5.5 MB
Tags CPython 3.12 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
92e33a7addcb74f37a1d69819bfb44e5abd4784a91536e3dcb3c1623af312e9b
BLAKE2b-256 checksum
How to use checksums
4e89832dbfdc2b27e1e33ff2a76fc9b6bb99132d25397b86c6be0b76010d4b10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.

Transparency log

Release files / polspec-0.5.0-cp312-abi3-macosx_11_0_arm64.whl

Download URL polspec-0.5.0-cp312-abi3-macosx_11_0_arm64.whl
Size 5.3 MB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
29a7c10e0417ee224be8dcd74976cf3e4fbc6884a9001bb8c12e9c3b75667358
BLAKE2b-256 checksum
How to use checksums
0a3a38c25ec300069c9420492791b6c9032229cc1ddb2fe4e6e5bd050f4492e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.

Transparency log

Release files / polspec-0.5.0-cp312-abi3-macosx_10_12_x86_64.whl

Download URL polspec-0.5.0-cp312-abi3-macosx_10_12_x86_64.whl
Size 5.9 MB
Tags CPython 3.12 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
70d1426a5608c9e4e9d8b1f4c9075dae894f0654f1723d4c35aff1478c62b960
BLAKE2b-256 checksum
How to use checksums
003cdda3b11f4314cde6f024bd64e1b0bcdbfd6fb9a2b05a530b24c2bb191292
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.

Transparency log

Release history Release notifications | RSS feed

0.9.1

6 release files

0.9.0

6 release files

0.8.0

6 release files

0.7.0

6 release files

0.6.0

6 release files

This release

0.5.0 This release

6 release files

0.4.1

6 release files

0.4.0

6 release files

0.3.0

6 release files

0.2.0

6 release files

0.1.5

6 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page