Closed ASEM000 closed 1 year ago
Implemented custom lightweight dataclasses
-like alternative with the following differences
pytc.field(pos_only=..., )
to mark positional-only args. (since min perversion is 3.8 )pytc.field(callbacks=[ ... ])
to call a sequence of functions (e.g., validation/converters) after initialization if init=True
or after post initialization if init=False
list,dict,set
as mutable ( prime motivation) see:
pytc.field
implements def field(
*,
default: Any | _NOT_SET = _NOT_SET,
default_factory: Callable | None = None,
init: bool = True,
repr: bool = True,
kw_only: bool = False,
pos_only: bool = False,
metadata: dict | None = None,
callbacks: Sequence[Callable] | None = None,
):
deprecate the usage of data classes from v0.2, preferably implementing a minimal version of data classes. (i.e. only init generation for our case).
See: https://github.com/google/jax/issues/14295