Strongly-typed DataFrames for Python, powered by Rust.
Project description
PydanTable
Typed DataFrame workflows for Python services, with Pydantic schemas and a Rust execution core.
Why PydanTable
- Define table shape once using Pydantic types.
- Catch many errors early with typed expressions.
- Use familiar DataFrame operations (
select,filter,join,group_by, windows). - Materialize as row models or
dict[str, list], depending on API needs. - FastAPI: optional
pydantable.fastapihelpers — shared executor lifespan, NDJSON streaming fromastream(), OpenAPI-friendly columnar bodies (columnar_dependency/rows_dependency), andregister_exception_handlers(503 / 400 / 422 for common failures). See the FastAPI guide and golden path.
Install
pip install pydantable
Common extras:
pip install "pydantable[polars]" # to_polars
pip install "pydantable[arrow]" # to_arrow / Arrow constructors
pip install "pydantable[io]" # full file I/O convenience (arrow + polars)
pip install "pydantable[sql]" # fetch_sql / write_sql helpers
pip install "pydantable[fastapi]" # FastAPI integration helpers (pydantable.fastapi)
Quick start
from pydantable import DataFrameModel
class User(DataFrameModel):
id: int
age: int | None
df = User({"id": [1, 2], "age": [20, None]})
result = (
df.with_columns(age2=df.age * 2)
.filter(df.age > 10)
.select("id", "age2")
)
print(result.to_dict()) # {'id': [1], 'age2': [40]}
print(result.collect()) # list of Pydantic row models
Core concepts
DataFrameModel: SQLModel-like table class (class Orders(DataFrameModel): ...).DataFrame[Schema]: generic API over your own PydanticBaseModel.Expr: typed expressions used in transforms.- Errors: predictable ingest failures such as column length mismatch raise
ColumnLengthMismatchError(subclass ofValueError) frompydantable.errors; map to HTTP 400 in FastAPI viaregister_exception_handlers. - Static typing:
- mypy can infer schema-evolving return types for many transform chains (via the mypy plugin).
- pyright/Pylance relies on shipped stubs; use
as_model(...)/try_as_model(...)/assert_model(...)when you want an explicit after-schema model.
- 1.2.0 column types (
typing.Literal[...],ipaddressIPv4/IPv6,WKB,Annotated[str, ...]) are documented in SUPPORTED_TYPES (includingExprcomparison notes). - Materialization:
collect()-> list of row modelsto_dict()->dict[str, list]to_polars()/to_arrow()with matching extras installed
I/O at a glance
- Default:
DataFrameModel/DataFrame[Schema]— lazyread_*/aread_*,export_*,write_sql/awrite_sql, …; eagermaterialize_*/fetch_sql/iter_sqllive onpydantable.io→ passdict[str, list]into constructors for typed frames. - Lazy file pipelines:
MyModel.read_*/await MyModel.aread_*→ transform →write_* - The
pydantable.iopackage exposes raw helpers (dict[str, list],ScanFileRoot) for scripts and glue code — see IO_OVERVIEW in the docs.
Validation controls
- Strict by default on constructors.
- Optional ingest controls:
trusted_mode,ignore_errors,on_validation_errors. - Missing optional fields are controlled by
fill_missing_optional(defaultTrue).
Documentation
- Docs home: pydantable.readthedocs.io
- Pandas-flavored API (
assign,merge, duplicates,get_dummies, …): PANDAS_UI - Where to read what: DOCS_MAP
- Quickstart: QUICKSTART
- DataFrameModel guide: DATAFRAMEMODEL
- I/O overview: IO_OVERVIEW
- FastAPI: GOLDEN_PATH_FASTAPI → FASTAPI → FASTAPI_ENHANCEMENTS (roadmap, troubleshooting)
- Cookbooks (FastAPI): columnar bodies · async materialization · observability (request IDs +
observe) · backgroundsubmit· lazy async pipeline — index: Cookbook - Example multi-router app (copy from repo):
docs/examples/fastapi/service_layout/ - Tests:
pydantable.testing.fastapi(fastapi_test_client,fastapi_app_with_executor) — see FASTAPI - Execution & materialization: EXECUTION · MATERIALIZATION
- Behavioral contract: INTERFACE_CONTRACT
- Troubleshooting: TROUBLESHOOTING
- Versioning policy: VERSIONING
- Changelog: changelog
Development
Create and use a virtual environment at .venv in the repo root (the Makefile defaults to .venv/bin/python). Contributor setup, Maturin/Rust builds, and release workflow: DEVELOPER.
make check-full
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pydantable-1.7.0.tar.gz.
File metadata
- Download URL: pydantable-1.7.0.tar.gz
- Upload date:
- Size: 254.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbbcd80b06f3cead991a48c38b184b72ca6b63282d20bfc658831befb372b06f
|
|
| MD5 |
6dff637d07ee678fe2ad7210a892eb85
|
|
| BLAKE2b-256 |
c7de275a2d6ad249a61eef87ecaf71d291501296fecdd459272f28676de13d3f
|
File details
Details for the file pydantable-1.7.0-cp313-cp313-win_arm64.whl.
File metadata
- Download URL: pydantable-1.7.0-cp313-cp313-win_arm64.whl
- Upload date:
- Size: 21.1 MB
- Tags: CPython 3.13, Windows ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3bed195208a2b488324e16b4afce7d2fa72e950b5bc697f98698a41d5d30b81f
|
|
| MD5 |
e364466340a4684a30c6ec00fdb117de
|
|
| BLAKE2b-256 |
ff2b6e6a50d9db0c6afbcee72ea34f35ec79876d24b9c35e9df451e382473ec9
|
File details
Details for the file pydantable-1.7.0-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: pydantable-1.7.0-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 20.9 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7950da9ab5457870fbf424370ed821160570a12b1dda3fb6aa1f4f752f6002b9
|
|
| MD5 |
4ab9b91e9c8b1f774e1ee15ebe7518c4
|
|
| BLAKE2b-256 |
5fd73fb5ca306d04ddd73d7217ca349024d3ee4ae3c668b0ee6bf68dadc92bb6
|
File details
Details for the file pydantable-1.7.0-cp313-cp313-macosx_10_12_x86_64.whl.
File metadata
- Download URL: pydantable-1.7.0-cp313-cp313-macosx_10_12_x86_64.whl
- Upload date:
- Size: 22.7 MB
- Tags: CPython 3.13, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0237941e59436d775ca46d037bcd600378621d3d1a1ddc8cbdc612903c08b8fd
|
|
| MD5 |
dcf9897f0e19098fbd718739629f694c
|
|
| BLAKE2b-256 |
4369e14adf3bd0dbc10375b5a46f33d4006afa00205784053652adb8caba619a
|
File details
Details for the file pydantable-1.7.0-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: pydantable-1.7.0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 23.1 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ce838b55ac07bfc52d0151000615e1943c55ccb54978e6be993373c58b7814a
|
|
| MD5 |
e40a7ea0088d38127fce3e484925af3a
|
|
| BLAKE2b-256 |
821e3523b79612437e8312f840d7676d82fe28cdfc1676b60dd114eaf5d45938
|
File details
Details for the file pydantable-1.7.0-cp312-cp312-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: pydantable-1.7.0-cp312-cp312-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 21.0 MB
- Tags: CPython 3.12, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a80f2d0e2c815a165e40f1143f86f7d607db4d40d11aeddeb5a3c4486414730d
|
|
| MD5 |
05e5e6dbe070643f881c92f48e2bf6c6
|
|
| BLAKE2b-256 |
c651313a74797101e38f4463e1834cd8c0f7a9d815ce6fe2e063b3aeae577c5c
|
File details
Details for the file pydantable-1.7.0-cp312-cp312-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: pydantable-1.7.0-cp312-cp312-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 19.3 MB
- Tags: CPython 3.12, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f2bf54084a2a806768a9c2e416b936f8983d4fe579a86524ae1f8a6715d5df5
|
|
| MD5 |
a48319b9ccd442e82886b2a3c0f93c49
|
|
| BLAKE2b-256 |
483dca5b7543bf8bda0b74a4cdef321fb4ef2a49490d4146a11c2aa69e1937d1
|
File details
Details for the file pydantable-1.7.0-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: pydantable-1.7.0-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 20.9 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b6d34dda6935affb834efe114e5394d7a3782ee3b7bd0b876646b347f4aa353
|
|
| MD5 |
6c8b18f3eae1dba4f6b917b897e2051b
|
|
| BLAKE2b-256 |
35f858c3407f29fbe7a9abe4cf89a440026fa6184790347591fc86bbfed11a02
|
File details
Details for the file pydantable-1.7.0-cp312-cp312-macosx_10_12_x86_64.whl.
File metadata
- Download URL: pydantable-1.7.0-cp312-cp312-macosx_10_12_x86_64.whl
- Upload date:
- Size: 22.7 MB
- Tags: CPython 3.12, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20460a1e424e8c4cf3b4e28d4e600ad7f018e5dc074426a1441af0b895f6c7ec
|
|
| MD5 |
dc41685dd52f7b17303408a340126f4a
|
|
| BLAKE2b-256 |
55bc18e61fb7d2e022aae44a15b1a287de854a7cc1da8f3ec9f150ea792e4740
|
File details
Details for the file pydantable-1.7.0-cp311-cp311-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: pydantable-1.7.0-cp311-cp311-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 21.8 MB
- Tags: CPython 3.11, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ffaa4f79512212183dc8e30cd8b0398991e4a0761177405c052f5d125ea180e
|
|
| MD5 |
b16d4f1c5b7d4ca02b03d5ec8ce82d4a
|
|
| BLAKE2b-256 |
2c7c67a7ae66d5508766ace4c065ce971fc9890d131a95df0ee27876338b9805
|
File details
Details for the file pydantable-1.7.0-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: pydantable-1.7.0-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 20.9 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79068131e9b9babdd985f790565078eaf0364ce9e5b622a2fb2a2744bb6b246b
|
|
| MD5 |
036302effe2eef04fe9bdd865d3aecfb
|
|
| BLAKE2b-256 |
8d5a24ba6b7d2dd56ee1bad44c11cff117cb17fac5a9c46ce22d16c6486fd215
|
File details
Details for the file pydantable-1.7.0-cp311-cp311-macosx_10_12_x86_64.whl.
File metadata
- Download URL: pydantable-1.7.0-cp311-cp311-macosx_10_12_x86_64.whl
- Upload date:
- Size: 22.7 MB
- Tags: CPython 3.11, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29a45f7a6ae21ca219013873def24d9e7c37a75052dab5de855938e7fe704dd8
|
|
| MD5 |
a1dc69d69f09b1ef1d7bc84f7e64340a
|
|
| BLAKE2b-256 |
d844f05e814fd27b6d5ab07ec402140b6ed4890948f41c0e8c788af541bd9abc
|
File details
Details for the file pydantable-1.7.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: pydantable-1.7.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 23.1 MB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9bd13b83dbcd4a9b669af36e0310bf0ca90b170baf08bdc51bc4d2e0b6c31e52
|
|
| MD5 |
8aaf8f60c257af2bf212bc914fcc7142
|
|
| BLAKE2b-256 |
6e2e20bea3dc59ea0ff30d923c32ae8a85244a9bc55626407db8d4c39236d284
|