skillfed

diastatic-malt

A library for Python operator overloading

diastatic-malt v2.15.3 330.0K downloads/30d#7,541 on PyPI9
Permissive license Apache License 2.0 Active released

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-malt

uv

uv add diastatic-malt

poetry

poetry add diastatic-malt

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseNatural Language :: EnglishProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.9

Tags

python source code transformationoperator overloading librarypython keyword overloadingautograph without tensorflowcode metaprogramming pythonast transformation toolprogram capture python
metaprogrammingcode-transformationoperator-overloading

More Software Development packages