A Python library for parsing and encoding Toon format files
Project description
Toonifier
Toonifier is a Python library for parsing and encoding Toon format files. It provides a simple and clean interface for working with Toon files, both from files and strings.
Features
- Parse Toon files into Python objects
- Convert Python objects back to Toon format
- Supports both file-based and string-based APIs
- Lightweight and easy to use
Installation
Install Toonifier via pip:
pip install toonifier
Usage
File-based API
The file-based API allows you to load and save Toon files directly:
import toonifier
# Load a Toon file
data = toonifier.load("example.toon")
print(data)
# Modify or inspect the data
data["age"] = 31
# Save the Python object back to a Toon file
toonifier.dump(data, "output.toon")
String-based API
The string-based API allows you to parse Toon content from strings instead of files. This is useful for dynamically generated data or when working with Toon content from the web.
import toonifier
# Toon string
text = '''name,Alice
age,30
active,true'''
# Parse Toon string into a Python object
data = toonifier.loads(text)
print(data)
# Convert Python object back to Toon string
toon_text = toonifier.dumps(data)
print(toon_text)
API Reference
File-based
toonifier.load(filename)– Load a Toon file into a Python objecttoonifier.dump(obj, filename)– Write a Python object to a Toon file
String-based
toonifier.loads(text)– Parse a Toon string into a Python objecttoonifier.dumps(obj)– Convert a Python object into Toon text
Example
import toonifier
# Load existing Toon file
data = toonifier.load("characters.toon")
# Add a new character
data["new_character"] = {"name": "Bob", "age": 25, "active": True}
# Save back to Toon file
toonifier.dump(data, "updated_characters.toon")
License
MIT License © Krishna Mishra
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 toonifier-0.1.1.tar.gz.
File metadata
- Download URL: toonifier-0.1.1.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4293134129818c640b32712744c6549e4b0b61d0776482cd7aede3f2c4647a08
|
|
| MD5 |
daf40d8188cb329e2b06cac4f7f46174
|
|
| BLAKE2b-256 |
daf614c5a8423382d2fcde7dce3f095d7a14451e0bbaedd183b0d1042ed8d752
|
File details
Details for the file toonifier-0.1.1-py3-none-any.whl.
File metadata
- Download URL: toonifier-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f209dc10093d728ac73ee135c43d0f8b25657b7b41a1f00b66d7a2b5f059e5ac
|
|
| MD5 |
f1ad829df2095d379c6b1093b3fa553f
|
|
| BLAKE2b-256 |
6048926bc015708eaf8aefdac77f293f384eb9f9e7f89a7ce544f42a27e59e1e
|