Skip to main content

Totally Awesome Type-aware TOML Loader

Project description

TATTL: a Totally Awesome Type-aware TOML Loader

UV Badge Python Version Badge PyPI Downloads Badge License Badge

Build Status Badge Maintenance Status Badge Free Palestine Badge

TATTL is a library that deserializes arbitrary data and validates that it conforms to a type structure you define. It will either return an instance of a dataclass that you give it, or it will throw an exception indicating that the data's types don't fit. TATTL supports nesting and modern type annotations.

Source | Docs | PyPI

Installation

Install TATTL with your favourite Python package manager. We recommend uv, but pip works too.

pip install tattl
uv add tattl

Get started

TATTL will take some TOML-structured data and transform it into an instance of a dataclass while validating type annotations. As a basic example:

import tattl
import tomllib
from dataclasses import dataclass

data = """
foo = "Hello, world!"
bar = 3.14
"""

@dataclass
class Structure:
    foo: str
    bar: float

loaded_data = tattl.unpack_dict(
    tomllib.loads(data),
    Structure
)

For advanced usage and an API reference, see the documentation.

License

This work is available under the terms of the BSD 3-Clause License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tattl-0.5.0.tar.gz (38.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tattl-0.5.0-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file tattl-0.5.0.tar.gz.

File metadata

  • Download URL: tattl-0.5.0.tar.gz
  • Upload date:
  • Size: 38.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.7.3

File hashes

Hashes for tattl-0.5.0.tar.gz
Algorithm Hash digest
SHA256 137ad1ed6b57c5543fdefabf573f83458581416632d5b34bb764489ebac4892c
MD5 8610c7bcf12b3dd5ffba32caebd9c464
BLAKE2b-256 af857477afdec496d28d791ffd1da4b31551ff186eca67427f11b51aafddcfc3

See more details on using hashes here.

File details

Details for the file tattl-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: tattl-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.7.3

File hashes

Hashes for tattl-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9214ef4e89ac1f23000f7b606b17e942c4e49319a31e441355d4a9372a97a524
MD5 143715f60efd6c30b403c02a8f221bfd
BLAKE2b-256 f0a8062cae978e78e64a585783ef7a4b5a1de8e2bc7cd5517664544f3c9ed129

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page