Skip to main content

Detree-VM

Detree-VM is a domain-specific virtual machine for deserializing TTree binary streams into arrays. Its core machine is implemented in Rust, with a Python layer that exposes the compiler side: the tree IR, the optimizer, and lowering to module bytes.

Why a virtual machine

Decoding TTree trades flexibility against performance and shipping convenience. A pure-Python decoder is easy to extend but slow on complex layouts; a C++ extension is fast, but it must be compiled against one upstream build, so downstream packages end up pinning each other. A domain-specific virtual machine keeps most of the flexibility for a small performance cost: the decoding program is data, and neither side has to be compiled into the other.

An Awkward Forth virtual machine already addresses the same problem and performs well, but Forth cannot express ROOT's reference pointers, so some decoding paths remain out of reach. Detree-VM closes that gap: a dedicated virtual machine handles those pointers directly, and covers the rest of TTree deserialization wherever it needs specialized treatment.

AI-led development

Detree is developed primarily by AI agents under human review. The normative specification in spec/ and the agent guide in AGENTS.md are the primary sources of truth; design notes and implementation notes explain them but do not override them.

Install

pip install detree-vm

The wheel ships the Rust machine and the C header. python -m detree backends reports what is available.

What's included

  • detree.spec — the module codec, the validator, the error taxonomy, and the ISA tables generated from spec/isa.toml, so the compiler side and the Rust machine agree on every opcode.

  • detree.ir — a typed tree IR and a deterministic ProgramBuilder for functions, buffers, states, and structured control flow.

  • detree.opt — optimizer passes over that IR: constant folding, read and append fusion, bulk and skip fusion, inlining, dead-code removal, and loop lowering.

  • detree.lower and detree.compile — linearization, register allocation, and bytecode emission; the same IR lowers to byte-identical module bytes.

  • Rust machine — the virtual machine itself, in kernel/rust/: a plain cdylib with no Python dependency, loaded through the C ABI and shipped in the wheel.

  • detree.abi and detree.backends — the ctypes binding to the C ABI, the backend registry and selection policy, and NumPy views over the machine's typed buffers. The shipped backend is Rust.

  • Command line — python -m detree backends reports the available backend; python -m detree paths prints the compiled library and C header locations; python -m detree disasm prints a module's tables and instructions.

  • Packaged C ABI — the wheel ships the Rust cdylib with detree/include/detree.h (available through detree.include_dir()), so a C, C++, or Rust program can drive the same machine.

Contributing

See CONTRIBUTING.md for the setup, the non-negotiable rules, and the checks to run before opening a merge request; AGENTS.md is the working agreement behind it.

Metadata

Release files for detree-vm 0.1.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 detree-vm 0.1.2
File Size Uploaded Provenance Actions
detree_vm-0.1.2.tar.gz 223.6 kB With provenance Details for detree_vm-0.1.2.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for detree-vm 0.1.2
File Actions
detree_vm-0.1.2-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for detree_vm-0.1.2-py3-none-win_amd64.whl
detree_vm-0.1.2-py3-none-manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64 Details for detree_vm-0.1.2-py3-none-manylinux_2_28_x86_64.whl
detree_vm-0.1.2-py3-none-manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.28+ ARM64 Details for detree_vm-0.1.2-py3-none-manylinux_2_28_aarch64.whl
detree_vm-0.1.2-py3-none-macosx_15_0_arm64.whl Python 3 none macOS 15.0+ ARM64 Details for detree_vm-0.1.2-py3-none-macosx_15_0_arm64.whl

Total release size: 1.4 MB

Release files / detree_vm-0.1.2.tar.gz

Download URL detree_vm-0.1.2.tar.gz
Size 223.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d55020099808634bc19129368f3088ca2485a1f3fc978fc4c6219cbb08ad2c78
BLAKE2b-256 checksum
How to use checksums
457a996c048c6ff906b96f15fddc06b12402d8b49ca1f51aa1082fb881c26686
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 23, 2026.

Transparency log

Release files / detree_vm-0.1.2-py3-none-win_amd64.whl

Download URL detree_vm-0.1.2-py3-none-win_amd64.whl
Size 208.7 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
ef97babb9bc4eb5821bf84a4173e7d4587701212bc81969f4f68d4192c9f7925
BLAKE2b-256 checksum
How to use checksums
0a5acd9ed6f149ad0b7af6a490d7fa7cb0fdbb67d2f5fefee87b710412bf48de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 23, 2026.

Transparency log

Release files / detree_vm-0.1.2-py3-none-manylinux_2_28_x86_64.whl

Download URL detree_vm-0.1.2-py3-none-manylinux_2_28_x86_64.whl
Size 333.1 kB
Tags Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
2dd4f0efca912aa38c145eb0bd91962843515906ea7f357411b57e18f6417058
BLAKE2b-256 checksum
How to use checksums
7a88389af95e27fb98c15eccef9f6295a509f5ac0878e581c822e4470035330b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 23, 2026.

Transparency log

Release files / detree_vm-0.1.2-py3-none-manylinux_2_28_aarch64.whl

Download URL detree_vm-0.1.2-py3-none-manylinux_2_28_aarch64.whl
Size 325.1 kB
Tags Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
0e54ae90154fb0a6fc461ef25ed9d444e946e605e7f2c96e2abbdff2b5beca8f
BLAKE2b-256 checksum
How to use checksums
36a35f61be8ac54734e43405de1c1dfc3573c9262c06fdecc8fa696973c57fb7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 23, 2026.

Transparency log

Release files / detree_vm-0.1.2-py3-none-macosx_15_0_arm64.whl

Download URL detree_vm-0.1.2-py3-none-macosx_15_0_arm64.whl
Size 297.2 kB
Tags Python 3 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
0d5eabe3282d1aad4655ac315e172d1c713cbeb9ef0f05b996d79dc8aad50f36
BLAKE2b-256 checksum
How to use checksums
8374f0f5f4b4355c4536babbe482e835fc88b773afd4792eb82153054db119d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 23, 2026.

Transparency log

Security for detree-vm 0.1.2

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.

Full provenance

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for detree_vm-0.1.2.tar.gz

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 Nov 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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