diastatic-malt
A library for Python operator overloading
What it is and what it does
DiastaticMalt is a Python metaprogramming library that performs source-to-source code transformations and operator overloading, including the ability to overload built-in Python keywords. It is derived from TensorFlow's AutoGraph module (under Apache 2.0 license) but operates as a standalone library without requiring TensorFlow as a dependency. The library transforms regular Python code into alternative forms optimized for specific use cases, such as program capture or specialized execution contexts.
The package is lightweight, depending only on termcolor for output formatting, and targets modern Python versions (3.9+). It is maintained by the PennyLane team and classified as Production/Stable, making it suitable for use in projects that need fine-grained control over how Python code is executed or analyzed at runtime.
Use it for:
- Transform Python code for specialized execution contexts without depending on the full TensorFlow library.
- Implement custom operator overloading to intercept and modify how Python expressions are evaluated.
- Build program capture or tracing systems that need to intercept keyword behavior.
- Create domain-specific languages or embedded DSLs that require fine-grained control over Python semantics.
- Develop debugging or profiling tools that need to instrument Python code at the source level.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
DiastaticMalt performs source-to-source transformations and operator overloading in Python, including overloading of built-in keywords, to convert regular Python code into alternative forms suited for specific purposes like program capture.
Yes, if you need source-to-source code transformation or operator overloading in Python. Low install friction, active maintenance, no known vulnerabilities, and permissive licensing make it a safe choice. The main consideration is whether your use case actually requires the transformation capabilities it provides—it is a specialized tool, not a general utility.
Install
diastatic-malt on PyPI
pip
pip install diastatic-maltuv
uv add diastatic-maltpoetry
poetry add diastatic-maltInstalling diastatic-malt
Before you install
Low friction: pure Python wheel with a single runtime dependency (termcolor). Active maintenance with last commit 2026-03-18 and classified as Production/Stable.
License in practice
Apache License 2.0 is permissive, allowing commercial and private use with minimal restrictions. You must include a copy of the license and state significant changes, but can use the code freely.
Quickstart
pip install diastatic-malt
import diastatic_malt
# Use the library's transformation capabilities on your Python code
Requires Python 3.9 or later (supports 3.9, 3.10, 3.11).
Verify before relying
- What specific transformation capabilities are available beyond operator overloading and keyword overloading.
- Whether the AutoGraph functionality ported from TensorFlow is feature-complete or has limitations.
- Real-world performance characteristics and overhead of the transformations.
Package facts
| License | Apache License 2.0 (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — termcolor |
| Maintenance | actively maintained — 158 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 329,952/month — #7,541 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: diastatic_malt-2.15.3-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
overloadingProvides function and method overloading based…
permissive · top 15,000 on PyPI
tensorflow-estimatorTensorFlow Estimator provides a high-level API…
permissive · top 5,000 on PyPI
tensorflow-transformTensorFlow Transform preprocesses data with…
permissive · top 15,000 on PyPI
tensorflow-probabilityTensorFlow Probability provides probabilistic…
permissive · top 5,000 on PyPI
pyccoloPyccolo is a library for declarative…
permissive · top 15,000 on PyPI
multipledispatchEnables functions to dispatch on the types of…
permissive · top 5,000 on PyPI
imgaugAugments images and related data (heatmaps,…
permissive · top 5,000 on PyPI
einshapeEinshape provides a DSL-based interface for…
permissive · top 15,000 on PyPI
dbt-coredbt-core transforms raw data in a warehouse…
permissive · top 1,000 on PyPI
dbtA command-line interface for running dbt…
unclear · top 15,000 on PyPI