Skip to main content

Fast serialization of dataclasses using Cython

Project description

What is Serpyco ?

Serpyco is a serialization library for Python 3.6+ dataclasses that works just by defining your dataclasses:

import dataclasses
import typing

import serpyco

@dataclasses.dataclass
class Example(object):
    name: str
    num: int
    tags: typing.List[str]


serializer = serpyco.Serializer(Example)

result = serializer.dump(Example(name="foo", num=2, tags=["hello", "world"]))
print(result)

{'name': 'foo', 'num': 2, 'tags': ['hello', 'world']}

Serpyco works by analysing the dataclass fields and can recognize many types : List, Set, Tuple, Optional, Union… You can also embed other dataclasses in a definition.

The main use-case for Serpyco is to serialize objects for an API, but it can be helpful whenever you need to transform objects to/from builtin Python types.

Features

  • Serialization and unserialization of dataclasses

  • Validation of input/output data

  • Very fast

  • Extensible through custom encoders

Installing

Serpyco is best installed via pip:

pip install serpyco

It has only 3 (4 with python 3.6 dataclasses backport) dependencies:

  • rapid-json: used for data validation and fast JSON dump/load

  • python-dateutil: used for serializing datetime objects

  • typing_inspect: used to inspect types as needed to create serializers

Documentation

Contributing

Serpyco is written using Python and Cython for parts needing speed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

serpyco-d7-1.3.15.tar.gz (42.8 kB view details)

Uploaded Source

Built Distributions

serpyco_d7-1.3.15-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (161.2 kB view details)

Uploaded PyPy manylinux: glibc 2.17+ ARM64

serpyco_d7-1.3.15-pp310-pypy310_pp73-macosx_11_0_arm64.whl (133.2 kB view details)

Uploaded PyPy macOS 11.0+ ARM64

serpyco_d7-1.3.15-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (161.3 kB view details)

Uploaded PyPy manylinux: glibc 2.17+ ARM64

serpyco_d7-1.3.15-pp39-pypy39_pp73-macosx_11_0_arm64.whl (133.2 kB view details)

Uploaded PyPy macOS 11.0+ ARM64

serpyco_d7-1.3.15-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (160.4 kB view details)

Uploaded PyPy manylinux: glibc 2.17+ ARM64

serpyco_d7-1.3.15-pp38-pypy38_pp73-macosx_11_0_arm64.whl (131.9 kB view details)

Uploaded PyPy macOS 11.0+ ARM64

serpyco_d7-1.3.15-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (160.4 kB view details)

Uploaded PyPy manylinux: glibc 2.17+ ARM64

serpyco_d7-1.3.15-cp311-cp311-musllinux_1_1_aarch64.whl (1.0 MB view details)

Uploaded CPython 3.11 musllinux: musl 1.1+ ARM64

serpyco_d7-1.3.15-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.0 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

serpyco_d7-1.3.15-cp311-cp311-macosx_11_0_arm64.whl (172.2 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

serpyco_d7-1.3.15-cp310-cp310-musllinux_1_1_aarch64.whl (954.1 kB view details)

Uploaded CPython 3.10 musllinux: musl 1.1+ ARM64

serpyco_d7-1.3.15-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (947.7 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

serpyco_d7-1.3.15-cp310-cp310-macosx_11_0_arm64.whl (175.6 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

serpyco_d7-1.3.15-cp39-cp39-musllinux_1_1_aarch64.whl (980.3 kB view details)

Uploaded CPython 3.9 musllinux: musl 1.1+ ARM64

serpyco_d7-1.3.15-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (976.6 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

serpyco_d7-1.3.15-cp39-cp39-macosx_11_0_arm64.whl (168.2 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

serpyco_d7-1.3.15-cp38-cp38-musllinux_1_1_aarch64.whl (1.0 MB view details)

Uploaded CPython 3.8 musllinux: musl 1.1+ ARM64

serpyco_d7-1.3.15-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (988.3 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARM64

serpyco_d7-1.3.15-cp38-cp38-macosx_11_0_arm64.whl (169.8 kB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

serpyco_d7-1.3.15-cp37-cp37m-musllinux_1_1_aarch64.whl (858.4 kB view details)

Uploaded CPython 3.7m musllinux: musl 1.1+ ARM64

serpyco_d7-1.3.15-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (855.8 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ ARM64

File details

Details for the file serpyco-d7-1.3.15.tar.gz.

File metadata

  • Download URL: serpyco-d7-1.3.15.tar.gz
  • Upload date:
  • Size: 42.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for serpyco-d7-1.3.15.tar.gz
Algorithm Hash digest
SHA256 c74b789eb3aec47108e9eff63b33deff9dd1a9551ce49f4d04dfb5b24b391955
MD5 9d551661dfe3794d775d5d8b6f6c9864
BLAKE2b-256 8ffa03ae5874df24bdeaa7eb99003c51dd930432e7b5c4ff3c1c46e5d16e4efd

See more details on using hashes here.

File details

Details for the file serpyco_d7-1.3.15-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for serpyco_d7-1.3.15-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1c7c1af277e4a4e7421d3b0d0a31ad04b27074bbf17a700b8d76599ff97bc90b
MD5 116ac89bb32a8501dde10b83e4d3cab2
BLAKE2b-256 438bb181071580099b6e64f0766f6b41aa06490d397dec12d36df6721e930b32

See more details on using hashes here.

File details

Details for the file serpyco_d7-1.3.15-pp310-pypy310_pp73-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for serpyco_d7-1.3.15-pp310-pypy310_pp73-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3ca89e84e8c8b0697c720d0ff2be15698a9a583e6fd658b06f2423f886d9a30f
MD5 05a7c3257c8a12426ab4d4e161762000
BLAKE2b-256 256deb4c90bf4fa34a160b697984a24331a26e26f419d31893189e9ede7c39fc

See more details on using hashes here.

File details

Details for the file serpyco_d7-1.3.15-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for serpyco_d7-1.3.15-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 515d205942d4a295d3165c06b7891098dc585d00a0c2a729bfb6e21b2b10ae9d
MD5 994f3c1633bbae03a715923981494a88
BLAKE2b-256 acf9b52ab442aa8460fbee3441596f01e8e73e3b4e5031d67e7af516b811f2ef

See more details on using hashes here.

File details

Details for the file serpyco_d7-1.3.15-pp39-pypy39_pp73-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for serpyco_d7-1.3.15-pp39-pypy39_pp73-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fe9ab69a714a4a5ea876798075b2d636e63193c439b7c62e80073725b47499b2
MD5 7dda069ad56cf7fbfa7c62ec0b74271e
BLAKE2b-256 4e106ab4c2967a2d3434b71b04f85eb8ce9124c66aa4c9637cae67e1ed450cf2

See more details on using hashes here.

File details

Details for the file serpyco_d7-1.3.15-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for serpyco_d7-1.3.15-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7478a0af7a631aa078f1f24333405ffa9f0d5dd7761017910cae8ccd7f947e40
MD5 a86b8a833e925b9220ab73663c7d62ed
BLAKE2b-256 8631244cecf148057789afa92c57150828560c0f42818f42826f4ad3e03660c8

See more details on using hashes here.

File details

Details for the file serpyco_d7-1.3.15-pp38-pypy38_pp73-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for serpyco_d7-1.3.15-pp38-pypy38_pp73-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ffb014027fd2c10d2cda9d119e1e3f493b746308ea9b7f26431891993bcea228
MD5 1cf387848bf764353f474930b54a4193
BLAKE2b-256 9d31a75ca04b7f3ca50627e576923c7a3029e010c824557fe9e913e40ddc8599

See more details on using hashes here.

File details

Details for the file serpyco_d7-1.3.15-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for serpyco_d7-1.3.15-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 192da6aab24b8a19d32ff7437b7ae924fd7f8d4901fb21f618d9e53ab6b7c32a
MD5 8a9d1e78aec753b1f8e992fea6fc109a
BLAKE2b-256 d4c004e9270288ea280595fcb37f469e07c2580f8141b7c3986e882c1dc231b1

See more details on using hashes here.

File details

Details for the file serpyco_d7-1.3.15-cp311-cp311-musllinux_1_1_aarch64.whl.

File metadata

File hashes

Hashes for serpyco_d7-1.3.15-cp311-cp311-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 190cff569cdfb3d2ccbfa4b24f3da01a24124cb35bea3507a394bc43a8c17aa6
MD5 200aecc1f37fcedfc1ab0bd3ac4144e1
BLAKE2b-256 45be46e2879d4b7cd480c2766313db7d159bc0473457a8e8d9a8d03395f644e0

See more details on using hashes here.

File details

Details for the file serpyco_d7-1.3.15-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for serpyco_d7-1.3.15-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 681c186155799ebef758717eb01c230a5859d8f97d7f31d3db88f4fbf743c141
MD5 d372dc4b02dfe2171d55747b42af12e7
BLAKE2b-256 88161f3a37cb1735321ba24dcf0194be70fb1eed4a6b0114cf6dddb4b2cfcfac

See more details on using hashes here.

File details

Details for the file serpyco_d7-1.3.15-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for serpyco_d7-1.3.15-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bc9a121fb73c6bc39eba73b1f4cc8fa3f3c94a3487828c0ac2082be3a58d6dc6
MD5 49bd119cea883f94c1187365e183cee5
BLAKE2b-256 077cab1b91599a3222bd0283fbf3b61c15adc37d34bfc532ac641f5fd5a47fae

See more details on using hashes here.

File details

Details for the file serpyco_d7-1.3.15-cp310-cp310-musllinux_1_1_aarch64.whl.

File metadata

File hashes

Hashes for serpyco_d7-1.3.15-cp310-cp310-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 c9df544f50618712edc3dda75581a88975a57a2ea02aee63d46bd66f8190aef8
MD5 6288c6a25f68230dcc5f40703cec9902
BLAKE2b-256 4223ec71e73d1856625e78734ef09d4ec46c8d857b41653f7ccaf7c991d74b02

See more details on using hashes here.

File details

Details for the file serpyco_d7-1.3.15-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for serpyco_d7-1.3.15-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0f3bfa6a7879764e95e5ce7decd4fa7959ebc6b87fd7616aa2b3f93fcf91c13a
MD5 3d67d844136a71668bf0402fd601caf9
BLAKE2b-256 c3c0dc70cfd4f6e6376c577bda8aa6bba76c391c1a9edbd9dbacf673d8c2851e

See more details on using hashes here.

File details

Details for the file serpyco_d7-1.3.15-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for serpyco_d7-1.3.15-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c41dc5666a4f04f0d8c0c3dc3656e2766d256341e1bd8cba1e695313b94b3397
MD5 c21d53545b410a418c53687524f8922d
BLAKE2b-256 0fbcd20e86594e9354eded2509f366d30d1a1635c55c8b047f687769d11c317f

See more details on using hashes here.

File details

Details for the file serpyco_d7-1.3.15-cp39-cp39-musllinux_1_1_aarch64.whl.

File metadata

File hashes

Hashes for serpyco_d7-1.3.15-cp39-cp39-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 46887c5f780831d67820985578a53810706418a7dcfb5a5dc67ed9bd14624cfa
MD5 8bf895698d59085d19d2197ed0909ca9
BLAKE2b-256 6e8e91c9f93008ce9bb31553e08b669fc73b95a659fbcdf6d669f74245cfa8dc

See more details on using hashes here.

File details

Details for the file serpyco_d7-1.3.15-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for serpyco_d7-1.3.15-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e78d6cf0d00c4dfb82aa90f3c277a89d024cacb06010616e4772c63584aa5a20
MD5 7dde8c37fd73930bb196f6773c107cfe
BLAKE2b-256 3585e32fbef8bab00ed249f35f0ec817e9733f532874d4df38ac7a42e4208a6f

See more details on using hashes here.

File details

Details for the file serpyco_d7-1.3.15-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for serpyco_d7-1.3.15-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 27c96b9bc0bd433f4c7f803e2a1756125928eb905dab9ab259180b08588f4c02
MD5 b81477676b03e6e1033993c581a01c18
BLAKE2b-256 4bd2bd3cdc8469518e1452aa5ba1791bc2165c9bfcff2c1629d0b01ef411c5ff

See more details on using hashes here.

File details

Details for the file serpyco_d7-1.3.15-cp38-cp38-musllinux_1_1_aarch64.whl.

File metadata

File hashes

Hashes for serpyco_d7-1.3.15-cp38-cp38-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 5b90aee73c844e6bc1571be0701b5067a544c591aefc8506282821a44ee90906
MD5 3b8f90d7f1358dbfe04fd4ea7bcdbcbd
BLAKE2b-256 630ba9b15b3987adc2d355bd40a17c96259080879e727ce76e12c39a2beb6a09

See more details on using hashes here.

File details

Details for the file serpyco_d7-1.3.15-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for serpyco_d7-1.3.15-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fdc9513ac25165918a533e5d9ab944ef0b902e6463f879a99b49e099b1e929f0
MD5 d9234beb26e367b2956970ded8f42345
BLAKE2b-256 fe3a311cdf2a8c79edee7fc665c7706b7783c7fba6d1b1b26ffbacd4298be3e9

See more details on using hashes here.

File details

Details for the file serpyco_d7-1.3.15-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for serpyco_d7-1.3.15-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 501f0e607b246a57a76677031c53382009bb125ee0a9b0cc023104b5375ae6ff
MD5 c53596b08b9279c834507ddef158d785
BLAKE2b-256 da18503c7274bebf5c10e0a536a80dfdcdf995528179eb2447b48a34dd01297d

See more details on using hashes here.

File details

Details for the file serpyco_d7-1.3.15-cp37-cp37m-musllinux_1_1_aarch64.whl.

File metadata

File hashes

Hashes for serpyco_d7-1.3.15-cp37-cp37m-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 380a2deb57da09e0837b585aef95026cf68834faa627171b7d36221db286577d
MD5 c25a7a552d3c403dfcc15019293e2f79
BLAKE2b-256 cb647762cef5883c41615db3f3acf96cd741e161ef4c1a3d37b4cb58afcf3f5d

See more details on using hashes here.

File details

Details for the file serpyco_d7-1.3.15-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for serpyco_d7-1.3.15-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6656e7f6c5078ffc5e492d9ceeb3d2730fc4b8f451a023cdba303718b7e2cb26
MD5 2eafc9ef8dfc3bc8bbf3742e102bf30c
BLAKE2b-256 a8328fa2a7cf0f0cef4d17bad2c91e94d3c6b05eb5c6cc664d7c6949a0b77151

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page