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 2.0.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 triepack 2.0.0
File Size Uploaded
triepack-2.0.0.tar.gz 14.1 kB Details

Built distribution (wheel)

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

Total release size: 28.4 kB

Release files / triepack-2.0.0.tar.gz

Download URL triepack-2.0.0.tar.gz
Size 14.1 kB
Tags Source
SHA-256 checksum
How to use checksums
27be3510f65dec86595eeeb4c47f0129fcbed6f27d3f679035af77861aa07d9f
BLAKE2b-256 checksum
How to use checksums
a3cd2898cb7ddecdeb5df51158d49e09747939b9e91e1d83872cf74749d4410a
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 19, 2026.

Transparency log

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

Download URL triepack-2.0.0-py3-none-any.whl
Size 14.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
172d8f618e810fb1a7bc41f218ed10e7db4bae01d10cd202d04201ef120833b7
BLAKE2b-256 checksum
How to use checksums
ef6548b13a62f0bb8c4b9722c0e61764ed9117f3f99ea2e3ffc4cbf452d8b6f1
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 19, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.3.2

2 release files

1.3.1

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