≈ the.bay.news

Plain annotations for descriptor-backed fields (ORMs, dataclass_transform)

Discussions on Python.org
Plain annotations for descriptor-backed fields (ORMs, dataclass_transform)
Is there a way for a library to declare that plain field annotations on its models stand for descriptor-backed attributes, so that class access gets the descriptor’s type? I am looking for something checkers can interpret statically from a declaration. A type-checker plugin, generated stubs, or running metaclass code would not count. The problem I maintain alchemic (on PyPI), which combines SQLAlchemy and Pydantic models. Its model classes use dataclass_transform, and its columns are descriptor...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.