Pyserde

Latest version: v0.22.2

Safety actively analyzes 685838 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 10 of 12

0.8.0

Thanks to the contribution by [kigawas](https://github.com/kigawas), pyserde can optionally use [orjson](supports://github.com/ijl/orjson) as JSON serializer!

pip install pyserde[orjson]

If orjson is installed in the system, pyserde automatically use orjson in [to_json](https://yukinarit.github.io/pyserde/api/serde/json.html#to_json)/[from_json](https://yukinarit.github.io/pyserde/api/serde/json.html#from_json).

**NOTE:** In order to align the JSON (de)serializer to orjson, a few parameters are passed in `json.dumps` internally. This would lead to a breaking change in some cases. If you need the same behaviour as in pyserde<0.8, please explicitely pass those parameters in `serde.json.to_json`. 🙇‍♂️
python
to_json(obj, ensure_ascii=True, separators=(", ", ": "))


Other noteble chage is we have `dataclass` decorator back in the all example and test code in the repository as shown below. It's because we found mypy isn't able to deduce the type correctly without `dataclass` decorator. If you are not mypy user, you can still declare a class with only `serde` decorator. 👍 For more information, please read [the docs](https://yukinarit.github.io/pyserde/guide/features/decorators.html).

python
serde
dataclass <-- Recommended to add dataclass if you are mypy user.
class Foo:
i: int
s: str
f: float
b: bool


* build: Add "orjson" extras ([ea70ec1](https://github.com/yukinarit/pyserde/commit/ea70ec1))
* orjson support ([2744675](https://github.com/yukinarit/pyserde/commit/2744675))
* Update json.py ([2d67b65](https://github.com/yukinarit/pyserde/commit/2d67b65))
* feat: Support class declaration w/wo dataclass ([a35f909](https://github.com/yukinarit/pyserde/commit/a35f909))
* fix: Add dataclass decorator for all example code ([60567ab](https://github.com/yukinarit/pyserde/commit/60567ab))
* fix: Treat <type>|None as Optional ([5555452](https://github.com/yukinarit/pyserde/commit/5555452))
* Fix the default deserializer for custom class deserializer ([6c2245b](https://github.com/yukinarit/pyserde/commit/6c2245b))

This release had contributions from 1 person: [kigawas](https://github.com/kigawas). Thank you so much! :tada: :joy:

0.7.3

Thanks to the great contribution by [kmsquire](https://github.com/kmsquire), pyserde supports some numpy types!

python
serde
class NPFoo:
i: np.int32
j: np.int64
f: np.float32
g: np.float64
h: np.bool_
u: np.ndarray
v: npt.NDArray
w: npt.NDArray[np.int32]
x: npt.NDArray[np.int64]
y: npt.NDArray[np.float32]
z: npt.NDArray[np.float64]


* feat: Remove try-catch from is_numpy_array() (unnecessary) ([731876f](https://github.com/yukinarit/pyserde/commit/731876f))
* feat: Support Literal[...] type annotation ([e50c958](https://github.com/yukinarit/pyserde/commit/e50c958))
* feat: Support numpy types ([78eb22e](https://github.com/yukinarit/pyserde/commit/78eb22e))
* feat(compat): Only define np_get_origin() for python 3.8 or earlier ([02c5af2](https://github.com/yukinarit/pyserde/commit/02c5af2))
* feat(numpy): Support serialization of numpy.datetime64 ([5e521cf](https://github.com/yukinarit/pyserde/commit/5e521cf))
* Don't import tests module from pyserde package ([d664426](https://github.com/yukinarit/pyserde/commit/d664426))
* fix: Recognized numpy arrays on Python 3.7, 3.8 ([a0fa36f](https://github.com/yukinarit/pyserde/commit/a0fa36f))
* fix(numpy): Fix direct numpy array deserialization ([8f9f71c](https://github.com/yukinarit/pyserde/commit/8f9f71c))
* ci: Remove pypy-3.8 until a numpy wheel is released for it ([61b6130](https://github.com/yukinarit/pyserde/commit/61b6130))
* chore: Update black, fix test_union formatting ([4a708fd](https://github.com/yukinarit/pyserde/commit/4a708fd))
* chore: Update numpy version specification based on numpy compatibility with python ([1fa5e07](https://github.com/yukinarit/pyserde/commit/1fa5e07))

This release had contributions from 2 people: [kmsquire](https://github.com/kmsquire) and [chagui](https://github.com/chagui). Thank you so much! :tada: :joy:

0.7.2

* Don't package tests and examples ([af829ae](https://github.com/yukinarit/pyserde/commit/af829ae)), closes [#214](https://github.com/yukinarit/pyserde/issues/214)
* ci: Use pypy-3.8 ([316b98e](https://github.com/yukinarit/pyserde/commit/316b98e))
* feat: Support PEP604 Union operator ([17419d2](https://github.com/yukinarit/pyserde/commit/17419d2))

This release had contributions from 1 person: [gitpushdashf](https://github.com/gitpushdashf). Thank you so much! :tada: :joy:

0.7.1

* ci: Run tests on pull_request only ([015cb41](https://github.com/yukinarit/pyserde/commit/015cb41))
* feat: Support typing.Generic ([e9f2bdb](https://github.com/yukinarit/pyserde/commit/e9f2bdb))
* build: Drop python 3.6 and pypy ([279f1a4](https://github.com/yukinarit/pyserde/commit/279f1a4))
* docs: Fix typo in docs introduction ([03f24da](https://github.com/yukinarit/pyserde/commit/03f24da))

This release had contributions from 1 person: [chagui](https://github.com/chagui). Thank you so much! :tada: :joy:

0.7.0

* fix: Optional in custom class deserializer ([181b2f1](https://github.com/yukinarit/pyserde/commit/181b2f1))
* fix: raise SerdeError from serde's APIs ([76b0aee](https://github.com/yukinarit/pyserde/commit/76b0aee))
* pyserde (de)serialize method used to raise various Exceptions such as KeyError. pyserde always raises SerdeError since v0.7.0
* core: using black formatting only if debug is enabled ([e596a84](https://github.com/yukinarit/pyserde/commit/e596a84))
* feat: Add _make_serialize and _make_deserialize ([a71c5d5](https://github.com/yukinarit/pyserde/commit/a71c5d5))
* feat: Implement Union tagging system ([c884dc4](https://github.com/yukinarit/pyserde/commit/c884dc4))
* This will change the default tagging for dataclasses with Union from `Untagged` to `ExternalTagging`. **This may break the existing code**, so please be aware if you use dataclasses with Union. For more information, check [the documentation](docs/features/union.md)
* build: Update mypy to workaround typed_ast error ([0ea33a7](https://github.com/yukinarit/pyserde/commit/0ea33a7))

This release had contributions from 1 person: [tardyp](https://github.com/tardyp). Thank you so much! :tada: :joy:

0.6.0

* feat: Add serde decorator ([523dc9c](https://github.com/yukinarit/pyserde/commit/523dc9c))
* feat: Add serde field function ([488bf00](https://github.com/yukinarit/pyserde/commit/488bf00))
* feat: Add serde_skip_default field attribute ([0f0b212](https://github.com/yukinarit/pyserde/commit/0f0b212))
* feat: Automatically put dataclass decorator ([2f0cf01](https://github.com/yukinarit/pyserde/commit/2f0cf01))

With `serde` decorator and `field` function, you can declare pyserde class more easily.

python
from serde import serde, field

serde
class Foo:
a : List[str] = field(default_factory=list, skip_if_false=True)


The declaration until v0.5.3 still works.

python
from dataclasses import dataclass
from serde import serialize, deserialize

deserialize
serialize
dataclass
class Foo:
a : List[str] = field(default_factory=list, metadata={'serde_skip_if_false': True})

Page 10 of 12

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.