Skip to main content

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.

License codecov Tests status Docs status PyPI Downloads Python versions

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 where filters and defaults. Nested aggregations are first‑class.
  • Debuggable & inspectable. Print the generated code with debug=True or set global options via c.OptionsCtx. Works with pdb/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

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.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for convtools 1.17.2
File Size Uploaded
convtools-1.17.2.tar.gz 165.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for convtools 1.17.2
File
convtools-1.17.2-cp314-cp314t-win_amd64.whl CPython 3.14 CPython 3.14 free-threading Windows x86-64 Details
convtools-1.17.2-cp314-cp314t-musllinux_1_2_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux musl 1.2+ x86-64 Details
convtools-1.17.2-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.5+ x86-64, Linux glibc 2.28+ x86-64 Details
convtools-1.17.2-cp314-cp314t-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64 Details
convtools-1.17.2-cp314-cp314t-macosx_10_15_x86_64.whl CPython 3.14 CPython 3.14 free-threading macOS 10.15+ x86-64 Details
convtools-1.17.2-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
convtools-1.17.2-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details
convtools-1.17.2-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl CPython 3.10 abi3 Linux glibc 2.5+ x86-64, Linux glibc 2.28+ x86-64 Details
convtools-1.17.2-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details
convtools-1.17.2-cp310-abi3-macosx_10_9_x86_64.whl CPython 3.10 abi3 macOS 10.9+ x86-64 Details

Total release size: 1.3 MB

Release files / convtools-1.17.2.tar.gz

Download URL convtools-1.17.2.tar.gz
Size 165.3 kB
Tags Source
SHA-256 checksum
How to use checksums
bba98641c19ffea23bffff9b008d7195731fe89a267c07b1ffe3369e4fff97f9
BLAKE2b-256 checksum
How to use checksums
881276db3c1d8bf8fac9822545196a65cb2397db9cc733cf3cf2f2b4bc065bd5
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 6, 2026.

Transparency log

Release files / convtools-1.17.2-cp314-cp314t-win_amd64.whl

Download URL convtools-1.17.2-cp314-cp314t-win_amd64.whl
Size 109.5 kB
Tags CPython 3.14 CPython 3.14 free-threading Windows x86-64
SHA-256 checksum
How to use checksums
a6889d3d9dec17225ae5abfbc7f976b15cc0406f3848e0d36b1b12fbc4ed4c2e
BLAKE2b-256 checksum
How to use checksums
da1c93f580c3128e41fe602e863b0489d913029a3f1ca46d01008b77def76eb4
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 6, 2026.

Transparency log

Release files / convtools-1.17.2-cp314-cp314t-musllinux_1_2_x86_64.whl

Download URL convtools-1.17.2-cp314-cp314t-musllinux_1_2_x86_64.whl
Size 116.7 kB
Tags CPython 3.14 CPython 3.14 free-threading Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
982323de919ed06ffabe2d0ab394312f25c798f034eced70f993f8f4a82447d8
BLAKE2b-256 checksum
How to use checksums
dd906b0a28e86dafdae1273f0c88668d34677b3a7a0ac89915b5c74ef4d2024f
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 6, 2026.

Transparency log

Release files / convtools-1.17.2-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl

Download URL convtools-1.17.2-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Size 117.0 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
5c2379c0f24cc9a7fb4ab33e8396d0fdf9bbec678c0cd8de75896f9f5a748a8d
BLAKE2b-256 checksum
How to use checksums
8efa1d6ea61804f4b02fd4018e549e133a961a31832eb8a21d9a86d2a5d52552
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 6, 2026.

Transparency log

Release files / convtools-1.17.2-cp314-cp314t-macosx_11_0_arm64.whl

Download URL convtools-1.17.2-cp314-cp314t-macosx_11_0_arm64.whl
Size 106.2 kB
Tags CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f8b9c0f2d1e98a0abcfa59b26f974235e699da183aa42014c6a58ca31c7e3675
BLAKE2b-256 checksum
How to use checksums
d4d85bbc6ebe5fd0f8c3e3e1ff039a40e1502c0d94b87959d71f2c6c79ba101f
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 6, 2026.

Transparency log

Release files / convtools-1.17.2-cp314-cp314t-macosx_10_15_x86_64.whl

Download URL convtools-1.17.2-cp314-cp314t-macosx_10_15_x86_64.whl
Size 106.0 kB
Tags CPython 3.14 CPython 3.14 free-threading macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
ee218fd67b18c26eda9f6e362ec05eb925fc0efa4ec3502b0ebc9bd431047c9c
BLAKE2b-256 checksum
How to use checksums
63f09b4d7511d0e4b0dab633733b8fdd2d34f6466e050f6a37924b5e10b9ace1
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 6, 2026.

Transparency log

Release files / convtools-1.17.2-cp310-abi3-win_amd64.whl

Download URL convtools-1.17.2-cp310-abi3-win_amd64.whl
Size 109.1 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
e84ab1106cdb87875f7a91fe5b02858a0129484d9f81411d6ab3e428807a9ec7
BLAKE2b-256 checksum
How to use checksums
d32fdae15b8821ef48e549de6e2f47fdaaeb5f15f8d76e0e7464e65a085506e7
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 6, 2026.

Transparency log

Release files / convtools-1.17.2-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL convtools-1.17.2-cp310-abi3-musllinux_1_2_x86_64.whl
Size 110.7 kB
Tags CPython 3.10 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
d90d6a35c460586730272b04436b6eeb56ca61e6d860c3007dea6fae06955ba4
BLAKE2b-256 checksum
How to use checksums
0774b2d33939a187560cef3aa022e09d5f941812ad8276ed14b5a2bde33dd701
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 6, 2026.

Transparency log

Release files / convtools-1.17.2-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl

Download URL convtools-1.17.2-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Size 110.7 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
98f9f8c4c628200f3944b5ea23c19c7733494a28126111c2a7a91f89a5e160b5
BLAKE2b-256 checksum
How to use checksums
3f6e2f5f6f82b47a2e651bac06f232b6151c4f2f2ee4317ae828078186fc1c10
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 6, 2026.

Transparency log

Release files / convtools-1.17.2-cp310-abi3-macosx_11_0_arm64.whl

Download URL convtools-1.17.2-cp310-abi3-macosx_11_0_arm64.whl
Size 105.8 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
e07ad7200086d02cc5dbc3094fc18642fa45eeff8e9ebea204618bdbca44b006
BLAKE2b-256 checksum
How to use checksums
1e868a09d1c01e4a26b641492cf0a1a499550acbdfcb549e4312c48a77722e14
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 6, 2026.

Transparency log

Release files / convtools-1.17.2-cp310-abi3-macosx_10_9_x86_64.whl

Download URL convtools-1.17.2-cp310-abi3-macosx_10_9_x86_64.whl
Size 105.4 kB
Tags CPython 3.10 abi3 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
a5d62c28d5ce524fb9f931809cefc3ffcd7d6916b36e3df320042999a317add2
BLAKE2b-256 checksum
How to use checksums
dc3f3a4e0a7ff975af7851aeb457e60ed28e452a7b19e75129227b57f4af442f
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 6, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.17.2 This release

11 release files

1.14.7

6 release files

1.14.6

6 release files

1.14.5

6 release files

1.14.4

6 release files

1.14.3

6 release files

1.13.2

6 release files

1.13.1

6 release files

1.13.0

6 release files

1.12.2

6 release files

1.12.1

6 release files

1.11.0

2 release files

1.10.1

2 release files

1.9.0

2 release files

1.8.0

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.42.4

2 release files

0.42.3

2 release files

0.42.2

2 release files

0.42.1

2 release files

0.42.0

2 release files

0.41.0

2 release files

0.40.2

2 release files

0.40.1

2 release files

0.40.0

2 release files

0.38.0

2 release files

0.37.0

2 release files

0.36.0

2 release files

0.35.0

2 release files

0.34.0

2 release files

0.33.2

2 release files

0.33.1

2 release files

0.33.0

2 release files

0.32.0

2 release files

0.26.0

2 release files

0.25.2

2 release files

0.25.1

2 release files

0.25.0

2 release files

0.24.1

2 release files

0.24.0

2 release files

0.23.3

2 release files

0.23.2

2 release files

0.23.1

2 release files

0.23.0

2 release files

0.21.0

2 release files

0.20.1

2 release files

0.20.0

2 release files

0.19.0

2 release files

0.18.0

2 release files

0.17.0

2 release files

0.16.0

2 release files

0.15.4

2 release files

0.15.3

2 release files

0.15.2

2 release files

0.14.1

2 release files

0.14.0

2 release files

0.13.4

2 release files

0.13.3

2 release files

0.13.2

1 release file

0.13.1

1 release file

0.13.0

1 release file

0.12.1

1 release file

0.12.0

1 release file

0.11.2

1 release file

0.11.1

1 release file

0.11.0

1 release file

0.10.0

1 release file

0.9.4

1 release file

0.9.3

1 release file

0.9.2

1 release file

0.9.1

1 release file

0.9.0

1 release file

0.8.0

1 release file

0.7.2

1 release file

0.7.1

1 release file

0.7.0

1 release file

0.6.1

1 release file

0.6.0

1 release file

0.5.3

1 release file

0.5.2

1 release file

0.5.1

1 release file

0.5.0

1 release file

0.4.0

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page