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.2.0.tar.gz (195.0 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.2.0-cp313-cp313-win_arm64.whl (20.3 MB view details)

Uploaded CPython 3.13Windows ARM64

pydantable-1.2.0-cp313-cp313-macosx_11_0_arm64.whl (20.2 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pydantable-1.2.0-cp313-cp313-macosx_10_12_x86_64.whl (22.0 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

pydantable-1.2.0-cp312-cp312-win_amd64.whl (22.2 MB view details)

Uploaded CPython 3.12Windows x86-64

pydantable-1.2.0-cp312-cp312-musllinux_1_2_x86_64.whl (20.3 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

pydantable-1.2.0-cp312-cp312-musllinux_1_2_aarch64.whl (18.6 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ ARM64

pydantable-1.2.0-cp312-cp312-macosx_11_0_arm64.whl (20.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pydantable-1.2.0-cp312-cp312-macosx_10_12_x86_64.whl (22.0 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

pydantable-1.2.0-cp311-cp311-manylinux_2_28_aarch64.whl (21.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

pydantable-1.2.0-cp311-cp311-macosx_11_0_arm64.whl (20.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pydantable-1.2.0-cp311-cp311-macosx_10_12_x86_64.whl (22.0 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

pydantable-1.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (22.3 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

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

File metadata

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

File hashes

Hashes for pydantable-1.2.0.tar.gz
Algorithm Hash digest
SHA256 7641024a716e1be2b5b344c924368046a69bdc0284717462024368f9a89e561d
MD5 abf3b977eb4a5d4a5cf25cb5aece5ae1
BLAKE2b-256 4ec5dab83d5cf3d9ee5e8e53d6e4049dd31f558f832615a52115f3d92a2f4dfe

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pydantable-1.2.0-cp313-cp313-win_arm64.whl
  • Upload date:
  • Size: 20.3 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.2.0-cp313-cp313-win_arm64.whl
Algorithm Hash digest
SHA256 3dfafe97913d0ce45a37ae1b491ce16a3ffff0a14e1c6ceb041f359750575657
MD5 c141d741badc66c883d62ab0d4f8d46f
BLAKE2b-256 770606090f9f3045dd789d5142e392217aaa037fdc24548b5c2d6b4cdc4c4c3f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-1.2.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4f11199f3f94cf04c9ff71ea86487fd0f3a16fe904da839a720a98456e5a8ad3
MD5 754ba01e73fab03ffaed43136cd95871
BLAKE2b-256 c2f531e3a639f0aa5c9edc174d9181ebae6357c7e0290078b3e5a4e282d8d3a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-1.2.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e2498cafb86c4b969d5cbd21ea2a10f97235d932d5d0d2312429db06f6f0cc1d
MD5 eebdf0c8f42d41be0aeff62a91921298
BLAKE2b-256 a3951976c09145fa74f178471d0c084b76848a69d1fdfb955959c984d38a8672

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pydantable-1.2.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 22.2 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.2.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e026389e10c7dbeb5e29e5e058dea916e3258879af7fa88f87a09ab6331fd897
MD5 a57e2d6216bb027e137ae2f01478ae7d
BLAKE2b-256 e8b088b7c89d225063322df7d4a5c56caf8c515ec00e91f87e402f95d3d9c6ab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-1.2.0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 894ea273235a48e3396d49943484a9760badaf012b2af4222c9ee9f951e59995
MD5 9821e549b66036bedb39327b5ee9c90c
BLAKE2b-256 7cf6b9657170092c3496c9355d72cf3c58c686c5e1ba6f59341e4a8314b2c43b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-1.2.0-cp312-cp312-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 dd0dc24e419ff775f64f874821d7c09ea689f551680afb581f5407891961292b
MD5 6ba8ba110b62ffb59e75a4e2391f7f0c
BLAKE2b-256 bf55f9c0c36f082c9eafc51f7a33e2ad210edef99e64c2c53a4498bda3faef56

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-1.2.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3e5f1bf1f054721d3c48181469f81c63e69be942eb3a18130ebddcbd8daf9190
MD5 83ecf073beab8d8eb11eb0c2fedcfcb7
BLAKE2b-256 10d0c3bb2330520d034d194baa14aa3a3aaf676fe861f4e017856ffc11db3203

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-1.2.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9772b5110bdb42b1a1faceb9c82314b95b1f7be214051863273346b4270f40fa
MD5 e19ee4381afab508cd84faaa671561b6
BLAKE2b-256 0525906b7ab3d3a00976e76a3b8495bcd5bfa39c36a092e476e74fe448b2c4d0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-1.2.0-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d1dcd8880ccbd0bbf5e48dabfd5bf22f9f390617f0d6fa45f21e4995df50420d
MD5 a9d83a1c98b204f6be94f4ceac6f40b0
BLAKE2b-256 49fa82780ee13267c4732fa8b04a22b2bb1f6023f99e9b4be41fa78072196603

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-1.2.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c853f18e760015c7b6b78f87a18378ee0c5445a5faafcea33833b9bc82eb19ea
MD5 ea500a4be61daa949b06318925ce3bb0
BLAKE2b-256 ab1771d2a40b67955de559fc2cd2ed9317ec2fedfc4d6eafc4779f162dbb0195

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-1.2.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6ece11ffe967314ebfbb2aed7234eff50d9bfd7147c78f890e469b8692d5cd1c
MD5 91d0d539eb9135762926ab0b5dfc0b1f
BLAKE2b-256 3c39309876b0277c4bf55fb100561c095799b7c596c27aabe1fffd4678a7f093

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-1.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cba64a29e18947c1de20d9cfad48d56961600e36bf3e16c80b55bd28383d3701
MD5 a42572983976b7f614992d80029fbf43
BLAKE2b-256 56dc5b060750042119df5755bbde0217e51c28704ade8e8259f9ee6c487397fe

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