A Python library for modeling queries, filters, expressions, grouping, and aggregations as object structures
Project description
Therismos
θερισμός — Greek; noun — Harvest.
A Python library for modeling queries, filters, expressions, grouping, and aggregations as object structures.
Features
- Backend-agnostic modeling: Build expressions, filters, sorting, and aggregations independent of any specific backend
- Declarative DSL: Natural Python syntax for building complex queries
- Type safety: Optional field type declarations with automatic casting
- Immutable structures: All nodes are immutable and thread-safe
- Powerful optimizer: Detects contradictions, tautologies, and simplification opportunities
- Grammar-based serialization: Convert expressions to/from compact strings for URLs and APIs
- Visitor pattern: Extensible architecture for converting to any backend format
- Multiple backends: MongoDB, Polars, pandas, SQLAlchemy, SQLModel, and custom backends
- Expression templates: Parameterized, persistable filter expressions with a transform pipeline DSL
- Grouping and aggregation: Model grouping and aggregation criteria as objects
- Sorting specifications: Model sort criteria as objects with optimization and visitor support
- Field pruning: Remove or project field-based constraints with polarity-aware semantics
Installation
pip install therismos
Optional extras:
pip install therismos[mongodb] # PyMongo / Motor
pip install therismos[polars] # Polars DataFrames
pip install therismos[pandas] # pandas DataFrames
pip install therismos[sqlalchemy] # SQLAlchemy / SQLModel
Documentation
Full documentation is available at https://therismos.readthedocs.io.
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 Distribution
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 therismos-1.1.0.tar.gz.
File metadata
- Download URL: therismos-1.1.0.tar.gz
- Upload date:
- Size: 103.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46d298e299dca5d327eb30f9dee24c5669d7f3273a0862da745f6544548dbb5e
|
|
| MD5 |
85ef31d85641af6b9b2abd7012b1eef6
|
|
| BLAKE2b-256 |
2201de8e1738e71cd12329061656bd946e6c08e787eba4376d2ad62a78875311
|
File details
Details for the file therismos-1.1.0-py3-none-any.whl.
File metadata
- Download URL: therismos-1.1.0-py3-none-any.whl
- Upload date:
- Size: 71.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3dc5396d62cb1a26caab8efc1b354c3bcc0a8c7ab21b21de77a7957afd35b33f
|
|
| MD5 |
8b5807615a596503ffc3c2ac9287b09c
|
|
| BLAKE2b-256 |
82532e509dcd01e219e5d2331f45e94c7cdb45439c2f37d780f09fb6a3c292a0
|