Skip to main content
https://github.com/brunonicko/datta/workflows/MyPy/badge.svg https://github.com/brunonicko/datta/workflows/Lint/badge.svg https://github.com/brunonicko/datta/workflows/Tests/badge.svg https://readthedocs.org/projects/datta/badge/?version=stable https://img.shields.io/github/license/brunonicko/datta?color=light-green https://static.pepy.tech/personalized-badge/datta?period=total&units=international_system&left_color=grey&right_color=brightgreen&left_text=Downloads https://img.shields.io/pypi/pyversions/datta?color=light-green&style=flat

Overview

Immutable data structures based on estruttura.

Examples

>>> from datta import Data, attribute
>>> class Point(Data):
...     x = attribute(types=int)
...     y = attribute(types=int)
...
>>> point_a = Point(3, 4)
>>> point_a
Point(3, 4)
>>> point_b = point_a.update(x=30, y=40)
>>> point_b
Point(30, 40)
>>> from datta import Data, attribute, list_attribute
>>> from tippo import Literal
>>> class Vehicle(Data):
...     kind = attribute(types=str)
...
>>> class Garage(Data):
...     vehicles = list_attribute(types=Vehicle)
...     gate = attribute(default="automatic", types=str)  # type: Literal["automatic", "manual"]
...
>>> garage = Garage([Vehicle("bicycle"), Vehicle("car")], gate="manual")
>>> garage
Garage([Vehicle('bicycle'), Vehicle('car')], gate='manual')
>>> garage.serialize() == {"vehicles": [{"kind": "bicycle"}, {"kind": "car"}], "gate": "manual"}
True
>>> Garage.deserialize({"vehicles": [{"kind": "bicycle"}, {"kind": "car"}], "gate": "manual"}) == garage
True
>>> from datta import list_cls
>>> MyStrList = list_cls(converter=str, qualified_name="MyStrList")
>>> my_str_list = MyStrList([1, 2.2, None, True])
>>> my_str_list
MyStrList(['1', '2.2', 'None', 'True'])

Release files for datta 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for datta 1.0.1
File Size Uploaded
datta-1.0.1.tar.gz 12.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for datta 1.0.1
File Interpreter ABI Platform
datta-1.0.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 27.1 kB

Release files / datta-1.0.1.tar.gz

Download URL datta-1.0.1.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c687727cda3545857a4fc0c010c43457d9bcbf4328fe5b0988a33f9186a5917a
BLAKE2b-256 checksum
How to use checksums
964951de4f967a9e6fa98790b8234ff4fe59322efd1179524a72d32ddecad701
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release files / datta-1.0.1-py2.py3-none-any.whl

Download URL datta-1.0.1-py2.py3-none-any.whl
Size 14.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
9c10a35a3ad380ad19ce973de94bde2720bfc0abfc8a204fa7fa60a2ab256abc
BLAKE2b-256 checksum
How to use checksums
d44ab3f69bbb3e76d980350ccc7d05781cf8f07f5dd8291f760b43f5b511d6c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page