current_auth is now intended to be subclassed by apps so they can specify types for the actor and user attributes.
StateManager now accepts an Enum instead of a LabeledEnum (partially).
RoleMixin is now a generic on the actor type. Unfortunately this interferes with IdMixin's generic arg, so any class that specifies UUID pkey type must also explicitly list the actor type, and conversely when specifying the actor on a table with an int pkey, int must be explicitly specified. Where both are unspecified, it defaults to int pkey and Any actor:
BaseMixin is the same as BaseMixin[int, Any].
BaseMixin[UUID] is now an error as the second arg is missing. PEP 696 explicitly allows this, but the PEP is a draft and implementations are incomplete.
BaseMixin[..., ActorType] is not an option as defaults can only be specified at the end. BaseMixin[int, ActorType] should be used to get the (previously default) int pkey.
To workaround a Mypy bug (https://github.com/python/mypy/issues/16709), all uses of declared_attr now avoid the standard decorator convention and define it as an attribute. Unfortunately, this seems to trigger a Pyright bug in Protocols where it types the declared_attr on the basis of declared_attr.__get__'s union return type, instead of matching the context (class-level or instance-level access). A bug report is pending. We use Mypy in CI and pre-commit checks but not Pyright, so the Pyright bug is not a blocker.
current_auth
is now intended to be subclassed by apps so they can specify types for theactor
anduser
attributes.StateManager
now accepts an Enum instead of a LabeledEnum (partially).RoleMixin
is now a generic on the actor type. Unfortunately this interferes withIdMixin
's generic arg, so any class that specifiesUUID
pkey type must also explicitly list the actor type, and conversely when specifying the actor on a table with an int pkey,int
must be explicitly specified. Where both are unspecified, it defaults toint
pkey andAny
actor:BaseMixin
is the same asBaseMixin[int, Any]
.BaseMixin[UUID]
is now an error as the second arg is missing. PEP 696 explicitly allows this, but the PEP is a draft and implementations are incomplete.BaseMixin[..., ActorType]
is not an option as defaults can only be specified at the end.BaseMixin[int, ActorType]
should be used to get the (previously default)int
pkey.declared_attr
now avoid the standard decorator convention and define it as an attribute. Unfortunately, this seems to trigger a Pyright bug in Protocols where it types thedeclared_attr
on the basis ofdeclared_attr.__get__
's union return type, instead of matching the context (class-level or instance-level access). A bug report is pending. We use Mypy in CI and pre-commit checks but not Pyright, so the Pyright bug is not a blocker.