# datamodels
The datamodels package builds on dataclasses and adds the following functionality:
.dict() instance method – returns a dict of the data, making it simple to serialize to formats like JSON or YAML.
.from_data() class method – create a new instance by passing in an iterable key-value data source (such as a dict). Unlike the regular constructor, this only uses the values in the input data that match fields in the model — others are ignored. This is useful for pulling model data out of a larger data source.
@validator decorator to specify data validation methods.
.validate() class method – runs the attribute validator methods and returns a dict with the fields that have errors as keys and a list of errors as the values.
The datamodels package is inspired by prior art: Django models and forms, the attrs package by which dataclasses was inspired, and the XML world, where schemas and data validation form a key part of production workflows.
Installation:
`bash pip install datamodels `
Metadata
Release files for datamodels 0.8.2
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 | |
|---|---|---|---|---|
| datamodels-0.8.2.tar.gz | 5.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| datamodels-0.8.2-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 18.1 kB
Release files / datamodels-0.8.2.tar.gz
| Download URL | datamodels-0.8.2.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bc60d3b8425bd7a9fcb20f7b8dbd4a067d6b99172463732733124acb743c9127
|
|
BLAKE2b-256 checksum How to use checksums |
f1f6096612993054998ab4b276bc0caa85053f551f31cc3a1f01fbd2dd8a1332
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
|
Release files / datamodels-0.8.2-py2.py3-none-any.whl
| Download URL | datamodels-0.8.2-py2.py3-none-any.whl |
|---|---|
| Size | 12.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
91b1ce563fe8f6ecc50bc505c8115397fcdca188957c14b718465ec0c7eeab12
|
|
BLAKE2b-256 checksum How to use checksums |
d40d15cfa81ce24df475413929b552f9c084153bcea6839dea590c76fb97911a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
|
Security for datamodels 0.8.2
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.