-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy path__init__.py
More file actions
40 lines (35 loc) · 1.09 KB
/
__init__.py
File metadata and controls
40 lines (35 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Copyright (c) 2025 TOON Format Organization
# SPDX-License-Identifier: MIT
"""TOON Format for Python.
Token-Oriented Object Notation (TOON) is a compact, human-readable serialization
format optimized for LLM contexts. Achieves 30-60% token reduction vs JSON while
maintaining readability and structure.
This package provides encoding and decoding functionality with 100% compatibility
with the official TOON specification (v1.3).
Example:
>>> from toon_format import encode, decode
>>> data = {"name": "Alice", "age": 30}
>>> toon = encode(data)
>>> print(toon)
name: Alice
age: 30
>>> decode(toon)
{'name': 'Alice', 'age': 30}
"""
from .decoder import ToonDecodeError, decode
from .encoder import encode
from .types import DecodeOptions, Delimiter, DelimiterKey, EncodeOptions
from .utils import compare_formats, count_tokens, estimate_savings
__version__ = "0.9.1"
__all__ = [
"encode",
"decode",
"ToonDecodeError",
"Delimiter",
"DelimiterKey",
"EncodeOptions",
"DecodeOptions",
"count_tokens",
"estimate_savings",
"compare_formats",
]