Tasty
Tasty - tab separated tables - a human-readable format for nested data serialization. The module allows to represent lists of objects with variable length in the following format:
pair triple
one 1 two 2 three two 2 three
three 3 four 4 five
six 6 seven 7 eight
Which corresponds to the following data (see examples/main.py for more details):
(
(
(
(TastyPair('one', 1), ),
(TastyTriple('two', 2, Quux('three')), TastyTriple('two', 2, Quux('three')))
),
(
(TastyPair('three', 3), ),
(TastyTriple('four', 4, Quux('five')), )
)
),
(
(
(TastyPair('six', 6), ),
(TastyTriple('seven', 7, Quux('eight')), )
),
)
)
Installation
The module doesn't require any additional dependencies. To install from pypi, run the following command:
pip install tasty
Usage
Default methods for dataset serialization and deserialization are implemented, so the module can be used as follows (see the main.py script in the examples folder):
from dataclasses import dataclass
from tasty import Corpus, CellComponent, encode, pipe
@dataclass
class TastyPair(CellComponent):
foo: str
bar: int
@property
def serialized(self):
return self._serialize(
self.foo | pipe | encode,
self.bar | pipe | str
)
@dataclass
class Quux:
value: str
@dataclass
class TastyTriple(CellComponent):
baz: str
qux: int
quux: Quux
@property
def serialized(self):
return self._serialize(
self.baz | pipe | encode,
self.qux | pipe | str,
self.quux.value | pipe | encode
)
written_corpus = Corpus(
(
(
(
(TastyPair('one', 1), ),
(TastyTriple('two', 2, Quux('three')), TastyTriple('two', 2, Quux('three')))
),
(
(TastyPair('three', 3), ),
(TastyTriple('four', 4, Quux('five')), )
)
),
(
(
(TastyPair('six', 6), ),
(TastyTriple('seven', 7, Quux('eight')), )
),
)
)
).write('corpus.txt', header = ('pair', 'triple'))
read_corpus = Corpus.read('corpus.txt', parsers = (TastyPair, TastyTriple))
assert read_corpus.data == written_corpus.data
Metadata
Release files for tastier 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tastier-0.1.0.tar.gz | 7.3 kB | Without provenance | Details for tastier-0.1.0.tar.gz |
Release files / tastier-0.1.0.tar.gz
| Download URL | tastier-0.1.0.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fa8ebbd4c165a8c3f00cec81e7d15e4a71feb86e80aa9c243991f314191bcdb0
|
|
BLAKE2b-256 checksum How to use checksums |
9fa7df15808e4d79303d05d405361577d957535e2675f6b83fadcd758d28a947
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.7
|
Security for tastier 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.