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.1.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.4.1-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tattl-0.4.1.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.4.1.tar.gz
Algorithm Hash digest
SHA256 7a61ce9d0d910860b883ac5daef428a7df0b690ada5deee626aa4334ccfacb1c
MD5 ccad5078bb1d0f89039c7e211a65cbbe
BLAKE2b-256 499a4cf885f1c0d6d9320f497f9a45b697b679a43c0e22f5a8792e652a3131b6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tattl-0.4.1-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.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 545218b856d9c8355e352c4b05207929355f00c6a0d60c2c8bc37902f462e684
MD5 3f616271fd3bd8900d655e4130bc41d4
BLAKE2b-256 fedf99d888eebbc4bdcacaf23a0d5b5674405112337da9bb63262f43a870404f

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