manim icon indicating copy to clipboard operation
manim copied to clipboard

[meta] Missing type system features

Open RBerga06 opened this issue 4 months ago • 0 comments

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 type Any).
    • 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 the Mobject and OpenGLMobject inheritance trees.
    • Required features:
      • Allowing extra items in TypedDict: PEP 728 has been accepted but we need:
        • support by mypy https://github.com/python/mypy/issues/18176
        • pyright support to stabilize (it's currently marked as experimental) https://github.com/microsoft/pyright/issues/10803
    • Optional features that would improve ergonomics/maintainability:
      • in-line TypedDict definitions: there's a draft PEP for this (PEP 764)
    • Notes: encountered in #4398, discussion on Discord.

Related work:

  • #3375

RBerga06 avatar Aug 17 '25 18:08 RBerga06