Skip to content

Releases: rednafi/exert

v0.3.3

26 Oct 19:24
ebc301b
Compare
Choose a tag to compare
  • Publish Python 3.11 wheels.

v0.3.1

04 May 19:38
Compare
Choose a tag to compare
  • Compile the library into native code with the help of mypyc.
  • Build the wheels with cibuildwheel.
  • The c extension makes attribute access a tiny bit faster.

v0.3.0

02 May 00:50
Compare
Choose a tag to compare
  • Redesign the public API to be compatible with other bespoke tools that might be working on the same class.
  • To apply a converter, now, you'll have to wrap it with Mark. Otherwise, it'll be ignored. Credit to @adriangb.
from __future__ import annotations

from typing import Annotated
from exert import exert, Mark
from dataclasses import dataclass

@exert(converters=(str, ), apply_last=True)
@dataclass
class Foo:
    a: Annotated[int, Mark(lambda x: x**2)]  # First the marked converter and then the common converter will be applied.
    b: Annotated[float,  lambda x: x / 2]  # Only the common converter `str` will be applied.
    c: int # No conversion will happen here.


foo = Foo(2, 42.0, 22)

print(foo.a) # prints '4'. [2**2=4, str(4)='4']
print(foo.b) # prints '42' [str(42.0) = '42.0']
print(foo.c) # prints 22 

v0.2.3

23 Apr 23:34
Compare
Choose a tag to compare

First working version.