Releases: yukinarit/pyserde
v0.17.0
What's Changed
pyserde now experimentally support SQLAlchemy integration. Thanks @barsa-net for nice work!
@serde
class User(Base):
__tablename__ = "users"
id: Mapped[int] = mapped_column(primary_key=True)
name: Mapped[str] = mapped_column(Text, nullable=False)
fullname: Mapped[str] = mapped_column(Text, nullable=False)
nickname: Mapped[Optional[str]] = mapped_column(Text)
attributes: Mapped[Optional[dict[str, str]]] = mapped_column(JSON)
projects: Mapped[list[Project]] = relationship(backref="owner")
New features
- feat: add support for SQLAlchemy dataclass-mapped tables by @barsa-net in #518
Build
- Update coverage requirement from ==7.5.0 to ==7.5.1 by @dependabot in #523
- Update pre-commit requirement from ==v3.7.0 to ==v3.7.1 by @dependabot in #526
New Contributors
- @barsa-net made their first contribution in #518
Full Changelog: v0.16.1...v0.17.0
v0.16.1
What's Changed
Bug fixes
- Fix pathlib serialization by @yukinarit in #519
Build
- Update mypy requirement from ==1.9.0 to ==1.10.0 by @dependabot in #521
- Update coverage requirement from ==7.4.4 to ==7.5.0 by @dependabot in #520
Refactoring
- Refactor tests by @yukinarit in #510
Other changes
New Contributors
Full Changelog: v0.16.0...v0.16.1
v0.16.0
What's Changed
New features
- Raises SerdeError when type validation fails by @yukinarit in #504
CI
- Publish gh-pages when github release is made by @yukinarit in #507
Build
- Update coverage requirement from ==7.2.7 to ==7.4.3 by @dependabot in #499
- Update envclasses requirement from ^0.2.1 to ^0.3.1 by @dependabot in #500
- Update coverage requirement from ==7.4.3 to ==7.4.4 by @dependabot in #501
- Update black to 24.3.0 by @yukinarit in #502
- Custom validation error requires beartype 0.17 by @yukinarit in #506
- Update pre-commit requirement from ==v3.5.0 to ==v3.7.0 by @dependabot in #508
Refactoring
- Handle empty tuple more properly by @yukinarit in #509
Other changes
- Drop python 3.8 and use PEP585 entirely by @yukinarit in #503
- Use latest python feature in serde/examples by @yukinarit in #505
Full Changelog: v0.15.0...v0.16.0
v0.15.0
What's Changed
Bug fixes
Breaking changes
- Don't implement beartype for dataclass without serde by @yukinarit in #487
Build
- Create dependabot.yml by @yukinarit in #488
- Update dependabot.yml by @yukinarit in #489
- Bump codecov/codecov-action from 3 to 4 by @dependabot in #491
- Update pytest-xdist requirement from ^2.3.0 to ^3.5.0 by @dependabot in #493
- Update mypy requirement from ==1.8.0 to ==1.9.0 by @dependabot in #495
- Update more-itertools requirement from ~=8.6.0 to ~=10.2.0 by @dependabot in #496
- Update pre-commit requirement from ==v2.10.1 to ==v3.5.0 by @dependabot in #494
- Bump thollander/actions-comment-pull-request from 1.0.2 to 2.5.0 by @dependabot in #490
Test
- Fix mypy type errors in tests by @yukinarit in #497
New Contributors
- @dependabot made their first contribution in #491
- @rtbs-dev made their first contribution in #485
Full Changelog: v0.14.2...v0.15.0
v0.14.2
What's Changed
Bug fixes
- Fix reuse_instances for non dataclass objects by @yukinarit in #486
Full Changelog: v0.14.1...v0.14.2
v0.14.1
What's Changed
New features
Documentation
- Fix syntax error in type-check.md by @nicoddemus in #479
New Contributors
Full Changelog: v0.14.0...v0.14.1
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