Skip to content

Releases: yukinarit/pyserde

v0.14.0

19 Feb 13:11
4227fb6
Compare
Choose a tag to compare

What's Changed

Breaking changes

pyserde's strict type check system is overhauled by using beartype - O(1) runtime type checker. all pyserde classes now implicitly implement beartype decorator by default. Passing wrong type of values in constructor raises beartype's validation error.

@serde
class Foo:
    s: str

If you call Foo with wrong type of object, beartype validation error is raised.

>>> foo = Foo(10)
beartype.roar.BeartypeCallHintParamViolation: Method __main__.Foo.__init__() 
parameter s=10 violates type hint <class 'str'>, as int 10 not instance of str.

If you deserialize with wrong value, serde error is raised.

>>> print(from_json(Foo, '{"s": 10}'))
serde.compat.SerdeError: Method __main__.Foo.__init__() 
parameter s=10 violates type hint <class 'str'>, as int 10 not instance of str.

If you want to disable type check, set either serde.disabled or serde.coerce in type_check class attribute.

from serde import serde, disabled

@serde(type_check=disabled)
class Foo:
    s: str

See https://yukinarit.github.io/pyserde/guide/en/type-check.html for more information.

Full Changelog: v0.13.2...v0.14.0

v0.13.2

12 Feb 04:09
2471217
Compare
Choose a tag to compare

What's Changed

New features

CI

New Contributors

Full Changelog: v0.13.1...v0.13.2

v0.13.1

02 Feb 13:11
0872640
Compare
Choose a tag to compare

What's Changed

Build

Refactoring

Documentation

Full Changelog: v0.13.0...v0.13.1

v0.13.0

07 Jan 12:36
10e660a
Compare
Choose a tag to compare

What's Changed

New features

New custom class (de)serializer allows to extend pyserde to support third party types in a neat and robust way. Also custom global (de)serializer is a game changer to allow sharing and reusing custom serializers across different python projects. See custom class serializer and custom global serializer for more information.

e.g. Implementing serializer for datetime and int

class Serializer:
    # Custom serializer for "datetime"
    @overload
    def serialize(self, value: datetime) -> str:
        return value.strftime("%d/%m/%y")

   # Custom serializer for "int"
   @overload
   def serialize(self, value: int) -> Any:
       return str(value)

   ....

Build

Documentation

Full Changelog: v0.12.7...v0.13.0

v0.12.7

17 Dec 03:16
b39d881
Compare
Choose a tag to compare

What's Changed

Refactoring

  • Fix skip_if causing serialization of a recursive type to be O(2**n) instead of O(n) by @gschaffner in #452

Other changes

New Contributors

Full Changelog: v0.12.6...v0.12.7

v0.12.6

28 Nov 05:19
7119be7
Compare
Choose a tag to compare

What's Changed

Bug fixes

Other changes

New Contributors

Full Changelog: v0.12.5...v0.12.6

v0.12.5

11 Nov 07:42
1cba1da
Compare
Choose a tag to compare

What's Changed

Bug fixes

Full Changelog: v0.12.4...v0.12.5

v0.12.4

25 Oct 02:08
76e919c
Compare
Choose a tag to compare

What's Changed

Bug fixes

Other changes

New Contributors

Full Changelog: v0.12.3...v0.12.4

v0.12.3

09 Oct 02:58
fead102
Compare
Choose a tag to compare

What's Changed

Bug fixes

Refactoring

Test

Full Changelog: v0.12.2...v0.12.3

v0.12.2

25 Jul 15:32
031f4c4
Compare
Choose a tag to compare

What's Changed

New features

  • Add support for dataclasses with kw_only by @m472 in #413

Bug fixes

CI

Build

Documentation

Other changes

New Contributors

  • @m472 made their first contribution in #413

Full Changelog: v0.12.1...v0.12.2