twilic 3.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- twilic-3.0.0/.gitignore +26 -0
- twilic-3.0.0/LICENSE +21 -0
- twilic-3.0.0/PKG-INFO +143 -0
- twilic-3.0.0/README.md +121 -0
- twilic-3.0.0/pyproject.toml +57 -0
- twilic-3.0.0/src/twilic/__init__.py +355 -0
- twilic-3.0.0/src/twilic/_version.py +1 -0
- twilic-3.0.0/src/twilic/codec.py +682 -0
- twilic-3.0.0/src/twilic/dictionary.py +236 -0
- twilic-3.0.0/src/twilic/errors.py +92 -0
- twilic-3.0.0/src/twilic/model.py +784 -0
- twilic-3.0.0/src/twilic/protocol.py +2304 -0
- twilic-3.0.0/src/twilic/py.typed +0 -0
- twilic-3.0.0/src/twilic/session.py +237 -0
- twilic-3.0.0/src/twilic/v2.py +466 -0
- twilic-3.0.0/src/twilic/wire.py +139 -0
twilic-3.0.0/.gitignore
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Python / uv
|
|
2
|
+
.venv/
|
|
3
|
+
__pycache__/
|
|
4
|
+
*.py[cod]
|
|
5
|
+
*$py.class
|
|
6
|
+
*.egg-info/
|
|
7
|
+
.pytest_cache/
|
|
8
|
+
.ruff_cache/
|
|
9
|
+
.mypy_cache/
|
|
10
|
+
.coverage
|
|
11
|
+
.coverage.*
|
|
12
|
+
htmlcov/
|
|
13
|
+
dist/
|
|
14
|
+
build/
|
|
15
|
+
*.so
|
|
16
|
+
*.whl
|
|
17
|
+
|
|
18
|
+
# Node (markdown tooling)
|
|
19
|
+
node_modules/
|
|
20
|
+
|
|
21
|
+
# Rust interop scripts
|
|
22
|
+
/scripts/rust-client-check/target/
|
|
23
|
+
/scripts/rust-server-fixtures/target/
|
|
24
|
+
|
|
25
|
+
# OS
|
|
26
|
+
.DS_Store
|
twilic-3.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Twilic (maintained by Minagishl)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
twilic-3.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: twilic
|
|
3
|
+
Version: 3.0.0
|
|
4
|
+
Summary: Python implementation of a fast, compact binary wire format for modern data transport.
|
|
5
|
+
Project-URL: Homepage, https://github.com/twilic/twilic-python
|
|
6
|
+
Project-URL: Repository, https://github.com/twilic/twilic-python
|
|
7
|
+
Project-URL: Issues, https://github.com/twilic/twilic-python/issues
|
|
8
|
+
Author-email: Twilic <maintained-by-minagishl@users.noreply.github.com>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: binary,serialization,twilic,wire-format
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Python: >=3.12
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# Twilic (Python)
|
|
24
|
+
|
|
25
|
+
Python implementation of the Twilic wire format and session-aware encoder/decoder.
|
|
26
|
+
|
|
27
|
+
This package's default `encode` / `decode` API targets Twilic v2.
|
|
28
|
+
|
|
29
|
+
## What this package provides
|
|
30
|
+
|
|
31
|
+
- Dynamic encoding/decoding (`encode`, `decode`)
|
|
32
|
+
- Schema-aware encoding (`encode_with_schema`)
|
|
33
|
+
- Batch and micro-batch encoding (`encode_batch`, `SessionEncoder.encode_micro_batch`)
|
|
34
|
+
- Stateful features (base snapshots, state patch, template batch, control stream, trained dictionary)
|
|
35
|
+
|
|
36
|
+
## Project layout
|
|
37
|
+
|
|
38
|
+
```text
|
|
39
|
+
twilic-python/
|
|
40
|
+
src/twilic/ # wire, model, codec, session, protocol, v2
|
|
41
|
+
tests/ # spec conformance and interop tests
|
|
42
|
+
scripts/ # Rust interop fixtures and smoke checks
|
|
43
|
+
docs/
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Requirements
|
|
47
|
+
|
|
48
|
+
- Python 3.12 or later
|
|
49
|
+
- [uv](https://docs.astral.sh/uv/) for development
|
|
50
|
+
|
|
51
|
+
## Install
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install twilic
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Or with uv:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
uv add twilic
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Quick start
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
import twilic
|
|
67
|
+
|
|
68
|
+
value = twilic.new_map(
|
|
69
|
+
twilic.entry("id", twilic.new_u64(1001)),
|
|
70
|
+
twilic.entry("name", twilic.new_string("alice")),
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
data = twilic.encode(value)
|
|
74
|
+
decoded = twilic.decode(data)
|
|
75
|
+
|
|
76
|
+
print(twilic.equal(decoded, value))
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Session encoder example
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
import twilic
|
|
83
|
+
|
|
84
|
+
enc = twilic.new_session_encoder(twilic.default_session_options())
|
|
85
|
+
|
|
86
|
+
value = twilic.new_map(
|
|
87
|
+
twilic.entry("id", twilic.new_u64(1)),
|
|
88
|
+
twilic.entry("role", twilic.new_string("admin")),
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
enc.encode(value)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Development
|
|
95
|
+
|
|
96
|
+
Run checks locally:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
uv sync
|
|
100
|
+
uv run ruff format --check .
|
|
101
|
+
uv run ruff check .
|
|
102
|
+
uv run pytest
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Rust client interop smoke check (Python server -> Rust client):
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
bash scripts/check-rust-client-interop.sh
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Python client interop smoke check (Rust server -> Python client):
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
bash scripts/check-python-client-interop.sh
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Run both directions:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
bash scripts/check-interop.sh
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Note: interop scripts expect `../twilic-rust` to exist as a sibling directory.
|
|
124
|
+
|
|
125
|
+
## Markdown formatting
|
|
126
|
+
|
|
127
|
+
Documentation is formatted and linted with Prettier and markdownlint (see [`docs/CONTRIBUTING.md`](docs/CONTRIBUTING.md)).
|
|
128
|
+
|
|
129
|
+
## CI and release (GitHub Actions)
|
|
130
|
+
|
|
131
|
+
- CI workflow: `.github/workflows/ci.yml`
|
|
132
|
+
- Interop workflow: `.github/workflows/interop.yml`
|
|
133
|
+
- Release workflow: `.github/workflows/publish-pypi.yml` (tag `v*` must match `pyproject.toml` version)
|
|
134
|
+
|
|
135
|
+
## Spec parity
|
|
136
|
+
|
|
137
|
+
This package mirrors the Twilic wire format spec at [twilic/twilic](https://github.com/twilic/twilic) and stays in lockstep with the [Rust](https://github.com/twilic/twilic-rust), [Go](https://github.com/twilic/twilic-go), and [Zig](https://github.com/twilic/twilic-zig) reference implementations.
|
|
138
|
+
|
|
139
|
+
See [`docs/SPEC-TEST-TRACEABILITY.md`](docs/SPEC-TEST-TRACEABILITY.md) for the spec-section to test mapping.
|
|
140
|
+
|
|
141
|
+
## License
|
|
142
|
+
|
|
143
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
twilic-3.0.0/README.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# Twilic (Python)
|
|
2
|
+
|
|
3
|
+
Python implementation of the Twilic wire format and session-aware encoder/decoder.
|
|
4
|
+
|
|
5
|
+
This package's default `encode` / `decode` API targets Twilic v2.
|
|
6
|
+
|
|
7
|
+
## What this package provides
|
|
8
|
+
|
|
9
|
+
- Dynamic encoding/decoding (`encode`, `decode`)
|
|
10
|
+
- Schema-aware encoding (`encode_with_schema`)
|
|
11
|
+
- Batch and micro-batch encoding (`encode_batch`, `SessionEncoder.encode_micro_batch`)
|
|
12
|
+
- Stateful features (base snapshots, state patch, template batch, control stream, trained dictionary)
|
|
13
|
+
|
|
14
|
+
## Project layout
|
|
15
|
+
|
|
16
|
+
```text
|
|
17
|
+
twilic-python/
|
|
18
|
+
src/twilic/ # wire, model, codec, session, protocol, v2
|
|
19
|
+
tests/ # spec conformance and interop tests
|
|
20
|
+
scripts/ # Rust interop fixtures and smoke checks
|
|
21
|
+
docs/
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Requirements
|
|
25
|
+
|
|
26
|
+
- Python 3.12 or later
|
|
27
|
+
- [uv](https://docs.astral.sh/uv/) for development
|
|
28
|
+
|
|
29
|
+
## Install
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install twilic
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Or with uv:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
uv add twilic
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Quick start
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
import twilic
|
|
45
|
+
|
|
46
|
+
value = twilic.new_map(
|
|
47
|
+
twilic.entry("id", twilic.new_u64(1001)),
|
|
48
|
+
twilic.entry("name", twilic.new_string("alice")),
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
data = twilic.encode(value)
|
|
52
|
+
decoded = twilic.decode(data)
|
|
53
|
+
|
|
54
|
+
print(twilic.equal(decoded, value))
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Session encoder example
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
import twilic
|
|
61
|
+
|
|
62
|
+
enc = twilic.new_session_encoder(twilic.default_session_options())
|
|
63
|
+
|
|
64
|
+
value = twilic.new_map(
|
|
65
|
+
twilic.entry("id", twilic.new_u64(1)),
|
|
66
|
+
twilic.entry("role", twilic.new_string("admin")),
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
enc.encode(value)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Development
|
|
73
|
+
|
|
74
|
+
Run checks locally:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
uv sync
|
|
78
|
+
uv run ruff format --check .
|
|
79
|
+
uv run ruff check .
|
|
80
|
+
uv run pytest
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Rust client interop smoke check (Python server -> Rust client):
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
bash scripts/check-rust-client-interop.sh
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Python client interop smoke check (Rust server -> Python client):
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
bash scripts/check-python-client-interop.sh
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Run both directions:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
bash scripts/check-interop.sh
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Note: interop scripts expect `../twilic-rust` to exist as a sibling directory.
|
|
102
|
+
|
|
103
|
+
## Markdown formatting
|
|
104
|
+
|
|
105
|
+
Documentation is formatted and linted with Prettier and markdownlint (see [`docs/CONTRIBUTING.md`](docs/CONTRIBUTING.md)).
|
|
106
|
+
|
|
107
|
+
## CI and release (GitHub Actions)
|
|
108
|
+
|
|
109
|
+
- CI workflow: `.github/workflows/ci.yml`
|
|
110
|
+
- Interop workflow: `.github/workflows/interop.yml`
|
|
111
|
+
- Release workflow: `.github/workflows/publish-pypi.yml` (tag `v*` must match `pyproject.toml` version)
|
|
112
|
+
|
|
113
|
+
## Spec parity
|
|
114
|
+
|
|
115
|
+
This package mirrors the Twilic wire format spec at [twilic/twilic](https://github.com/twilic/twilic) and stays in lockstep with the [Rust](https://github.com/twilic/twilic-rust), [Go](https://github.com/twilic/twilic-go), and [Zig](https://github.com/twilic/twilic-zig) reference implementations.
|
|
116
|
+
|
|
117
|
+
See [`docs/SPEC-TEST-TRACEABILITY.md`](docs/SPEC-TEST-TRACEABILITY.md) for the spec-section to test mapping.
|
|
118
|
+
|
|
119
|
+
## License
|
|
120
|
+
|
|
121
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "twilic"
|
|
3
|
+
version = "3.0.0"
|
|
4
|
+
description = "Python implementation of a fast, compact binary wire format for modern data transport."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
requires-python = ">=3.12"
|
|
8
|
+
authors = [{ name = "Twilic", email = "maintained-by-minagishl@users.noreply.github.com" }]
|
|
9
|
+
keywords = ["twilic", "serialization", "binary", "wire-format"]
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Development Status :: 4 - Beta",
|
|
12
|
+
"Intended Audience :: Developers",
|
|
13
|
+
"License :: OSI Approved :: MIT License",
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"Programming Language :: Python :: 3.12",
|
|
16
|
+
"Programming Language :: Python :: 3.13",
|
|
17
|
+
"Topic :: Software Development :: Libraries",
|
|
18
|
+
"Typing :: Typed",
|
|
19
|
+
]
|
|
20
|
+
dependencies = []
|
|
21
|
+
|
|
22
|
+
[project.urls]
|
|
23
|
+
Homepage = "https://github.com/twilic/twilic-python"
|
|
24
|
+
Repository = "https://github.com/twilic/twilic-python"
|
|
25
|
+
Issues = "https://github.com/twilic/twilic-python/issues"
|
|
26
|
+
|
|
27
|
+
[build-system]
|
|
28
|
+
requires = ["hatchling"]
|
|
29
|
+
build-backend = "hatchling.build"
|
|
30
|
+
|
|
31
|
+
[tool.hatch.build.targets.wheel]
|
|
32
|
+
packages = ["src/twilic"]
|
|
33
|
+
|
|
34
|
+
[tool.hatch.build.targets.sdist]
|
|
35
|
+
include = ["src/twilic", "LICENSE", "README.md"]
|
|
36
|
+
|
|
37
|
+
[dependency-groups]
|
|
38
|
+
dev = ["pytest>=8.0", "ruff>=0.9"]
|
|
39
|
+
|
|
40
|
+
[tool.pytest.ini_options]
|
|
41
|
+
testpaths = ["tests"]
|
|
42
|
+
pythonpath = ["src"]
|
|
43
|
+
|
|
44
|
+
[tool.ruff]
|
|
45
|
+
line-length = 100
|
|
46
|
+
target-version = "py312"
|
|
47
|
+
src = ["src", "tests"]
|
|
48
|
+
|
|
49
|
+
[tool.ruff.lint]
|
|
50
|
+
select = ["E", "F", "I", "UP", "B", "SIM"]
|
|
51
|
+
|
|
52
|
+
[tool.ruff.lint.per-file-ignores]
|
|
53
|
+
"tests/**" = ["E501"]
|
|
54
|
+
"scripts/**" = ["E402"]
|
|
55
|
+
|
|
56
|
+
[tool.ruff.format]
|
|
57
|
+
quote-style = "double"
|