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

Uploaded Python 3

File details

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

File metadata

  • Download URL: tattl-0.4.0.post1.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.0.post1.tar.gz
Algorithm Hash digest
SHA256 3c21626c834f88bdad7f8d4876701b576cde819e4ae8b7608430b2b8024093d5
MD5 ada88e2393302d204fcdda1a8493fc76
BLAKE2b-256 190cbbe6c15ac74e522b045523181ff90a6514de04e1f215b91dec07a2e0342a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tattl-0.4.0.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 fa1dc28d24eb0c8ad0ac18d3fcc909369ddb732f8200221d2d7a83de80a162d3
MD5 50adfb1a3192a22e5f53211eebefa286
BLAKE2b-256 23c00d6cc64ecf4715e9e12b100de3cccb072e831d01f49841017ae114cabae0

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