Skip to content

Releases: yukinarit/pyserde

v0.17.0

25 May 05:39
fb284ef
Compare
Choose a tag to compare

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

Full Changelog: v0.16.1...v0.17.0

v0.16.1

29 Apr 01:19
cbf3639
Compare
Choose a tag to compare

What's Changed

Bug fixes

Build

Refactoring

Other changes

New Contributors

Full Changelog: v0.16.0...v0.16.1

v0.16.0

04 Apr 13:05
ad8c148
Compare
Choose a tag to compare

What's Changed

New features

CI

Build

Refactoring

Other changes

Full Changelog: v0.15.0...v0.16.0

v0.15.0

10 Mar 13:31
1ed0000
Compare
Choose a tag to compare

What's Changed

Bug fixes

Breaking changes

  • Don't implement beartype for dataclass without serde by @yukinarit in #487

Build

Test

New Contributors

Full Changelog: v0.14.2...v0.15.0

v0.14.2

09 Mar 14:38
f4ab380
Compare
Choose a tag to compare

What's Changed

Bug fixes

Full Changelog: v0.14.1...v0.14.2

v0.14.1

03 Mar 10:21
a517254
Compare
Choose a tag to compare

What's Changed

New features

  • skip conversion if the object is already the correct type by @uyha in #482

Documentation

New Contributors

  • @uyha made their first contribution in #482

Full Changelog: v0.14.0...v0.14.1

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