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

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.1
File Size Uploaded Provenance Actions
detree_vm-0.1.1.tar.gz 222.2 kB With provenance Details for detree_vm-0.1.1.tar.gz

Built distributions (wheels)

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

Total release size: 1.4 MB

Release files / detree_vm-0.1.1.tar.gz

Download URL detree_vm-0.1.1.tar.gz
Size 222.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0cdd127d6cff2bf7723ff4f3ab161e04b33789f45e775ab86bbfac1a5c147200
BLAKE2b-256 checksum
How to use checksums
54664e53b278e1bfdaa297a4bde303abe2787591e6a240f540400e882c5cf67d
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 10, 2026.

Transparency log

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

Download URL detree_vm-0.1.1-py3-none-win_amd64.whl
Size 207.7 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
390427ab668d4b6109e0599236e58bdc5357cf541e0f294de06edb6e80b02a08
BLAKE2b-256 checksum
How to use checksums
f24be3aa2876ceafe43aaa8f91934f18ce9e6dda8b4650e52759cc8f26fa6f36
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 10, 2026.

Transparency log

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

Download URL detree_vm-0.1.1-py3-none-manylinux_2_28_x86_64.whl
Size 332.3 kB
Tags Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
69a8d0d3edabf9c221b92afe97633860488d5bd388a34e3447b1c76995efc6d5
BLAKE2b-256 checksum
How to use checksums
179b03de81c4c3dda33ee48e64b701ce999b731d0dd10cf839aa8a895f98962d
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 10, 2026.

Transparency log

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

Download URL detree_vm-0.1.1-py3-none-manylinux_2_28_aarch64.whl
Size 324.4 kB
Tags Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
fbcf371bbb789ae6faa5681d3ed769758ea2917ec46f3c01073d2dbf9c1b9521
BLAKE2b-256 checksum
How to use checksums
bc70765515eaf3752de3de75d511cd3c70f478287b146cdb1235de503dedb2ad
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 10, 2026.

Transparency log

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

Download URL detree_vm-0.1.1-py3-none-macosx_15_0_arm64.whl
Size 294.3 kB
Tags Python 3 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
69c9f349a0cf823e5043b0d095c763b22223b708b18c0d30ce81511f69bf8057
BLAKE2b-256 checksum
How to use checksums
63af23ad5ee90756e745a2d816bbeec615cc21a79faee728152a65cde377fb30
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 10, 2026.

Transparency log

Security for detree-vm 0.1.1

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.1.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 10, 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