Skip to main content

pixie-py

Pixie’s Python bindings store ordered trees in compact bit encodings and provide navigation by node ID. For efficient traversal, a context can reuse decoded tree parts across queries, and multiple contexts can share an index for repeated descents from the root. The bindings also support range-minimum queries. Pixie core

Install

Install with python -m pip install pixie-py on Python 3.10 or later. Linux x86-64 wheels select AVX-512, x86-64-v3, AVX2, or SSE2 once on import, according to the CPU features available to the process.

Building from source requires Python development headers, a C++20 compiler, and Git. The build downloads the Pixie core tag matching the package version.

Install from this repository into your chosen Python environment:

python -m pip install .

You can also use this directory as a local dependency with your package manager.

Tree manual

Working with trees uses a 24-node tree to explore navigation, traversal, encoding conversion, and visualization in Jupyter. Its archive example saves a complete binary tree with 1,048,575 nodes in a 309,688-byte BP file (2.36 bits per node, including navigation indexes and file metadata). Using native node IDs lets you traverse that file directly. Preserving the example’s original IDs adds a separate 2,621,472-byte permutation file.

Example

from pixie import BPTree

tree = BPTree("(()())")
print(tree)
print([node.id for node in tree.children(tree.root)])

louds = tree.to_louds()

Output:

(()())
[1, 2]

BPTree, DFUDSTree, and LoudsTree accept their native encoding or another tree. Use from_bp(text) to read balanced parentheses into any tree type. PointerTree supports construction with add_node(parent_id) before conversion to a succinct tree. Node IDs and child indices start at zero.

For visualization, install the visualization extra and Graphviz, then call tree.visualize(). For a text diagram, use print(tree.parentheses(verbose=True)).

See the examples for encodings, navigation, traversal contexts, and RMQ. RMQ supports the CLI's artifact format; source values must be kept separately. Use help(BPTree) or help(RMQ) for API details.

Development

To develop against a local Pixie checkout, set a shell override. No repository configuration needs to change:

export PIXIE_SOURCE_DIR=/path/to/pixie

Install the test dependencies with python -m pip install ".[test]". After changing bindings or C++ headers, rebuild and test:

python -m pip install --force-reinstall --no-deps ".[test]"
python -m pytest
python examples/louds.py

To return to the GitHub pin, run unset PIXIE_SOURCE_DIR and rebuild.

License

Apache-2.0, matching Pixie core.

Trees with integer node IDs

from pixie import Tree, Permutation

tree, mapping = Tree.from_json({"parents": [3, 3, 0]}, to="fc")
tree.save("nodes.px")
mapping.save("nodes.perm.px")
loaded = Tree.load("nodes.px", permutation=Permutation.load("nodes.perm.px"))
assert loaded.path(2, 1) == [2, 0, 3, 1]

Pass a decoded JSON object containing exactly one of children (ordered child rows), parents (parent of node i, with the last node as root), or edges (ordered parent-child pairs). The empty children list represents an empty tree. Empty parents or edges lists represent a singleton.

Tree.convert("bp" | "dfuds" | "louds" | "fc") returns a native-numbered tree and its destination-to-source permutation. Use mapping[d] to reorder source data or mapping.inverse(s) to locate a source ID. Both tree and permutation loaders accept load_mode="mmap" (default) or "ram". Mapped tree views retain the mapping. ForestCover and permutations restore owned storage. These binary artifacts are interchangeable with pixie tree in the CLI.

In Jupyter, a cell ending in loaded displays one tree level per line. Use loaded.visualize(max_nodes=50) to render it with Graphviz. str(loaded) and print(loaded) show the encoding, node count, and root. Use print(loaded.to_text()) for the diagram in a terminal, loaded.to_text(root=0, max_nodes=20) for a subtree diagram or loaded.to_dot(max_nodes=20) for Graphviz DOT. Both default to 50 nodes and use the IDs exposed by the loaded tree.

For repeated navigation, create a context from the loaded tree:

ctx = loaded.traversal_context(cache_bytes=64 * 1024)
children = ctx.children(ctx.root)
part = ctx.scan(ctx.root)

A context retains the tree and its ID mapping. Each context owns its cache. scan(node) inspects a bounded part independently of the cache. For BP and DFUDS it returns None if the subtree exceeds the decoder window. ForestCover returns the enclosing forest unit, and LOUDS returns a bounded subtree prefix. fetch(node) returns whether the context retained the part. Navigation always answers from the complete tree, including across part boundaries. With cache_bytes=0 the context navigates without retaining decoded parts.

Use index = loaded.root_navigation_index(budget_bytes=32768) to build a root prefix once, then pass root_index=index to each context that should share it. The index and context cache have separate budgets.

Metadata

Release files for pixie-py 1.2.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 pixie-py 1.2.0
File Size Uploaded Provenance Actions
pixie_py-1.2.0.tar.gz 71.3 kB With provenance Details for pixie_py-1.2.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pixie-py 1.2.0
File Actions
pixie_py-1.2.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for pixie_py-1.2.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
pixie_py-1.2.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for pixie_py-1.2.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
pixie_py-1.2.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for pixie_py-1.2.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
pixie_py-1.2.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for pixie_py-1.2.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
pixie_py-1.2.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for pixie_py-1.2.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Total release size: 10.9 MB

Release files / pixie_py-1.2.0.tar.gz

Download URL pixie_py-1.2.0.tar.gz
Size 71.3 kB
Tags Source
SHA-256 checksum
How to use checksums
92fba99b3106bd38ff727a3c41cb0f3141a3cb98e5e517d9d87484ef98b7b532
BLAKE2b-256 checksum
How to use checksums
d3c5309f607800ed63f7ca1742214b7412255f1f857f313448d40029a49cad02
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 30, 2026.

Transparency log

Release files / pixie_py-1.2.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL pixie_py-1.2.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 2.2 MB
Tags CPython 3.14 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
22049cb4e1bb62c0cb91df61e0b733dacb8c01db61d76bc3db53c72c5adc248b
BLAKE2b-256 checksum
How to use checksums
1c38446f0bde5b9f3848a23b7f1ea5b7c85144390bd07968cb7adb54ea75051d
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 30, 2026.

Transparency log

Release files / pixie_py-1.2.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL pixie_py-1.2.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 2.2 MB
Tags CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
c2fa3bc168a62c4335bbb1544dababe96db84db2303fdffa6f26ace16cb2e7b0
BLAKE2b-256 checksum
How to use checksums
3ead8318517671f9752ffbdf09e6093b72012f627fae0fe5e088635ffff92cf7
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 30, 2026.

Transparency log

Release files / pixie_py-1.2.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL pixie_py-1.2.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 2.2 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
8d3c9d3ec5fc2431d6fe7d8806d2a80af9af734f4f736dc0b85ca4c72d48e38c
BLAKE2b-256 checksum
How to use checksums
88554e77da68e73dcc0835352d51a13c3bdf6ecb29d63900888d35d519191ff7
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 30, 2026.

Transparency log

Release files / pixie_py-1.2.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL pixie_py-1.2.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 2.2 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
c0c30807eded0fbd6f24d885f2b87eee9f1c6c369579186d53034803f9339740
BLAKE2b-256 checksum
How to use checksums
823d1960a670fe75fc0574cd340bf74b30243b13a9180ab92b0f422e4a9dff40
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 30, 2026.

Transparency log

Release files / pixie_py-1.2.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL pixie_py-1.2.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 2.2 MB
Tags CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
82245c88a2330ce63b5541f55dae9dba254349f39204c74edb7eefa747d22c4d
BLAKE2b-256 checksum
How to use checksums
a8116e52510bc50c41eb4e87b5c64e321dcf2053b3f548e14d3fdc26f91523ef
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 30, 2026.

Transparency log

Security for pixie-py 1.2.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 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for pixie_py-1.2.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 30, 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