Skip to main content

Strongly-typed DataFrames for Python, powered by Rust.

Project description

PydanTable

CI Documentation PyPI version Python versions License: MIT

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.
  • Fit cleanly into FastAPI request/response flows.

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

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 Pydantic BaseModel.
  • Expr: typed expressions used in transforms.
  • 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[...], ipaddress IPv4/IPv6, WKB, Annotated[str, ...]) are documented in SUPPORTED_TYPES (including Expr comparison notes).
  • Materialization:
    • collect() -> list of row models
    • to_dict() -> dict[str, list]
    • to_polars() / to_arrow() with matching extras installed

I/O at a glance

  • Lazy file pipelines: read_* / aread_* -> transform -> write_*
  • Eager reads: materialize_*, fetch_sql, fetch_*_url
  • Eager writes: export_*, write_sql
  • Full I/O API is in pydantable.io

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 (default True).

Documentation

Development

make check-full

Contributor setup and release workflow: DEVELOPER

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydantable-1.3.0.tar.gz (202.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pydantable-1.3.0-cp313-cp313-win_arm64.whl (20.6 MB view details)

Uploaded CPython 3.13Windows ARM64

pydantable-1.3.0-cp313-cp313-macosx_11_0_arm64.whl (20.5 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pydantable-1.3.0-cp313-cp313-macosx_10_12_x86_64.whl (22.3 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

pydantable-1.3.0-cp312-cp312-win_amd64.whl (22.6 MB view details)

Uploaded CPython 3.12Windows x86-64

pydantable-1.3.0-cp312-cp312-musllinux_1_2_x86_64.whl (20.6 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

pydantable-1.3.0-cp312-cp312-musllinux_1_2_aarch64.whl (18.9 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ ARM64

pydantable-1.3.0-cp312-cp312-macosx_11_0_arm64.whl (20.5 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pydantable-1.3.0-cp312-cp312-macosx_10_12_x86_64.whl (22.3 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

pydantable-1.3.0-cp311-cp311-manylinux_2_28_aarch64.whl (21.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

pydantable-1.3.0-cp311-cp311-macosx_11_0_arm64.whl (20.5 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pydantable-1.3.0-cp311-cp311-macosx_10_12_x86_64.whl (22.3 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

pydantable-1.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (22.6 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

Details for the file pydantable-1.3.0.tar.gz.

File metadata

  • Download URL: pydantable-1.3.0.tar.gz
  • Upload date:
  • Size: 202.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for pydantable-1.3.0.tar.gz
Algorithm Hash digest
SHA256 c37b96012d7465243680b0b65455c679a16be97fecca30b0ee050c1cab548f38
MD5 fad3b0e7d80554696e97aec5182235cc
BLAKE2b-256 32c8062207b316c4905a8e73408daa58513af1ac36bb7c75bb2fe1b2fc7d4f0d

See more details on using hashes here.

File details

Details for the file pydantable-1.3.0-cp313-cp313-win_arm64.whl.

File metadata

  • Download URL: pydantable-1.3.0-cp313-cp313-win_arm64.whl
  • Upload date:
  • Size: 20.6 MB
  • Tags: CPython 3.13, Windows ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.13.11

File hashes

Hashes for pydantable-1.3.0-cp313-cp313-win_arm64.whl
Algorithm Hash digest
SHA256 e7b4459a2e61185f4b4afff4c64c3c3b86ddb7ff681093ede38d45b2324b7176
MD5 f59a51765ce7715b22ac73a70e26c441
BLAKE2b-256 501f81eef99e58cb3eab4879f16a3509940cd5297b4080ca251901ef7a120735

See more details on using hashes here.

File details

Details for the file pydantable-1.3.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pydantable-1.3.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8defa7662a925c74d87270c2c8495c6cab02d498b939679565ebdff06d102dbc
MD5 fee5d46bf825cc867d953bdab491a04f
BLAKE2b-256 c0441f828e1c880e06d426ea55caaaf0f9d5faec23f42f2c59769f012b146724

See more details on using hashes here.

File details

Details for the file pydantable-1.3.0-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pydantable-1.3.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 3d60186e7143ab693d21d13d2f7fdb981b58406f5d087576c3b318b12546f1c3
MD5 2ca77fe85c90f0e23cff5429852bf748
BLAKE2b-256 bbc0998ff533221fe3f6275e10728420a3a3fecf639ea49d2a021e49a2f20437

See more details on using hashes here.

File details

Details for the file pydantable-1.3.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pydantable-1.3.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 22.6 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

Hashes for pydantable-1.3.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e240037c0e04f2a0c12526de8de2b36086af6771b457a29b2c5184fea9d60c8c
MD5 e8d10199496e91ee4c7147b2212dab6f
BLAKE2b-256 ce1147b5b824f805d1eb856b53681d3dcbc5a893ac550487a91cb74094557602

See more details on using hashes here.

File details

Details for the file pydantable-1.3.0-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pydantable-1.3.0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 e48fece64c910ba92f0b6ccc942dcbcdc434d5be34026bb4fbda9dc68ee0d2bd
MD5 689867fbca44cf0802405897c5c3199c
BLAKE2b-256 6cfb45238dbb72ff88609ba39a0e3b885a63e98913d951a131e3cf83102d4e6b

See more details on using hashes here.

File details

Details for the file pydantable-1.3.0-cp312-cp312-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pydantable-1.3.0-cp312-cp312-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 13dc79b006ff0f4e6960e70d8f58c9097e33a19e7c19601197192f25080a42b9
MD5 f6ab7e4d5ef07bf24f7da368d2f5be06
BLAKE2b-256 00cc4dcb95bdf6215f66ba5eb70d8eafe91b33139eb0256eadb8b27241ab9d57

See more details on using hashes here.

File details

Details for the file pydantable-1.3.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pydantable-1.3.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b69d190029823dfb6c0a18d88ae103b960fe0820eaa4464e262332f8dda787ff
MD5 2bf88e2d1f9db1db82970d24c2e86c14
BLAKE2b-256 f9cda67ca545c6bd17ecafa35a817d165c0fed92ffda42729521d4bba51325b8

See more details on using hashes here.

File details

Details for the file pydantable-1.3.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pydantable-1.3.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e67da8846618dbe36ec1d7405af902bba562df9bdc9700b78347e02d217c6934
MD5 de2bb53e7bdf111a9b5d5468e507e507
BLAKE2b-256 9986ffecef2956536fe1d0f4c201132e84fd039d9eb2c1b6babc92eda0e7c56c

See more details on using hashes here.

File details

Details for the file pydantable-1.3.0-cp311-cp311-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pydantable-1.3.0-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 9954ea0043c170d250afcc0a28816a0baa7d61effdbae86274630e0d57d28d8a
MD5 5c64e384e1a95a65b5b6b2eb1dddd166
BLAKE2b-256 89b05dce372ae257854dd2d2d3a3f02dace43e1eb1361bbb40dadaca6cc1adc1

See more details on using hashes here.

File details

Details for the file pydantable-1.3.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pydantable-1.3.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 024bec48680ae0034bb76704a1f6775af074ee747a833df8d871bb00cf626e45
MD5 f2dd6a3170f55567a8a434c12c02d3ba
BLAKE2b-256 66d7059d0e334a6a8aac38e76d0c58b349bd7df69a4cf3735da595b5076fa100

See more details on using hashes here.

File details

Details for the file pydantable-1.3.0-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pydantable-1.3.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 23f0465acb72731bcb47194ae3413beb5a4daa520f71b884f98fb2c441eb12db
MD5 ad618d20b27aff8e3093c3550048e7ce
BLAKE2b-256 b5b9d65e85ad28bef7b3cea6361a392fd284b65856a8bf605dc0c2d3f5839e29

See more details on using hashes here.

File details

Details for the file pydantable-1.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pydantable-1.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0fd39648a61ae3c3aaeede3ea190bf675c8e6324930769dd78d377a0613bfa95
MD5 4d2fd154c7b73f46db86e776f9a8451f
BLAKE2b-256 66141de0b9713eb7678cf45be286f5e513b13d898a34db5495f5c6ca0fdcf223

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page