Async wrapper for toon-parser - Fast TOON format parser
Project description
toon-parser-async
Async wrapper for toon-parser - Fast TOON format parser with asyncio support.
Installation
pip install toon-parser-async
This will automatically install toon-parser as a dependency.
Quick Start
import asyncio
from toon_parser_async import encode, decode, encode_batch, decode_batch
async def main():
# Encode data
data = {"name": "Alice", "age": 30}
toon_str = await encode(data)
print(toon_str) # name:Alice|age:30
# Decode data
decoded = await decode(toon_str)
print(decoded) # {'name': 'Alice', 'age': 30}
# Batch operations
items = [{"id": i} for i in range(10)]
encoded_items = await encode_batch(items)
decoded_items = await decode_batch(encoded_items)
asyncio.run(main())
API
All functions are async and use asyncio.to_thread() to run the sync toon-parser functions in the thread pool:
async encode(data, delimiter=None, strict=None)- Encode Python data to TOON formatasync decode(toon_str, delimiter=None, strict=None)- Decode TOON format to Python dataasync dumps(data, **kwargs)- Alias for encodeasync loads(toon_str, **kwargs)- Alias for decodeasync encode_batch(data_list, **kwargs)- Encode multiple items concurrentlyasync decode_batch(toon_strs, **kwargs)- Decode multiple strings concurrently
Performance
toon-parser-async uses the high-performance toon-parser Rust library under the hood, which is 5.82x faster than other TOON implementations on average. The async wrapper adds minimal overhead while enabling concurrent I/O operations.
Credits
- Built on toon-parser by magi8101
- TOON format parser toon-rs by Jimmy Stridh
License
MIT License
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 Distributions
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 toon_parser_async-0.1.3-py3-none-any.whl.
File metadata
- Download URL: toon_parser_async-0.1.3-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32921fb6c171b9c425da03a474cc16aede9360173d4d65c5c85079fbd6d1c95e
|
|
| MD5 |
54b93878f9154445a54db40ad6475fb7
|
|
| BLAKE2b-256 |
b0117643ac423a1b23efb6a7d5353984186c69af9f66ab1f64a31b4f0ed0894d
|