===========
.. image:: https://travis-ci.org/mivade/traitschema.svg?branch=master
:target: https://travis-ci.org/mivade/traitschema
.. image:: https://readthedocs.org/projects/traitschema/badge/?version=latest
:target: http://traitschema.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
.. image:: https://codecov.io/gh/mivade/traitschema/branch/master/graph/badge.svg
:target: https://codecov.io/gh/mivade/traitschema
.. image:: https://img.shields.io/github/release/mivade/traitschema.svg
:target: https://github.com/mivade/traitschema
Create serializable, type-checked schema using traits_ and Numpy. A typical use
case involves saving several Numpy arrays of varying shape and type.
.. _traits: http://docs.enthought.com/traits/
Defining schema
---------------
.. note::
The following assumes a basic familiarity with the ``traits`` package. See
its `documentation <http://docs.enthought.com/traits/>`_ for details.
In order to be able to properly serialize data, non-scalar traits should be
declared as a ``traits.api.Array`` type. Example:
.. code-block:: python
import numpy as np
from traits.api import Array, String
from traitschema import Schema
class NamedMatrix(Schema):
name = String()
data = Array(dtype=np.float64)
matrix = NamedMatrix(name="name", data=np.random.random((8, 8)))
For other demos, see the ``demos`` directory.
Saving and loading
------------------
Data can be stored in the following formats:
* HDF5 via ``h5py``
* JSON via the standard library ``json`` module
* Numpy ``npz`` format
Multiple schema can be saved at once to a zip file via
:func:`traitschema.bundle_schema` and loaded with
:func:`traitschema.load_bundle`.
Metadata
Release files for traitschema 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| traitschema-1.2.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for traitschema-1.2.0-py2.py3-none-any.whl |
Release files / traitschema-1.2.0-py2.py3-none-any.whl
| Download URL | traitschema-1.2.0-py2.py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
781c47b4baa9ce051640eb53429333c2f5a4d67e7f2e0747396ade0a0608046d
|
|
BLAKE2b-256 checksum How to use checksums |
b673b41eb2e2fd09dbebbe3e07e6617c17044aa7857bd1798d7e074b64e745d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for traitschema 1.2.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.