Use the _typeshed package in stub files
mainThe _typeshed package and its types are intended for use in stub (.pyi) files. These types do not exist at runtime. To avoid runtime errors when using these types in implementation (.py) files, you must wrap the import within a TYPE_CHECKING block.
To use types in annotations, you can either use string literals (quoting the type) or enable from __future__ import annotations at the top of your file.