skillfed

toons

A high-performance TOON (Token Oriented Object Notation) parser and serializer for Python, implemented in Rust.

toons v0.7.0 7.9M downloads/30d#1,684 on PyPI21
License unclear Active released

What it is and what it does

toons is a Python library that parses and serializes data in TOON format, a compact token-efficient notation designed to reduce token consumption in LLM contexts by 30-60% compared to JSON. It wraps a Rust implementation via PyO3 bindings and exposes a json-like API (loads, dumps, load, dump) so developers familiar with the standard library can adopt it with minimal friction. The package also includes conversion utilities to translate between TOON and JSON.

The library targets use cases where token count directly impacts cost or context capacity—primarily LLM applications, prompt engineering, and data serialization for AI systems. It supports standard Python types and is spec-compliant with TOON Specification v3.0. Installation is straightforward on modern platforms via prebuilt wheels, though some architectures may require a Rust compiler.

Use it for:

  • Reduce token consumption in LLM prompts and responses by serializing structured data in TOON instead of JSON.
  • Build prompt templates and few-shot examples that fit within tighter token budgets for cost-sensitive LLM APIs.
  • Convert between TOON and JSON formats in data pipelines serving both LLM and non-LLM consumers.
  • Store and transmit structured configuration or metadata in LLM-adjacent workflows where token efficiency matters.
  • Prototype or migrate existing json-based code to TOON with minimal refactoring due to the familiar API.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

toons is a Rust-backed Python parser and serializer for the TOON (Token Oriented Object Notation) format, a token-efficient data serialization designed for LLM contexts, with an API mirroring the standard json module.

Yes, with conditions. Install if you work with LLMs and need to reduce token consumption in serialized data—the token savings (30-60% vs JSON) are real and the json-like API lowers adoption friction. Verify the license (marked unclear in metadata despite Apache 2.0 in the description) before use in proprietary code. Medium install friction is acceptable for most modern Python environments, and the package is actively maintained with no known vulnerabilities.

Install

toons on PyPI

pip

pip install toons

uv

uv add toons

poetry

poetry add toons

Installing toons

Before you install

Medium install friction due to compiled Rust bindings, but wheels are available for modern Python on common platforms (cp37-abi3 and cp314 variants for x86_64, aarch64, and ARM64). Package is actively maintained with recent commits and no known vulnerabilities.

License in practice

License treatment is unclear—the description excerpt mentions Apache License 2.0, but the fact sheet records license_spdx and license_raw as null with treatment marked unclear. Verify the actual license before relying on this package in proprietary or restricted contexts.

Quickstart

pip install toons

import toons

data = toons.loads("name: Alice\nage: 30")
print(data)  # {'name': 'Alice', 'age': 30}

user = {"name": "Bob", "age": 25}
print(toons.dumps(user))

Requires Python >=3.7; binary wheels available for modern x86_64, aarch64, and ARM64 platforms, but older or less common architectures may require a Rust compiler to build from source.

Verify before relying

  • Actual license SPDX identifier and full license text (description says Apache 2.0 but metadata is null).
  • Real-world performance gains and token reduction percentages on typical LLM workloads beyond the documented 30-60% range.
  • Stability and breaking-change history across minor versions since first release in 2025-11-01.

Package facts

License not declared (unclear)
Python support supports the current Python release (>=3.7)
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance actively maintained — 85 days since the last release
Last repo commit
First released
Downloads 7,894,093/month — #1,684 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: toons-0.7.0-cp314-cp314t-macosx_10_12_x86_64.whl; toons-0.7.0-cp314-cp314t-macosx_11_0_arm64.whl; toons-0.7.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; toons-0.7.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; toons-0.7.0-cp314-cp314t-musllinux_1_2_aarch64.whl; toons-0.7.0-cp314-cp314t-musllinux_1_2_x86_64.whl; toons-0.7.0-cp314-cp314t-win_amd64.whl; toons-0.7.0-cp314-cp314t-win_arm64.whl; toons-0.7.0-cp37-abi3-macosx_10_12_x86_64.whl; toons-0.7.0-cp37-abi3-macosx_11_0_arm64.whl; toons-0.7.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; toons-0.7.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; toons-0.7.0-cp37-abi3-musllinux_1_2_aarch64.whl; toons-0.7.0-cp37-abi3-musllinux_1_2_x86_64.whl; toons-0.7.0-cp37-abi3-win_amd64.whl; toons-0.7.0-cp37-abi3-win_arm64.whl

Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyProgramming Language :: Rust

Tags

TOON format parser serializertoken efficient data serializationLLM context compressionjson alternative fewer tokensTOON to JSON converterRust Python serializationtoken oriented notation
llm-optimizationserializationrust-bindings

More Artificial Intelligence packages