Releases: yukinarit/pyserde
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
v0.12.1
What's Changed
Bug fixes
- Do not import optional modules in init.py by @yukinarit in #408
Refactoring
- Fix mypy/pyright errors in serde/core.py by @yukinarit in #406
Documentation
- Temporarily remove outdated benchmark doc by @yukinarit in #405
Full Changelog: v0.12.0...v0.12.1
v0.12.0
What's Changed
New features
- Union directly by @yukinarit in #339
This example works correctly now
@serde
@dataclass
class Foo:
a: int
@serde
@dataclass
class Bar:
a: int
bar = Bar(10)
s = to_json(bar)
print(s)
print(from_json(Union[Foo, Bar], s))
However, This will introduce a breaking change!! The default behaviour when you pass Union directly was "Untagged" until v0.11.1, but since v0.12.0 it is "ExternalTagging".
The following code prints {"a": 10}
until v0.11.1, but prints {"Bar": {"a": 10}}
since v0.12.0
print(to_json(bar))
For more information about Union, please see the docs
Refactoring
- Fix mypy/pyright errors in serde/inspect.py by @yukinarit in #401
- Fix mypy/pyright errors in serde/init.py by @yukinarit in #402
- Fix mypy/pyright errors in serde/compat.py by @yukinarit in #403
Other changes
- Change line length from 120 to 100 by @yukinarit in #391
Full Changelog: v0.11.1...v0.12.0
v0.11.1
What's Changed
New features
- Support (de)serialize a subclass of primitive type by @yukinarit in #388
Bug fixes
- Fix deserializing from incompatible value e.g. None by @yukinarit in #389
Refactoring
- Make serde.core.Field a generic type by @yukinarit in #385
- Fix a bit more mypy error by @yukinarit in #387
Other changes
- Update links on README.md by @yukinarit in #384
- Update field-attributes.md by @gpetrovic-meltin in #386
- 👥 Add @gpetrovic-meltin as a contributor by @yukinarit in #390
New Contributors
- @gpetrovic-meltin made their first contribution in #386
Full Changelog: v0.11.0...v0.11.1