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.4.0.tar.gz (38.8 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.4.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tattl-0.4.0.tar.gz
Algorithm Hash digest
SHA256 714e4eee10221b73fc866a32783cbfe9b21cb428a7282d963d11908774c5513c
MD5 04d531d013a97e61b9fd949216516401
BLAKE2b-256 2c8c65d5a94b9fa5e9043ba985ac742f36298a49d1a28e1bfd5cea7da20c52e7

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tattl-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b29fbc28308f6e16300f95bf463b45b5fe156702992c41b6bee7e8c2d2e67a3d
MD5 5fa8a6a8454712886b73dcb7dae1d4f2
BLAKE2b-256 29e56009f2f59f80b25d8b1d41227e578ca52cbfd1905371cc9b30a315e50cf7

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