perde: python-wrapped serde
Heavily under construction towards 0.1.0 🎅
Python wrapper around the powerful Rust serialization framework.
- Serialization & deserialization of python data structures.
- Supports various types including dataclasses, generic types, enum and common built-in types.
- Supports various serialization formats. By design,
perdecan support as many format asserdecan. - Provides string case conversion of field names, skipping serialization/deserialization options, structure flattening.
- Precise type checking based on type hints.
- Very fast.
Install
pip install perde
Usage
>>> import perde
Assume you have a dataclass,
>>> @dataclass
... class A:
... a: int
... b: str
To serialize class A to JSON,
>>> perde.json.dumps(A(a=10, b='x'))
'{"a":10,"b":"x"}'
To deserialize JSON to class A,
>>> perde.json.loads_as(A, '{"a":10,"b":"x"}')
A(a=10, b='x')
To deserialize JSON to a dictionary,
>>> perde.json.loads('{"a":10,"b":"x"}')
{'a': 10, 'b': 'x'}
More formats are supported.
>>> perde.yaml.dumps(A(10, "x"))
'---\na: 10\nb: x'
>>> perde.yaml.loads_as(A, '---\na: 10\nb: x')
A(a=10, b='x')
>>> perde.msgpack.dumps(A(10, "x"))
b'\x82\xa1a\n\xa1b\xa1x'
>>> perde.msgpack.loads_as(A, b'\x82\xa1a\n\xa1b\xa1x')
A(a=10, b='x')
Supported formats
- JSON (
perde.json) - YAML (
perde.yaml) - MessagePack (
perde.msgpack) - TOML (
perde.toml) - CBOR
- Pickle
- RON
- BSON
- Avro
- JSON5
- Postcard
- URL
- Environment variables
- AWS Parameter Store
- S-expressions
- D-Bus
- FlexBuffer
- XML
Supported types
dataclass- Primitive types
intstrfloatboolbytesbytearray
- Generic types
dict/typing.Dictlist/typing.Listset/typing.Setfrozenset/typing.FrozenSettuple/typing.Tupletyping.Optionaltyping.Uniontyping.Any
- Enum types
EnumIntEnumFlagIntFlag
- More built-in types
datetime.datetimedatetime.datedatetime.timedecimal.Decimaluuid.UUID
Attributes
Attributes allow to modify the way of serialization/deserialization.
For example, to serialize/deserialize the field names as camelCase,
>>> @perde.attr(rename_all="camelCase")
... @dataclass
... class A:
... foo_bar: int
... bar_bar: int
>>> perde.json.dumps(A(foo_bar=1, bar_bar=2))
'{"fooBar":1,"barBar":2}'
>>> perde.json.loads_as(A, '{"fooBar":1,"barBar":2}')
A(foo_bar=1, bar_bar=2)
See the book for more details.
Benchmark
JSON
YAML
TOML
MessagePack
Metadata
Release files for perde 0.0.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 | Actions |
|---|---|---|---|---|
| perde-0.0.2.tar.gz | 4.3 kB | Without provenance | Details for perde-0.0.2.tar.gz |
Built distributions (wheels)
Total release size: 7.7 MB
Release files / perde-0.0.2.tar.gz
| Download URL | perde-0.0.2.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9c050211422cf8bdca8f6a22f5557d394f346e017440dee2f208184cbc3a274f
|
|
BLAKE2b-256 checksum How to use checksums |
cca0bf99beeb5a4d7320513eab8230d6e9bfceda056a4311bfe908952da618db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.9.0
|
Release files / perde-0.0.2-cp39-none-win_amd64.whl
| Download URL | perde-0.0.2-cp39-none-win_amd64.whl |
|---|---|
| Size | 550.7 kB |
| Tags | CPython 3.9 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
78a042091feda95817db82cbf063e29b0e47ba9e5b2def25d959a4e9bf7f8fce
|
|
BLAKE2b-256 checksum How to use checksums |
c8cf294cdaa7f89f7afec2c2de5a2100599bfbf2ee6fa1f1b0b6cca8ef1cd316
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.9.0
|
Release files / perde-0.0.2-cp39-cp39-manylinux2010_x86_64.whl
| Download URL | perde-0.0.2-cp39-cp39-manylinux2010_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.9 Linux glibc 2.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
cfdf291f9d20e0137b8fdf5c6e7ebf5924270c33bde0bf36f64f60859ab9663e
|
|
BLAKE2b-256 checksum How to use checksums |
a9fbf640bd0aa0b499cd7b87032bff59f4c4f4c7cbfea840b65111c9e7712084
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.7.9
|
Release files / perde-0.0.2-cp39-cp39-macosx_10_7_x86_64.whl
| Download URL | perde-0.0.2-cp39-cp39-macosx_10_7_x86_64.whl |
|---|---|
| Size | 660.6 kB |
| Tags | CPython 3.9 macOS 10.7+ x86-64 |
|
SHA-256 checksum How to use checksums |
1dc9e9ba18fe29f4d57e2bc10f776f69658dcb3342003b1e216f65c2400b5c2b
|
|
BLAKE2b-256 checksum How to use checksums |
f582114e503587de21147f0480a3591adbd99ae22934d3cdfc78d161fe623c99
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.9.0
|
Release files / perde-0.0.2-cp38-none-win_amd64.whl
| Download URL | perde-0.0.2-cp38-none-win_amd64.whl |
|---|---|
| Size | 550.7 kB |
| Tags | CPython 3.8 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
e1b1db7942af3bed3b495eb988199e9bee080d45d67af5f3c08b2a4b8d28f229
|
|
BLAKE2b-256 checksum How to use checksums |
4daa08fe7704b9a10cd2fcfdf7f2d3fd345f4d0767eaa3516ca678b2c871f288
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6
|
Release files / perde-0.0.2-cp38-cp38-manylinux2010_x86_64.whl
| Download URL | perde-0.0.2-cp38-cp38-manylinux2010_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.8 Linux glibc 2.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
488bb307352526a82b4db4b2b10149f196dad6a263e6bf773c3a21f3185e75e0
|
|
BLAKE2b-256 checksum How to use checksums |
4b006bb5a33bd1dc4c81987e6ef339a032117058107f43b400f875a9e3b0a1c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.7.9
|
Release files / perde-0.0.2-cp38-cp38-macosx_10_7_x86_64.whl
| Download URL | perde-0.0.2-cp38-cp38-macosx_10_7_x86_64.whl |
|---|---|
| Size | 660.5 kB |
| Tags | CPython 3.8 macOS 10.7+ x86-64 |
|
SHA-256 checksum How to use checksums |
2a8ddcc3792ce751f1e8647dfc19306d3044a52bf968f5961da5a700749174fe
|
|
BLAKE2b-256 checksum How to use checksums |
7609fc137eb54b90fc6f8b405cf2139a9c53f0091cb06f27d2bed0a07eebc118
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.9.0
|
Release files / perde-0.0.2-cp37-none-win_amd64.whl
| Download URL | perde-0.0.2-cp37-none-win_amd64.whl |
|---|---|
| Size | 550.7 kB |
| Tags | CPython 3.7 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
d7dc2f1ed295796b3a3082d7bb4a8aeddb3705e7d37027c5c65e9461a0f170bb
|
|
BLAKE2b-256 checksum How to use checksums |
938aad94742cf04ced4f4379264a6a0177a5ba001533bf7da55c47b2c82d2b6a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.7.9
|
Release files / perde-0.0.2-cp37-cp37m-manylinux2010_x86_64.whl
| Download URL | perde-0.0.2-cp37-cp37m-manylinux2010_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
f57914ea4ff066319b08fd156807ac06444862fb4feeae654b7478e6e1400324
|
|
BLAKE2b-256 checksum How to use checksums |
528d66617712f935a5e24ce57d6ceb83459770be8fe69e04e9d091fa8063b16a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.7.9
|
Release files / perde-0.0.2-cp37-cp37m-macosx_10_7_x86_64.whl
| Download URL | perde-0.0.2-cp37-cp37m-macosx_10_7_x86_64.whl |
|---|---|
| Size | 660.6 kB |
| Tags | CPython 3.7 CPython 3.7 pymalloc macOS 10.7+ x86-64 |
|
SHA-256 checksum How to use checksums |
5e59d09cbcb9abe10e8a2f7f5100d7452fdd44477d44f992e13c8743d09c66f0
|
|
BLAKE2b-256 checksum How to use checksums |
8a9d1b79aa8a1e31cca31888260e379dc8b4319053f127184dc2aef62a720c57
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.9.0
|
Security for perde 0.0.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.