Earlier quoted context omitted.
You can create Python types at runtime, and Python’s runtime type checking features predate it's static analyzers. Unfortunately, the additional kinds of objects used for typechecking in the static analyzers (beyond those which are also runtime types) don’t work with runtime type checking, nor do static type declarations (even using types that are also runtime types.) (And, obviously, AOT static analyzers can’t make…
I have also written a python ORM, Bozen[1]. In Bozen you define a table like this: class Book(MonDoc): title = StrField() yearPublished = IntField() Is it possible to give run-time types to `title` and `yearPublished`, in a way that works with mypy and the Python typing ecosystem? If so, is there a tutorial on this, as I'd like to add the feature to my ORM. 1: https://github.com/cabalamat/frambozenapp
class Book(MonDoc):
title: str = StrField()
yearPublished: int = IntField()
If this means too much redundant information for you then you could try defining the fields to return the corresponding python type e.g. def IntField() -> int:
...