Python implementation of a fast, compact binary wire format for modern data transport.
Project description
Twilic (Python)
Python implementation of the Twilic wire format and session-aware encoder/decoder.
This package's default encode / decode API targets Twilic v2.
What this package provides
- Dynamic encoding/decoding (
encode,decode) - Schema-aware encoding (
encode_with_schema) - Batch and micro-batch encoding (
encode_batch,SessionEncoder.encode_micro_batch) - Stateful features (base snapshots, state patch, template batch, control stream, trained dictionary)
Project layout
twilic-python/
src/twilic/ # wire, model, codec, session, protocol, v2
tests/ # spec conformance and interop tests
scripts/ # Rust interop fixtures and smoke checks
docs/
Requirements
- Python 3.12 or later
- uv for development
Install
pip install twilic
Or with uv:
uv add twilic
Quick start
import twilic
value = twilic.new_map(
twilic.entry("id", twilic.new_u64(1001)),
twilic.entry("name", twilic.new_string("alice")),
)
data = twilic.encode(value)
decoded = twilic.decode(data)
print(twilic.equal(decoded, value))
Session encoder example
import twilic
enc = twilic.new_session_encoder(twilic.default_session_options())
value = twilic.new_map(
twilic.entry("id", twilic.new_u64(1)),
twilic.entry("role", twilic.new_string("admin")),
)
enc.encode(value)
Development
Run checks locally:
uv sync
uv run ruff format --check .
uv run ruff check .
uv run pytest
Rust client interop smoke check (Python server -> Rust client):
bash scripts/check-rust-client-interop.sh
Python client interop smoke check (Rust server -> Python client):
bash scripts/check-python-client-interop.sh
Run both directions:
bash scripts/check-interop.sh
Note: interop scripts expect ../twilic-rust to exist as a sibling directory.
Markdown formatting
Documentation is formatted and linted with Prettier and markdownlint (see docs/CONTRIBUTING.md).
CI and release (GitHub Actions)
- CI workflow:
.github/workflows/ci.yml - Interop workflow:
.github/workflows/interop.yml - Release workflow:
.github/workflows/publish-pypi.yml(tagv*must matchpyproject.tomlversion)
Spec parity
This package mirrors the Twilic wire format spec at twilic/twilic and stays in lockstep with the Rust, Go, and Zig reference implementations.
See docs/SPEC-TEST-TRACEABILITY.md for the spec-section to test mapping.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file twilic-3.0.0.tar.gz.
File metadata
- Download URL: twilic-3.0.0.tar.gz
- Upload date:
- Size: 34.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6dac625277da85d752d377f26cac51ad3c52b540a2c3ae69200869955490e064
|
|
| MD5 |
fac200e69607c02decc117f03f28120b
|
|
| BLAKE2b-256 |
7c984f2378ca6cc432afa3abf385a2f2de8eac36b75167b08cfa7b650afaa70e
|
Provenance
The following attestation bundles were made for twilic-3.0.0.tar.gz:
Publisher:
publish-pypi.yml on twilic/twilic-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
twilic-3.0.0.tar.gz -
Subject digest:
6dac625277da85d752d377f26cac51ad3c52b540a2c3ae69200869955490e064 - Sigstore transparency entry: 1620309872
- Sigstore integration time:
-
Permalink:
twilic/twilic-python@c7db3271d130bcb865820686d43547931bc3ee62 -
Branch / Tag:
refs/tags/v3.0.0 - Owner: https://github.com/twilic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@c7db3271d130bcb865820686d43547931bc3ee62 -
Trigger Event:
push
-
Statement type:
File details
Details for the file twilic-3.0.0-py3-none-any.whl.
File metadata
- Download URL: twilic-3.0.0-py3-none-any.whl
- Upload date:
- Size: 39.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
834e300da1ba5496a40776479b19fb756f0154c37bd303f09fdb3bc99e0b19cd
|
|
| MD5 |
9360779a4379682b0611a804f9fbae41
|
|
| BLAKE2b-256 |
2ca078ffad7ae14cf3e5f7cee2e4d79e1ed9b7bf52caaef12f690bddf29c685c
|
Provenance
The following attestation bundles were made for twilic-3.0.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on twilic/twilic-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
twilic-3.0.0-py3-none-any.whl -
Subject digest:
834e300da1ba5496a40776479b19fb756f0154c37bd303f09fdb3bc99e0b19cd - Sigstore transparency entry: 1620310028
- Sigstore integration time:
-
Permalink:
twilic/twilic-python@c7db3271d130bcb865820686d43547931bc3ee62 -
Branch / Tag:
refs/tags/v3.0.0 - Owner: https://github.com/twilic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@c7db3271d130bcb865820686d43547931bc3ee62 -
Trigger Event:
push
-
Statement type: