Skip to main content

triepack

Compressed trie dictionary format (.trp) — compact binary key-value storage with fast lookups and prefix search.

This is the native Python implementation: pure Python, no dependencies, no C extension to build. It reads and writes the same bytes as the C reference library and the JavaScript, Go, Rust, Swift, Java and Kotlin implementations.

Install

pip install triepack

Use

from triepack import encode, decode

buf = encode({"hello": 42, "world": "foo"})
# buf is bytes holding the .trp binary

result = decode(buf)
print(result)  # {'hello': 42, 'world': 'foo'}

Values

Python .trp type
None null
bool bool
int >= 0 uint
int < 0 int
float float64
str string (UTF-8)
bytes blob

Decoding also accepts float32 values written by other implementations, widening them to a Python float. Python integers are arbitrary precision, so the full 64-bit signed and unsigned ranges round-trip exactly.

Format

Every buffer carries a 32-byte header, a bit-packed prefix trie, a typed value store and a CRC-32. Keys are stored once per shared prefix, and symbols are packed at the minimum width the key alphabet needs.

The encoder is deterministic: the same input produces the same bytes in every implementation, which is checked by a shared conformance suite that all nine implementations run.

Development

cd bindings/python
pip install -e ".[test]"
python -m pytest

License

Copyright (c) 2026 M. A. Chatterjee. BSD-2-Clause — see LICENSE.txt.

Release files for triepack 1.3.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 triepack 1.3.1
File Size Uploaded
triepack-1.3.1.tar.gz 13.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for triepack 1.3.1
File Interpreter ABI Platform
triepack-1.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 28.0 kB

Release files / triepack-1.3.1.tar.gz

Download URL triepack-1.3.1.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2d8a7d30e39480aff416f9b784da7027b94792e5f525668c1aa78053b78567a3
BLAKE2b-256 checksum
How to use checksums
f5b9a41ea847bd375eec0d84c767060becf5687e18b618e683a03874cfc43cb1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 16, 2026.

Transparency log

Release files / triepack-1.3.1-py3-none-any.whl

Download URL triepack-1.3.1-py3-none-any.whl
Size 14.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
94fbc257e884e2278aa8d53cb220ce083c5ef321a2757d2a6fa114cbe90a3cfc
BLAKE2b-256 checksum
How to use checksums
69e4c71073973ec0d36d91c0b67ed8cdc322150cb9071c13ddbbc35b1cf3b19f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 16, 2026.

Transparency log

Release history Release notifications | RSS feed

2.0.0

2 release files

1.3.2

2 release files

This release

1.3.1 This release

2 release files

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