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.14.tar.gz (42.9 kB view details)

Uploaded Source

Built Distributions

serpyco_d7-1.3.14-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (186.4 kB view details)

Uploaded PyPy manylinux: glibc 2.17+ ARM64

serpyco_d7-1.3.14-pp310-pypy310_pp73-macosx_11_0_arm64.whl (158.8 kB view details)

Uploaded PyPy macOS 11.0+ ARM64

serpyco_d7-1.3.14-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (186.2 kB view details)

Uploaded PyPy manylinux: glibc 2.17+ ARM64

serpyco_d7-1.3.14-pp39-pypy39_pp73-macosx_11_0_arm64.whl (158.5 kB view details)

Uploaded PyPy macOS 11.0+ ARM64

serpyco_d7-1.3.14-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (185.6 kB view details)

Uploaded PyPy manylinux: glibc 2.17+ ARM64

serpyco_d7-1.3.14-pp38-pypy38_pp73-macosx_11_0_arm64.whl (156.9 kB view details)

Uploaded PyPy macOS 11.0+ ARM64

serpyco_d7-1.3.14-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (185.7 kB view details)

Uploaded PyPy manylinux: glibc 2.17+ ARM64

serpyco_d7-1.3.14-cp312-cp312-musllinux_1_1_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.12 musllinux: musl 1.1+ ARM64

serpyco_d7-1.3.14-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARM64

serpyco_d7-1.3.14-cp311-cp311-musllinux_1_1_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.11 musllinux: musl 1.1+ ARM64

serpyco_d7-1.3.14-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

serpyco_d7-1.3.14-cp311-cp311-macosx_11_0_arm64.whl (188.7 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

serpyco_d7-1.3.14-cp310-cp310-musllinux_1_1_aarch64.whl (1.0 MB view details)

Uploaded CPython 3.10 musllinux: musl 1.1+ ARM64

serpyco_d7-1.3.14-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.0 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

serpyco_d7-1.3.14-cp310-cp310-macosx_11_0_arm64.whl (187.1 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

serpyco_d7-1.3.14-cp39-cp39-musllinux_1_1_aarch64.whl (1.0 MB view details)

Uploaded CPython 3.9 musllinux: musl 1.1+ ARM64

serpyco_d7-1.3.14-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.0 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

serpyco_d7-1.3.14-cp39-cp39-macosx_11_0_arm64.whl (188.0 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

serpyco_d7-1.3.14-cp38-cp38-musllinux_1_1_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.8 musllinux: musl 1.1+ ARM64

serpyco_d7-1.3.14-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARM64

serpyco_d7-1.3.14-cp38-cp38-macosx_11_0_arm64.whl (188.0 kB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

serpyco_d7-1.3.14-cp37-cp37m-musllinux_1_1_aarch64.whl (943.9 kB view details)

Uploaded CPython 3.7m musllinux: musl 1.1+ ARM64

serpyco_d7-1.3.14-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (931.7 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ ARM64

File details

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

File metadata

  • Download URL: serpyco-d7-1.3.14.tar.gz
  • Upload date:
  • Size: 42.9 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.14.tar.gz
Algorithm Hash digest
SHA256 c40ec6f82b3d242732acd7cdac6ca64ec7614b952fb3cb5f3fa0fe66928ed0c8
MD5 03eb59dcd01b0052776082dc519e21f5
BLAKE2b-256 42db8468589a27081cbccc169b51c2a5285670e276e219ebee18d80a24da5570

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for serpyco_d7-1.3.14-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6430f5cd5eb79f58c293745252b0c29f15dccb205bb2fa1b433f304c2430b7bb
MD5 63d33a94eac1cf09be7033ceb95693f6
BLAKE2b-256 e8aebd575139ced84d76ec287d7b64314a5881b0a4ff919a0c34fbc754abe479

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for serpyco_d7-1.3.14-pp310-pypy310_pp73-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1f70b7c768c701582435346fbde04bf1bf61d266ced6f3b5f0937792700cbc53
MD5 9166f9f02ee2fa41b95def8fbdde3060
BLAKE2b-256 49f01c5131b5521d2e8b9e5e838a275944cf12e43563e51f3edd7d93c2cdd81e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for serpyco_d7-1.3.14-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 be1f0385a99133d98fa3add07c08eb51a65e80c0e3dee2db3b31553445af0c08
MD5 95a71511926bbf219e742063cdfb87a9
BLAKE2b-256 e4d72275c27c51829e57826f54d37785af1a7511ac1bb0165ed3572cef6f4955

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for serpyco_d7-1.3.14-pp39-pypy39_pp73-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cd06783453c92e96e54df095111fba529bb230b08e01a8fdbd801dfc9f0ecf05
MD5 37f1ec30812a1cfd2531ba39fc75bb79
BLAKE2b-256 550b8bb6e5dfcb9ad8df08a827077f49e85317229ba86283826cdc9d78080a3d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for serpyco_d7-1.3.14-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f0f040758391b4380afb8f6b60c47127578292a07d2a8f7072a7b6479a235647
MD5 74e94d453d7e160f222bf7942a331925
BLAKE2b-256 b54f90977efd924302a7128a81aa7f41ca9f2dc62e02f1e854f89c9d86b4d864

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for serpyco_d7-1.3.14-pp38-pypy38_pp73-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 611d2337db01aedd456724a0b25d82120a31a00d519d5495cc84f9154b92df70
MD5 59a9334f6dbd66009fb61b349d20675b
BLAKE2b-256 6fd8b571ae91a3818072c91683ee6b27ac20388f59ff10df99f0c678443aaa81

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for serpyco_d7-1.3.14-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1fd89168f59a49b7d475946746b6b0b14dc0dde46f36f76ad0fd5563551e75e4
MD5 4c619dacb0a4c7ff77f9ff5bdaed7384
BLAKE2b-256 0f94f9a0228befa28c18bbc6323c2cb694e14759b9af8c958319ec352edebfee

See more details on using hashes here.

File details

Details for the file serpyco_d7-1.3.14-cp312-cp312-musllinux_1_1_aarch64.whl.

File metadata

File hashes

Hashes for serpyco_d7-1.3.14-cp312-cp312-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 a983a5235d5af8daad6f81a83f4e275be7e3fef3b46932fc77e4493f1746b2b1
MD5 c0fff6412f84b18dbfbf0a87269edcc4
BLAKE2b-256 f7a75054cc3e731bc333522ee010a0a7714e820b3cffd0c5a4b43ae4e53e82d1

See more details on using hashes here.

File details

Details for the file serpyco_d7-1.3.14-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for serpyco_d7-1.3.14-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 efc0d160f4bbdba61bb0d903843dd9a0ff61bf85d562db952c98abe42b2d2f42
MD5 44072237d52f06f3915bd549626fb25a
BLAKE2b-256 6485f45a6f6a27c094b6459f7d1a8cb925eb7f010c01010e9531325bb107b60e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for serpyco_d7-1.3.14-cp311-cp311-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 7758ede4ef5927f399ea57fa6cd9aa1862a41ae6ca2dd41e922bd003e59d02e7
MD5 83c30eb1d8c05bbb0e8f73a8f1ccb5df
BLAKE2b-256 2b6b5696b63ac150ec4147bdfac2d8260b495ec2034cd094aa66b1ae7f5c5064

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for serpyco_d7-1.3.14-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8a7e2e4e49cc41f420e126ec57cf1ba221366a958f4abe333a30abfe9ef38474
MD5 6977d36de9dca345d75e9ca97acf28f7
BLAKE2b-256 097886fc79ca85bf908a4f2f8998da4e65b5b0ca14533c3692200f83846b5a0b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for serpyco_d7-1.3.14-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 813f6fd781bb0bd89ba9096e40eb0dab151003d545157bbba2aaf748a738a90e
MD5 d887109570866f01d9d5b42caad675b4
BLAKE2b-256 ed1e06daca85aa5ccf6c6e52beea7e2df84d5bd4dd3a4806e5a61b2d5ac03af2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for serpyco_d7-1.3.14-cp310-cp310-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 f780bebe312f756f19cd414dd998dc8cded16d437047c52ceae180ba8aed6e66
MD5 c4357baed80979539cf10cee7b1b7260
BLAKE2b-256 f24e2c65728d75c58d6ea5d6ad162d01b3196707f01bfac00b5d4c7e94a26bf9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for serpyco_d7-1.3.14-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 64fd28aaec541f5e59209ecfc9a0dd6a742bd15f4689a0e7c222fc9599a731af
MD5 0d0c829bf1f2b33497fddddc96b3fffc
BLAKE2b-256 8cf066ccd7c5a5f7c8d22ae4db7b2b7a7e24e30d13107125f608e09379676a5f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for serpyco_d7-1.3.14-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1e5e939603915340087f6f3a1d2f3477c282d18a61a33546e69efb8385285ca8
MD5 17cbe4d169f08c2ffced94a88b471bdd
BLAKE2b-256 26bc2311255b39de0e7136f1d6f261c9c7c74c8a0078c4343267c6a702c84c3d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for serpyco_d7-1.3.14-cp39-cp39-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 aace7c430519d1cebd64305aa69b3401d9f8c2187f8f4091b81d2405e46ea4fd
MD5 8572b7bd6d11038fa31259afd32d014c
BLAKE2b-256 7fb19263b975457e57bcef607a773c7f456c77faacfe775c877c59110e4b786b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for serpyco_d7-1.3.14-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 aeaeeb6590660c53308b93569887689631daaa12d335271227090304e3686a9b
MD5 869fff61ab4bd3b569df0517b637fc94
BLAKE2b-256 ddf52176b791abf37f26ca9ef2ae7daba073af5aefc3a8e52118d9d0c7ecfd3a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for serpyco_d7-1.3.14-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cee5540d3c838e87e0ff6cb4a2d630e73aa97ffb98b43275b852fa140496d8bd
MD5 4a6c4198cd3eddf1bc84d8c8c6ef1e41
BLAKE2b-256 11c8a62d09fdf183cdc41a7e94de32d6f670c337b8dc0fee5271e13663219105

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for serpyco_d7-1.3.14-cp38-cp38-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 4e000808107df02d604e65bf851e115d9c190837578b3cb356873c6de72af723
MD5 be93113646478d478c84deeda3ae78c4
BLAKE2b-256 04fd243b524dd2af0f3baeb916749f5d025c59e6e27bd4c96d226c9abf026418

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for serpyco_d7-1.3.14-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f4ec13b61578614b3bf4f6d1be56ad8a35d5fb4172710b346788903d140aa44b
MD5 f4fdf09790f8b8335ceca74776372a12
BLAKE2b-256 492a6b9ad186bb2038795fbfaf4018e0c82c81eb02a63e2167b681fdc01736bf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for serpyco_d7-1.3.14-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e72b7ead062ba64c87a6b6ea46d781b3c7c126a2c567a9f896f8034fe5e33ce0
MD5 0a2f17ef681d2d66689578fe6c48bd32
BLAKE2b-256 5788700275635416436810e03a6e04b007181961bce79c718aee312d0af7665a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for serpyco_d7-1.3.14-cp37-cp37m-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 b05381de4e5dcc24e5f8c70f04e575b735f3e6d84f2c24d4bac6c1f7bb7066c3
MD5 d60b832899c9be1063d649cd60f70d12
BLAKE2b-256 3fa07a633310bb2177d3394546d0f58cf22d9865eceec95a6071ed8d2d5c2c40

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for serpyco_d7-1.3.14-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f0d79430e22573c041367ffd4f45f7159b05c35d60ab9707a4e34a5aacb7a9b0
MD5 62eb4ab349c02ee6bfe89707de58202b
BLAKE2b-256 9106dd01fcdba31ae9fc70431a38d0b10bf283a61bb30b5791c3ef6ca797ffe6

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