Skip to content

Releases: yukinarit/pyserde

v0.5.0

30 Sep 12:46
b62e751
Compare
Choose a tag to compare
@deserialize
@serialize
@dataclass
class Bar:
    c: float
    d: bool

@deserialize
@serialize
@dataclass
class Foo:
    a: int
    b: str
    bar: Bar = field(metadata={'serde_flatten': True})

This release had contributions from 1 person: @alexmisk. Thank you so much! 🎉 😂

v0.4.0

17 Jun 11:42
f4b97dc
Compare
Choose a tag to compare
  • feat: add support for lazy annotations PEP563 (#112) (f7f6996), closes #112
from __future__ import annotations
from dataclasses import dataclass
from serde import deserialize, serialize

@deserialize
@serialize
@dataclass
class Foo:
    i: int
    s: str
    f: float
    b: bool

    def foo(self, cls: Foo):  # You can use "Foo" type before it's defined.
        print('foo')
  • feat: Implement custom class (de)serializer (3484d46)
  • feat: Implement custom field (de)serializer (14b791c)
def serializer(cls, o):
    ...

def deserializer(cls, o):
    ...

@deserialize(deserializer=deserializer)
@serialize(serializer=serializer)
@dataclass
class Foo:
    i: int
    # Class serializer/deserializer is used as default.
    dt1: datetime
    # Override by field serializer/deserializer.
    dt2: datetime = field(
        metadata={
            'serde_serializer': lambda x: x.strftime('%y.%m.%d'),
            'serde_deserializer': lambda x: datetime.strptime(x, '%y.%m.%d'),
        }
    )
  • feat: Improve error description for union type (8abb549)
  • feat: Improve serde.inspect (8b8635a)
  • feat: Support typing.any (988a621)
  • feat: Support typing.NewType for primitives (731ed79)
  • refactor: Add lvalue renderer for serialization (665dc77)
  • refactor: Remove arg template filter from se.py (0377655)
  • refactor: Remove self class from scope (da81f1f)
  • refactor: Rename custom (de)serializer attributes (03b2274)
  • ci: Add python 3.10-dev to CI pipeline (1f33e59)
  • ci: Don't cache pip to workaround pip error (c912429)
  • build: add pre-commit to test requirements (a88ea40)
  • fix: correctly render single element tuples (a8a6456)
  • fix: pass convert_sets argument to union functions (ab40cc9)
  • fix: support unions with nested unions in containers (#113) (c26e828), closes #113

v0.3.2

07 May 14:17
f6a36ba
Compare
Choose a tag to compare
  • feat: Improve error description for union type (8abb549)
  • feat: Improve serde.inspect (8b8635a)
  • feat: Support typing.any (988a621)
  • feat: Support typing.NewType for primitives (731ed79)
  • build: add pre-commit to test requirements (a88ea40)
  • fix: correctly render single element tuples (a8a6456)
  • fix: pass convert_sets argument to union functions (ab40cc9)
  • fix: support unions with nested unions in containers (#113) (c26e828), closes #113
  • ci: Don't cache pip to workaround pip error (c912429)
  • refactor: Remove self class from scope (da81f1f)

This release had contibutions from 1 person: @ydylla. Thank you so much! 🎉 😂

v0.3.1

21 Mar 13:20
bd319ca
Compare
Choose a tag to compare
  • fix: Add type annotation to serde decorators (f885a27)

You can get the code completion from the class with serialize and deserialize decorators. I would recommend everyone to upgrade to v0.3.1.

v0.3.0

20 Mar 14:57
bed1d8f
Compare
Choose a tag to compare
  • feat: Support PEP585 type hint annotation (81d3f4f)
    @deserialize
    @serialize
    @dataclass
    class Foo:
        l: list[str]
        t: tuple[str, bool]
        d: dict[str, list[int]]
  • feat: add support for typing.Set & set (20a4cdc)
  • feat: add more types & use code generation (d352d2d)
    • IPv4Address, IPv6Address, IPv4Network, IPv6Network, IPv4Interface, IPv6Interface
    • PosixPath, WindowsPath, PurePath, PurePosixPath, PureWindowsPath
    • UUID
  • feat: add convert_sets option required for to_json & to_msgpack (f954586)
  • feat: add union support for complex types (434edf6)
    @deserialize
    @serialize
    @dataclass
    class Foo:
        v: Union[int, str]
        c: Union[Dict[str, int], List[int]]
  • fix: Ellipsis overwriting configured default for reuse_instances (b0366e5)
  • fix: forward reuse_instances & fix call order for optionals (c56128c)
  • fix: compatibility with python 3.6 (7ae87b4)
  • fix: this pytest option does not exist #58 (c5938da), closes #58
  • fix: scope should not be shared between classes (889ada1)
  • fix: use iter_unions to recursively collect all unions of dataclass (577aeb9)
  • build: Add PEP561 py.typed marker file (c0f46b9)
  • build: Don't install dataclasses for python>3.6 (f47caa9)
  • build: setup pre-commit as formatting tool (2876de4)
  • ci: add code style check (c52f7e9)

This release had contibutions from 2 people: @ydylla, @alexmisk. Thank you so much! 🎉 😂