-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Open
Description
This issue attempts to collect and document missing or upcoming type system features that would be necessary to better type the public library interface, as well as mypy bugs preventing us to make use of existing features.
- Function (and method)
**kwargs
To correctly and extensively type**kwargs
, we would need at the very least the ability to tell type checkers that additional keyword arguments are allowed (and of typeAny
).- Current status:
The codebase is currently typed with**kwargs: Any
, but this disallows IDEs from discovering extra keyword arguments that are forwarded to other functions. For example, this is a very common pattern across theMobject
andOpenGLMobject
inheritance trees. - Required features:
- Allowing extra items in
TypedDict
: PEP 728 has been accepted but we need:- support by mypy Add support for TypedDict extra_items= and closed= (PEP 728) python/mypy#18176
- pyright support to stabilize (it's currently marked as experimental) Make PEP 728 no longer experimental microsoft/pyright#10803
- Allowing extra items in
- Optional features that would improve ergonomics/maintainability:
- in-line
TypedDict
definitions: there's a draft PEP for this (PEP 764)
- in-line
- Notes: encountered in Add type annotations to
opengl_mobject.py
#4398, discussion on Discord.
- Current status:
Related work:
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
🆕 New