==========
A Python library for serializing and deserializing object trees to JSON-compatable values (dicts, lists, strings, ints, floats, bools).
[](https://travis-ci.org/Knio/structpack)
[](https://coveralls.io/r/Knio/structpack)
Installation
------------
The recommended way to install structpack is with [pip](http://pypi.python.org/pypi/pip/):
pip install structpack
[](http://badge.fury.io/py/structpack)
Examples
========
`structpack` is designed to be a base class (`msg`) that you inherit from and add properties to (`bool`, `int`, `float`, `string`, `list`, and `dict`).
The `msg` class adds methods `pack` and `load` which convert your object to and from native types, respectively.
The following is a trivial example of how to make a `Point` type using structpack
```python
import structpack
class Point(structpack.msg):
x = structpack.float
y = structpack.float
z = structpack.float
>>> p1 = Point(1., 2., 3.)
>>> data = p1.pack()
>>> print data
(1.0, 2.0, 3.0)
>>> p2 = Point.load(data)
>>> print p2
<__main__.Point object at 0x0000000001EDA390>
>>> print p2.x, p2.y, p2.z
1.0 2.0 3.0
```
More
----
Please see the [test suite](https://github.com/Knio/structpack/blob/master/tests/test_structpack.py) for more examples until they are documented here.
TODO
====
- Docs / examples
- Type check values
- Benchmark & optimize
Metadata
Release files for structpack 1.6.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 |
|---|---|---|---|---|
| structpack-1.6.0.zip | 6.6 kB | Without provenance | Details for structpack-1.6.0.zip |
Release files / structpack-1.6.0.zip
| Download URL | structpack-1.6.0.zip |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fc2fde8a79b30e4ebfd80c39520daa9b10724233a59f28183c91ff0f299a17b3
|
|
BLAKE2b-256 checksum How to use checksums |
daa4e6fce9b228ee614a783dcaafc0cdfab5cbd4cc0948eca1941e1428b8f160
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for structpack 1.6.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.