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

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.0
File Size Uploaded Provenance Actions
detree_vm-0.1.0.tar.gz 217.5 kB With provenance Details for detree_vm-0.1.0.tar.gz

Built distributions (wheels)

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

Total release size: 1.4 MB

Release files / detree_vm-0.1.0.tar.gz

Download URL detree_vm-0.1.0.tar.gz
Size 217.5 kB
Tags Source
SHA-256 checksum
How to use checksums
22d5afc31c7ae5cb392c8f271509ad5fda32078319ff61694a90a4aec65d1ec6
BLAKE2b-256 checksum
How to use checksums
681080136f05cc2fa4b01c2d906c292c2dbd59098f04443a823d6046d696d4f3
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 8, 2026.

Transparency log

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

Download URL detree_vm-0.1.0-py3-none-win_amd64.whl
Size 205.7 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
378ad90a3c9b4b06bfc93f6898c2f14cfcc257abf720d4823e7ed446d4b83d46
BLAKE2b-256 checksum
How to use checksums
3c9c1eb4b5d49ebad6a260da2e84cc0f89f03ee6a9a373ca1662dd5dac50f7fe
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 8, 2026.

Transparency log

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

Download URL detree_vm-0.1.0-py3-none-manylinux_2_28_x86_64.whl
Size 330.7 kB
Tags Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
a4027e4da98850449dd3f88516832a392a1f362d1cc80aa2b61fc229b93c566a
BLAKE2b-256 checksum
How to use checksums
141d875b99957c7e0435eca1c8d459be3ae5166e8e38380de567376ad59414fb
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 8, 2026.

Transparency log

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

Download URL detree_vm-0.1.0-py3-none-manylinux_2_28_aarch64.whl
Size 322.9 kB
Tags Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
e46d720da15c31c1f45b5f9c7a222f9783c929ea607c13c18069f0699b28e828
BLAKE2b-256 checksum
How to use checksums
23a3df7a9ea1c191a78b345a4f6aa14c391fb837a0895b1af38d4f3bbbe973ed
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 8, 2026.

Transparency log

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

Download URL detree_vm-0.1.0-py3-none-macosx_15_0_arm64.whl
Size 292.7 kB
Tags Python 3 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
a94967dbd0131f2753bb319a1775188fbeddf0c633c2a697e5a8f619215c12a1
BLAKE2b-256 checksum
How to use checksums
dc4d8610714108ae166626462c331a9cb36a27aa99d693c991ede419a7c3e5fd
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 8, 2026.

Transparency log

Security for detree-vm 0.1.0

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.0.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 8, 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

5 release files Full provenance

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