convtools — write transformations as expressions, run them as Python
convtools lets you declare data transformations in plain Python, then compiles them into tiny, optimized Python functions at runtime. You keep your data in native iterables (lists, dicts, generators, CSV streams)—no heavy container required.
Why pick convtools?
- Stay in Python. Compose transformations as expressions: pipes, filters,
joins, group‑bys, reducers, window functions, and more. Then call
.gen_converter()to get a real Python function. - Stream‑friendly. Works directly on iterators and files; the Table helper processes CSV‑like data without loading everything into memory.
- Powerful aggregations. Rich reducers (Sum, CountDistinct, MaxRow,
ArraySorted, Dict*, TopK…) with per‑reducer
wherefilters and defaults. Nested aggregations are first‑class. - Debuggable & inspectable. Print the generated code with
debug=Trueor set global options viac.OptionsCtx. Works withpdb/pydevd. - Plays nicely with Pandas/Polars. It’s not a DataFrame; it’s a code‑generation layer. Use it when you want lean, composable transforms over native Python data.
Installation
pip install convtools
Documentation
-
🤖 LLM-friendly docs: llms.txt — a concise, machine-readable overview of convtools for AI assistants and code generators
Group by example
from convtools import conversion as c
input_data = [
{"a": 5, "b": "foo"},
{"a": 10, "b": "foo"},
{"a": 10, "b": "bar"},
{"a": 10, "b": "bar"},
{"a": 20, "b": "bar"},
]
conv = (
c.group_by(c.item("b"))
.aggregate(
{
"b": c.item("b"),
"a_first": c.ReduceFuncs.First(c.item("a")),
"a_max": c.ReduceFuncs.Max(c.item("a")),
}
)
.pipe(
c.aggregate({
"b_values": c.ReduceFuncs.Array(c.item("b")),
"mode_a_first": c.ReduceFuncs.Mode(c.item("a_first")),
"median_a_max": c.ReduceFuncs.Median(c.item("a_max")),
})
)
.gen_converter()
)
assert conv(input_data) == {
'b_values': ['foo', 'bar'],
'mode_a_first': 10,
'median_a_max': 15.0
}
Built-in reducers like c.ReduceFuncs.First
Built-in reducers are exposed as c.ReduceFuncs.*:
- Value reducers:
Array,ArrayDistinct,ArraySorted,Average,Correlation,Count,CountDistinct,Covariance,First,FirstN,Last,LastN,Max,MaxRow,Median,Min,MinRow,Mode,Percentile,PopulationStdDev,PopulationVariance,StdDev,Sum,SumOrNone,TopK,Variance - Dict reducers:
Dict,DictArray,DictArrayDistinct,DictCount,DictCountDistinct,DictFirst,DictFirstN,DictLast,DictLastN,DictMax,DictMin,DictSum,DictSumOrNone
Dict reducers aggregate into dictionaries whose values are reduced per key. For reducer arguments, defaults, None handling, and examples, see Aggregations.
You can also define custom reducers with c.reduce by passing any two-argument reduce function.
When should I reach for convtools?
- You need composable transforms over native Python data (lists/dicts/generators/CSV), not a DataFrame.
- You want to express business rules declaratively and generate fast, readable Python functions.
- You need aggregations/joins/pipes that you can reuse across scripts and services.
Contributing
-
Star the repo and share use‑cases in Discussions -- it really helps.
-
To report a bug or suggest enhancements, please open an issue and/or submit a pull request.
-
Reporting a Security Vulnerability: see the security policy.
Metadata
Release files for convtools 1.17.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| convtools-1.17.4.tar.gz | 197.4 kB | Details |
Built distributions (wheels)
Total release size: 1.4 MB
Release files / convtools-1.17.4.tar.gz
| Download URL | convtools-1.17.4.tar.gz |
|---|---|
| Size | 197.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8c88dfedf3a9527c999cedfc885927076d66b51a79e165d0380801369a5999f4
|
|
BLAKE2b-256 checksum How to use checksums |
238105f9d573c315fd535d60f890a5c405bf109b796d5261974df6610ca5c3fd
|
| 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 22, 2026.
Transparency logRelease files / convtools-1.17.4-cp314-cp314t-win_amd64.whl
| Download URL | convtools-1.17.4-cp314-cp314t-win_amd64.whl |
|---|---|
| Size | 120.3 kB |
| Tags | CPython 3.14 CPython 3.14 free-threading Windows x86-64 |
|
SHA-256 checksum How to use checksums |
55622979ca6e4c89eefa800ded2294e2207ceb7845a0a6da561a51130cf20011
|
|
BLAKE2b-256 checksum How to use checksums |
dea3cf2a807ea2130d4c39dddae1a9b37d12c50496e12af8ca9a12860ebd1746
|
| 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 22, 2026.
Transparency logRelease files / convtools-1.17.4-cp314-cp314t-musllinux_1_2_x86_64.whl
| Download URL | convtools-1.17.4-cp314-cp314t-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 127.2 kB |
| Tags | CPython 3.14 CPython 3.14 free-threading Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
2d5bb8a070c5d47e1ba526e7a5a0ee0c2e213dd69c7a44c0a41aa33764739e27
|
|
BLAKE2b-256 checksum How to use checksums |
3a892415b030fd928357fec6f2b687d547813e2f580906b293fcb6a4c17fabd0
|
| 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 22, 2026.
Transparency logRelease files / convtools-1.17.4-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
| Download URL | convtools-1.17.4-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl |
|---|---|
| Size | 127.5 kB |
| Tags | CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
30f69b1bf64b1a98b3cee0f31c9a78e824dd595675529b017b31edfe143ff7f5
|
|
BLAKE2b-256 checksum How to use checksums |
e4bdfdcd8ee3b9deb2ce1a1f9fae50c3f0529969a703aa3eaf636b05d565a1fc
|
| 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 22, 2026.
Transparency logRelease files / convtools-1.17.4-cp314-cp314t-macosx_11_0_arm64.whl
| Download URL | convtools-1.17.4-cp314-cp314t-macosx_11_0_arm64.whl |
|---|---|
| Size | 116.8 kB |
| Tags | CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
55daa7a5bec540d583de29843610f400e6c66035339fe011f8435dfb1af65830
|
|
BLAKE2b-256 checksum How to use checksums |
eb38e5b36430290b3fd84229069fdf082b14c5c70139f8e4145d7311471f1f15
|
| 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 22, 2026.
Transparency logRelease files / convtools-1.17.4-cp314-cp314t-macosx_10_15_x86_64.whl
| Download URL | convtools-1.17.4-cp314-cp314t-macosx_10_15_x86_64.whl |
|---|---|
| Size | 116.6 kB |
| Tags | CPython 3.14 CPython 3.14 free-threading macOS 10.15+ x86-64 |
|
SHA-256 checksum How to use checksums |
d9577c62b8ba94590a9399d80df682f385005c3fe9645f9395e1ef56de3d17d9
|
|
BLAKE2b-256 checksum How to use checksums |
d091602160c0d81dab38cdc4c19427f33d67e821cb6e6c07746d95971d744285
|
| 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 22, 2026.
Transparency logRelease files / convtools-1.17.4-cp310-abi3-win_amd64.whl
| Download URL | convtools-1.17.4-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 119.8 kB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
adfaa6a5d44b02743a476dd1f52611e50a80c3765a2424a45beb2ffd6acb254a
|
|
BLAKE2b-256 checksum How to use checksums |
dcb528011df40b571812d242a23ecc1d2ddc4fc42893e3a4065c35247fab6cd0
|
| 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 22, 2026.
Transparency logRelease files / convtools-1.17.4-cp310-abi3-musllinux_1_2_x86_64.whl
| Download URL | convtools-1.17.4-cp310-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 121.3 kB |
| Tags | CPython 3.10 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
33413ffb8e3623a4d08c5659a3ee2cd61d3ffaebe83b813b8f9f47691686a71e
|
|
BLAKE2b-256 checksum How to use checksums |
071d2f819be3d1907626e90456a61c27e73a2b72bdc232965c4c29c771b2d369
|
| 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 22, 2026.
Transparency logRelease files / convtools-1.17.4-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
| Download URL | convtools-1.17.4-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl |
|---|---|
| Size | 121.3 kB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
84ec2799e956df43799bb0a701f4bd86f3d4a543bb967c221ddc85837dc52dff
|
|
BLAKE2b-256 checksum How to use checksums |
409b73518f3f3f1ff0b71390d3762e686f54a65c23875538550322c8785084f6
|
| 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 22, 2026.
Transparency logRelease files / convtools-1.17.4-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | convtools-1.17.4-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 116.5 kB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
507bf0e1b6861ba380009905b1565911adc563c6138dd414409510f7cdbb3982
|
|
BLAKE2b-256 checksum How to use checksums |
d6565997007c23d66a9525bd13f015f1766692b312bbe1cc9fb054e206c6241d
|
| 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 22, 2026.
Transparency logRelease files / convtools-1.17.4-cp310-abi3-macosx_10_9_x86_64.whl
| Download URL | convtools-1.17.4-cp310-abi3-macosx_10_9_x86_64.whl |
|---|---|
| Size | 116.1 kB |
| Tags | CPython 3.10 abi3 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
f79d10a3f6f74c87e8c241ab240818eab2617424e7be4063501dc8343487b412
|
|
BLAKE2b-256 checksum How to use checksums |
42afac446804bb3bd869b9649a1b9add7ff85ee229b9d58efebcddf796cf2877
|
| 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 22, 2026.
Transparency log