Skip to content

Deprecate mypy_extensions.TypedDict? #46

@AlexWaygood

Description

@AlexWaygood

mypy_extensions.TypedDict is problematic for several reasons:

  • mypy_extensions.TypedDict is missing quite a few features that have been added to typing.TypedDict at runtime (and have been backported to typing_extensions.TypedDict).
  • I think the existence of both mypy_extensions.TypedDict and typing_extensions.TypedDict has the potential to be pretty confusing for users.
  • It's quite annoying and error-prone that at typeshed, we have to remember to keep typing._TypedDict, typing_extensions._TypedDict and mypy_extensions._TypedDict all in sync. Unfortunately, we can't put them all in _typeshed and have all three modules import _TypedDict from _typeshed, as the three classes all have slightly subtle differences. (E.g. mypy_extensions._TypedDict doesn't have the __required_keys__ and __optional_keys__ ClassVars that both typing._TypedDict and typing_extensions._TypedDict have.)
  • Mypy now maintains its own copy of the mypy-extensions stubs anyway, so its stubs for mypy_extensions are no longer automatically updated with each typeshed sync. That means that even if we update the stubs for mypy_extensions.TypedDict in typeshed (as we did in Improve __(r)or__ signatures for TypedDict classes typeshed#10565), those updates are no longer of any benefit to mypy users unless mypy maintainers remember to copy across the changes to their forked version of the mypy_extensions stubs.

I propose that we deprecate mypy_extensions.TypedDict, and steer people towards typing_extensions.TypedDict instead: it's up-to-date with the features on typing.TypedDict, it's much more comprehensively tested, and it has up-to-date stubs.

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions