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
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)
Todo
- parse timezone for datetime.time
- omit_none
- run tests in CI
- CI checks (pylint, black, mypy, ...)
- more tests
- bench results
- write docs
- ...
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.1.2.tar.gz
(26.9 kB
view hashes)
Built Distributions
Close
Hashes for serpyco_rs-0.1.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d75fad92a9891071fb8c7c5465bcc3f282e694d834eb50c7f1dc04aa8717a87 |
|
MD5 | b61dc4228e4d5ee319980152688fac98 |
|
BLAKE2b-256 | c7fe3daa3b3f0e8f24e49916a1bb8b86ab69b29bc5eb20165eaf6e6d7bb48ecf |
Close
Hashes for serpyco_rs-0.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f876d8ba7c81c0e98d3291bf2e52fb58a8975a7a320f351ed95afe56612feb2 |
|
MD5 | 4a8602f9e6939e78d2519a75426d8ae9 |
|
BLAKE2b-256 | b3ae6e15b183f7aaccac5990db8d0de30e52506c3fc6aff1724f140b9aabf3f3 |
Close
Hashes for serpyco_rs-0.1.2-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ba266f785ff4913c3bc79ad56eca6419042e442ccdd10cd993b33b292acf8b8 |
|
MD5 | d72afb940612b0c0cb2a15b8f21bbe0f |
|
BLAKE2b-256 | aa66e31ea0190df8e41b80150a4ec1558642f8e6c8643de9e5cb456922bae671 |
Close
Hashes for serpyco_rs-0.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c727f7dd9ca2fc9e585eb127caff534947e3475b4c19d64c08b15d21b62e3e51 |
|
MD5 | 00904fe166a5fe9941ffec1229ce502d |
|
BLAKE2b-256 | 0b5db422bfb930e6032e9751fc23b6e4cbceb24d234431910443b5864fd0323d |
Close
Hashes for serpyco_rs-0.1.2-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9580d6799bcabfc463beadec5d4487740bd878ac7325b651b6cb649a64237ae9 |
|
MD5 | c1059c0f560e7bf03d97288ab0609e19 |
|
BLAKE2b-256 | c3c3a9817638f260ec2a0d2615adec581efbe6e4cfd2eb5662124521984c7089 |
Close
Hashes for serpyco_rs-0.1.2-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa5a73f4b75cfd5388a990d79cab8f27eec0b3bb170dec9ac3685bebb7887a96 |
|
MD5 | 6230c7bbba7199d591a410f8952ca8e2 |
|
BLAKE2b-256 | 34bcef9a0cdb4e46da815fb549b3bc1b26064186798d4dfec1208ff4fb719fd3 |
Close
Hashes for serpyco_rs-0.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2c64e9d009b35fe19dbd71a5b7adcc745d38255e0c19925234fb1878efc96eb |
|
MD5 | 58e118d2692db9ccfa748f2b0aa65f3f |
|
BLAKE2b-256 | c767f4babe5f8abaf53432fdb214a1badbbeb6210416787212ab2c6863684e92 |
Close
Hashes for serpyco_rs-0.1.2-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1fdf5ab281e544acefc37c3501132aab4613ba221b89c0239d67788987930603 |
|
MD5 | 1747b7a68bba816fcdfa64e8fc7c2084 |
|
BLAKE2b-256 | 0bc0d00080049f1355a4b6d075a55c3c289553f711f113a5070f703ba1efe19d |