No project description provided
Project description
serpyco-rs: a serializer for python dataclasses
What is serpyco-rs ?
Serpyco is a serialization library for Python 3.9+ dataclasses that works just by defining your dataclasses:
import dataclasses
import serpyco_rs
@dataclasses.dataclass
class Example:
name: str
num: int
tags: list[str]
serializer = serpyco_rs.Serializer(Example)
result = serializer.dump(Example(name="foo", num=2, tags=["hello", "world"]))
print(result)
>> {'name': 'foo', 'num': 2, 'tags': ['hello', 'world']}
serpyco-rs works by analysing the dataclass fields and can recognize many types : list
, tuple
, Optional
...
You can also embed other dataclasses in a definition.
The main use-case for serpyco-rs is to serialize objects for an API, but it can be helpful whenever you need to transform objects to/from builtin Python types.
Installation
Use pip to install:
$ pip install serpyco-rs
Features
- Serialization and unserialization of dataclasses
- Validation of input/output data
- Very fast
- Support recursive schemas
Supported field types
There is support for generic types from the standard typing module:
- Decimal
- UUID
- Time
- Date
- DateTime
- Enum
- List
- Dict
- Mapping
- Sequence
- Tuple (fixed size)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
serpyco_rs-0.2.0.tar.gz
(29.6 kB
view hashes)
Built Distributions
Close
Hashes for serpyco_rs-0.2.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ad01717df867de189addd30c2a48f8f3088d1e34995142ee3dd92de9a1c6e1d |
|
MD5 | a498886575d66a0e3bf94ad5b0d56cc5 |
|
BLAKE2b-256 | 389e5edd230ff92fa80730463341c4e2a2b5ee2addc59b671300efd9eb90b324 |
Close
Hashes for serpyco_rs-0.2.0-cp311-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9414d89c651d8614cf76dbc96f7ad63abd431c4f9b248346e36f22114fdc8d1f |
|
MD5 | 18df315ef57d30c00a9f85c6eafcc57e |
|
BLAKE2b-256 | cda393fed654219e5d46cc59eebc6a7041412763cba02fac136263be0689c76d |
Close
Hashes for serpyco_rs-0.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff2fc8084ec64c860d94473d411e93f55ed23e613d9b5f33fe195123cca11d1e |
|
MD5 | fe41973aed220ffd56a0fd7c739a206b |
|
BLAKE2b-256 | 2fc4e8a16256a4c1f56629a2a1ca916d2a8c240e8b24adbe91f29c8c33a89242 |
Close
Hashes for serpyco_rs-0.2.0-cp311-cp311-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d304bd5445ed12e87c162e58f73046e90cfe79ae2c425f77c4ac60f7f1704e7 |
|
MD5 | 78437a30fc8234e4e0ae5f37fd3e00a6 |
|
BLAKE2b-256 | 0fed56fa2af81ce5ccf8d0f64c40ac8e6699ba7cc3e9a1c0270d1cf6cab390a5 |
Close
Hashes for serpyco_rs-0.2.0-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eaf048031e848420e8ff8f74def2611eb12dfdf6d0929dba1164da806cf6f359 |
|
MD5 | ccf82f029e4ce89cf49629b546da413a |
|
BLAKE2b-256 | c87d0a63d8652140abf47e8db90b8dc07a73744d324e770bb74b32bd3d86769b |
Close
Hashes for serpyco_rs-0.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ab4b69e835f9f13f3f91d30e4bff4185ae33bb2081156470134c8cd96fb2746 |
|
MD5 | d19a3597dcb8b3d068871617fa1e1c83 |
|
BLAKE2b-256 | 0ab956732608d12e08c184d305073af9b1a6ea661dab52818736ad149f24cf7e |
Close
Hashes for serpyco_rs-0.2.0-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 989991fd29aa454a19c04ea6a38045dde8b6d79054bbf63297e3c00be6bcec6b |
|
MD5 | 70a70eb81ac6deec33c2b90f3ce7ee2b |
|
BLAKE2b-256 | 4b529d0466c23cf5acf0a7efe1f6725a80d53402143b0c3635c0c23ddc3fe988 |
Close
Hashes for serpyco_rs-0.2.0-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6fabf43be198bf5de7aad5d9d41bb5447680ac8a11ef81aa9370561ed2132e8b |
|
MD5 | d7208bde680e72486857aa45e9feb087 |
|
BLAKE2b-256 | 0876391e0ee45d9fe3e973141e9d2e4c658ddfc98c73867f032e894d1c85e153 |
Close
Hashes for serpyco_rs-0.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7c62460d4cc2a8d9f2731682b31e64656cf07e650aaf6cb16367f500412676f |
|
MD5 | d3d984a1ea639e1e5cb63e5b95bc6fe0 |
|
BLAKE2b-256 | ffba7c78f40fdc28f488a40fbfdae7b545cc5c7cff53dfef0d8967898511ab37 |
Close
Hashes for serpyco_rs-0.2.0-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ea28b2a5a5a2caf7073dc1515adb70d465d1e4ca6d171b633178cf3f66c9622 |
|
MD5 | 4b6a407ea217a01d62d6402894749aa4 |
|
BLAKE2b-256 | a14c5d6f12cfc2e1a07bf548b45e2cc48f126a6a6012e03d8eec330c29eae0c2 |