Releases: yukinarit/pyserde
v0.14.0
What's Changed
Breaking changes
- pyserde is powered by beartype by @yukinarit in #476
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
What's Changed
New features
- Allow bytes in from_json typing by @davetapley in #471
CI
- Update actions by @yukinarit in #473
New Contributors
- @davetapley made their first contribution in #471
Full Changelog: v0.13.1...v0.13.2
v0.13.1
What's Changed
Build
- Update pdoc to v14 by @yukinarit in #463
- Pin version of plum-dispatch as v2.3 breaks custom class serializer by @yukinarit in #470
Refactoring
- Fix more mypy type errors by @yukinarit in #465
Documentation
- Mention about pyserde-timedelta in README.md by @yukinarit in #461
Full Changelog: v0.13.0...v0.13.1
v0.13.0
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)
....
- Fix type error from field with attributes by @yukinarit in #458
- Implement new class (de)serializer by @yukinarit in #456
- Implement global (de)serializer by @yukinarit in #459
Build
- Drop python3.7 by @yukinarit in #460
Documentation
- Fix external union example in union.md by @yukinarit in #455
Full Changelog: v0.12.7...v0.13.0
v0.12.7
What's Changed
Refactoring
- Fix
skip_if
causing serialization of a recursive type to beO(2**n)
instead ofO(n)
by @gschaffner in #452
Other changes
- 👥 Add @gschaffner as a contributor by @yukinarit in #454
New Contributors
- @gschaffner made their first contribution in #452
Full Changelog: v0.12.6...v0.12.7
v0.12.6
What's Changed
Bug fixes
- Fix name 'Set' is not defined error by @maallaire in #445
Other changes
- 👥 Add @maallaire as a contributor by @yukinarit in #446
New Contributors
- @maallaire made their first contribution in #445
Full Changelog: v0.12.5...v0.12.6
v0.12.5
What's Changed
Bug fixes
- Fix serializing union with Any by @yukinarit in #441
Full Changelog: v0.12.4...v0.12.5
v0.12.4
What's Changed
Bug fixes
- Fix frozenset union with prim #437 by @acolley-gel in #438
Other changes
- 👥 Add @acolley-gel as a contributor by @yukinarit in #439
New Contributors
- @acolley-gel made their first contribution in #438
Full Changelog: v0.12.3...v0.12.4
v0.12.3
What's Changed
Bug fixes
- Fix alias of optional type by @yukinarit in #430
Refactoring
- Fix mypy/pyright errors in serde/se.py by @yukinarit in #420
- Fix mypy/pyright errors in serde/de.py by @yukinarit in #428
Test
- Add test of alias + rename_all by @yukinarit in #431
Full Changelog: v0.12.2...v0.12.3
v0.12.2
What's Changed
New features
Bug fixes
- Fix frozen dataclass inheritance by @yukinarit in #412
CI
- Add prerelease job to make sure version is correct by @yukinarit in #417
- Fix fetch-depth by @yukinarit in #419
Build
- Do not shallow clone when publishing to PyPI by @yukinarit in #416
Documentation
- Document dataclass
frozen
andkw_only
support by @yukinarit in #415
Other changes
- 👥 Add @m472 as a contributor by @yukinarit in #414
New Contributors
Full Changelog: v0.12.1...v0.12.2