matiz
Python's 3.7 dataclasses got maried with pyyaml.
Installation:
pip install matiz
Usage example:
import dataclasses
import matiz
from matiz import fields
@dataclasses.dataclass
class Some(matiz.ObsoleteAble):
id: int = fields.Integer()
mac: str = fields.MacAddress()
ip: str = fields.IPv4()
version: int = fields.Integer(default=411)
Now the Some object can be created as a pure python object (thanks to dataclass)
it is equipped with __init__, __repr__, __eq__ and some other methods.
>>> obj = Some(123, 'aa:bb:cc:11:22:33', '192.168.11.6')
>>> obj
Some(id=123, mac='aa:bb:cc:11:22:33', ip='192.168.11.6', version=411)
>>> print(obj)
!iz/Some
id: 123
ip: 192.168.11.6
mac: aa:bb:cc:11:22:33
version: 411
It's attributes are regular python attributes:
>>> obj.id
123
>>> obj.mac
'aa:bb:cc:11:22:33'
>>> obj.ip
'192.168.11.6'
>>> obj.version = 0 # can be assigned
>>> print(repr(obj))
Ints(id=123, mac='aa:bb:cc:11:22:33', ip='192.168.11.6', version=0)
It can be also deserialized from yaml directly to the custom object:
>>> yaml_string = """
!iz/Some
id: 22001
ip: 12.13.14.15
mac: aa:bb:cc:11:22:33
version: 0
"""
>>> import yaml
>>> obj2 = yaml.load(yaml_string, Loader=yaml.Loader)
>>> repr(obj2)
Some(id=22001, mac='aa:bb:cc:11:22:33', ip='12.13.14.15', version=0)
To be further documented...
Metadata
Release files for matiz 0.1.4
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 |
|---|---|---|---|---|
| matiz-0.1.4.tar.gz | 10.6 kB | Without provenance | Details for matiz-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| matiz-0.1.4-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for matiz-0.1.4-py2.py3-none-any.whl |
Total release size: 33.6 kB
Release files / matiz-0.1.4.tar.gz
| Download URL | matiz-0.1.4.tar.gz |
|---|---|
| Size | 10.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3d4a229673b8726ac6fd362906374a1e6ed7b01f62cb53225af4328de75443cc
|
|
BLAKE2b-256 checksum How to use checksums |
417cac7ae46edb394e3781b2a908831b8c9d9a04c70387fbbab1dc02083f9398
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.7.4
|
Release files / matiz-0.1.4-py2.py3-none-any.whl
| Download URL | matiz-0.1.4-py2.py3-none-any.whl |
|---|---|
| Size | 23.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
774cb8023ecdd1474aff5e73d2c648312aa2fed6687c4173bff9ee9119d9fc8d
|
|
BLAKE2b-256 checksum How to use checksums |
d67c6f979b2374d534591e7c76b7211b03850613c88f36662b64862873395983
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.7.4
|
Security for matiz 0.1.4
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.