DevPossible.Ton - Python Library
Developed by DevPossible, LLC Contact: support@devpossible.com
Python implementation of the TON (Text Object Notation) parser, serializer, formatter, and validator.
Installation
pip install devpossible-ton
Quick Start
import devpossible_ton as ton
# Parse TON data
document = ton.parse("""
{
name: "My App"
version: "1.0.0"
}
""")
# Access data
root = document.get_root()
print(root.get('name')) # "My App"
# Serialize back to TON
serialized = ton.serialize(document)
print(serialized)
# Format TON files
from devpossible_ton import TonFormatter
formatted = TonFormatter.pretty(ton_text)
Features
- ✅ Full TON specification parser with async support
- ✅ Comprehensive schema validation with 30+ validation rule types
- ✅ Code formatter with compact and pretty styles
- ✅ Type annotations and hints
- ✅ Enum and EnumSet support
- ✅ Array support with mixed types
- ✅ Pretty and compact serialization
- ✅ Async file operations
- ✅ Schema collections and definitions
Advanced Usage
Schema Validation
from devpossible_ton import (
TonSchemaDefinition,
TonPropertySchema,
ValidationRuleType,
TonValidationRule
)
# Create a schema
schema = TonSchemaDefinition('User')
name_prop = TonPropertySchema('name', 'string')
name_prop.add_validation(TonValidationRule(ValidationRuleType.REQUIRED))
name_prop.add_validation(TonValidationRule(ValidationRuleType.MIN_LENGTH, 3))
schema.add_property('name', name_prop)
Formatting
from devpossible_ton import TonFormatter, TonFormatStyle
# Format with different styles
compact = TonFormatter.compact(ton_text)
pretty = TonFormatter.pretty(ton_text)
sorted_output = TonFormatter.sorted(ton_text)
# Async formatting
import asyncio
formatted = await TonFormatter.format_file_async('input.ton', TonFormatStyle.PRETTY)
Serialization Options
from devpossible_ton import TonSerializeOptions, TonFormatStyle
# Use presets
options = TonSerializeOptions.compact()
options = TonSerializeOptions.pretty()
options = TonSerializeOptions.optimized()
# Custom options
options = TonSerializeOptions(
format_style=TonFormatStyle.PRETTY,
indent_size=2,
sort_properties=True,
include_header=True
)
License
MIT License - Copyright © 2024 DevPossible, LLC
Support
DevPossible, LLC Email: support@devpossible.com
© 2024 DevPossible, LLC. All rights reserved.
Metadata
Release files for devpossible-ton 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| devpossible_ton-0.1.3.tar.gz | 30.5 kB | Without provenance | Details for devpossible_ton-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| devpossible_ton-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for devpossible_ton-0.1.3-py3-none-any.whl |
Total release size: 57.7 kB
Release files / devpossible_ton-0.1.3.tar.gz
| Download URL | devpossible_ton-0.1.3.tar.gz |
|---|---|
| Size | 30.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
763485c9f441426cc1604de9e0a2b4ffd2aa7f8fec8a37f922205e59d932d749
|
|
BLAKE2b-256 checksum How to use checksums |
c8f038af4f4fc48b8efd1d9bafc3317b4b4a5811e17fc4ff82edecd735552f3c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.13
|
Release files / devpossible_ton-0.1.3-py3-none-any.whl
| Download URL | devpossible_ton-0.1.3-py3-none-any.whl |
|---|---|
| Size | 27.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
04515128580566786d03babb0271943b5c8ce1d5ade2ed7cfa829f78227ee386
|
|
BLAKE2b-256 checksum How to use checksums |
ad8036ea6f0414205cd2b8dbf15112c76c6eb2f9120c3f59a79087e653d9e3a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.13
|
Security for devpossible-ton 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.