Skip to content

Move Protocol, runtime_checkable, Final, final, Literal, and TypedDict to typing #649

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jun 17, 2019

Conversation

ilevkivskyi
Copy link
Member

@ilevkivskyi ilevkivskyi commented Jun 17, 2019

Fixes #648

This essentially just moves a bunch of code and tests from Python 2 version of typing_extensions to Python 2 version of typing. We don't need to copy the definitions in the former, and can just re-export them from typing, since there is not built-in typing module on Python 2, so that we can always assume the latest version of typing (we will just need to release them in right order, typing first, and then update dependency in typing_extensions).

Notable changes apart from the code move:

  • Like on Python 3, keep runtime in typing_extensions as an alias for runtime_checkable for backwards compatibility (the former is not included in __all__)
  • Update GenericMeta.__new__ and GenericMeta.__getitem__ instead of almost identical overrides in _ProtocolMeta.

@ilevkivskyi ilevkivskyi requested a review from gvanrossum June 17, 2019 02:16
@gvanrossum
Copy link
Member

Where's the dependency on a version of typing.py specified in typing_extensions?

@ilevkivskyi
Copy link
Member Author

Where's the dependency on a version of typing.py specified in typing_extensions?

In typing_extensions/setup.py.

@ilevkivskyi
Copy link
Member Author

install_requires = []
if sys.version_info < (3, 5):
    install_requires.append('typing >= 3.6.2')

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skimmed, LG.

@ilevkivskyi ilevkivskyi merged commit 537a104 into python:master Jun 17, 2019
@ilevkivskyi ilevkivskyi deleted the move-python-2 branch June 17, 2019 16:32
@ilevkivskyi ilevkivskyi mentioned this pull request Jun 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Protocol, runtime_checkable, Final, final, Literal, and TypedDict to typing on Python 2
3 participants