Skip to content
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

Drop Python 2 support for typing_extensions #893

Merged
merged 1 commit into from Sep 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion .flake8
Expand Up @@ -14,5 +14,4 @@ ignore =
exclude =
# tests have more relaxed formatting rules
# and its own specific config in .flake8-tests
typing_extensions/src_py2/test_typing_extensions.py,
typing_extensions/src_py3/test_typing_extensions.py,
24 changes: 1 addition & 23 deletions .github/workflows/ci.yml
Expand Up @@ -8,28 +8,6 @@ permissions:
contents: read

jobs:
tests-27:
name: Run tests (2.7)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 2.7

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r test-requirements.txt

- name: Test typing_extensions
run: |
pip install typing
pytest typing_extensions/src_py2

tests:
name: Run tests

Expand Down Expand Up @@ -94,4 +72,4 @@ jobs:
run: flake8

- name: Lint tests
run: flake8 --config=.flake8-tests typing_extensions/src_py2/test_typing_extensions.py typing_extensions/src_py3/test_typing_extensions.py
run: flake8 --config=.flake8-tests typing_extensions/src_py3/test_typing_extensions.py
2 changes: 0 additions & 2 deletions typing_extensions/MANIFEST.in
@@ -1,5 +1,3 @@
include LICENSE README.rst
include src_py3/typing_extensions.py
include src_py3/test_typing_extensions.py
include src_py2/typing_extensions.py
include src_py2/test_typing_extensions.py
54 changes: 16 additions & 38 deletions typing_extensions/README.rst
Expand Up @@ -9,13 +9,7 @@ Typing Extensions
Overview
========

The ``typing`` module was added to the standard library in Python 3.5 on
a provisional basis and will no longer be provisional in Python 3.7. However,
this means users of Python 3.5 - 3.6 who are unable to upgrade will not be
able to take advantage of new types added to the ``typing`` module, such as
``typing.Text`` or ``typing.Coroutine``.

The ``typing_extensions`` module contains both backports of these changes
The ``typing_extensions`` module contains both backports of ``typing`` features
as well as experimental types that will eventually be added to the ``typing``
module, such as ``Protocol`` (see PEP 544 for details about protocols and
static duck typing) or ``TypedDict`` (see PEP 589).
Expand All @@ -30,11 +24,17 @@ Included items

This module currently contains the following:

All Python versions:
--------------------

- ``Annotated``
- ``AsyncContextManager``
- ``AsyncGenerator``
- ``AsyncIterable``
- ``AsyncIterator``
- ``Awaitable``
- ``ChainMap``
- ``ClassVar``
- ``Concatenate``
- ``ContextManager``
- ``Coroutine``
- ``Counter``
- ``DefaultDict``
- ``Deque``
Expand All @@ -45,38 +45,17 @@ All Python versions:
- ``NoReturn``
- ``overload`` (note that older versions of ``typing`` only let you use ``overload`` in stubs)
- ``OrderedDict``
- ``Protocol`` (except on Python 3.5.0)
- ``runtime_checkable`` (except on Python 3.5.0)
- ``ParamSpec``
- ``ParamSpecArgs``
- ``ParamSpecKwargs``
- ``Protocol``
- ``runtime_checkable``
- ``Text``
- ``Type``
- ``TypedDict``
- ``TypeAlias``
- ``TYPE_CHECKING``

Python 3.4+ only:
-----------------

- ``ChainMap``
- ``ParamSpec``
- ``Concatenate``
- ``ParamSpecArgs``
- ``ParamSpecKwargs``
- ``TypeGuard``

Python 3.5+ only:
-----------------

- ``Annotated`` (except on Python 3.5.0-3.5.2)
- ``AsyncIterable``
- ``AsyncIterator``
- ``AsyncContextManager``
- ``Awaitable``
- ``Coroutine``

Python 3.6+ only:
-----------------

- ``AsyncGenerator``
- ``TYPE_CHECKING``

Other Notes and Limitations
===========================
Expand All @@ -101,4 +80,3 @@ To run tests, navigate into the appropriate source directory and run
``test_typing_extensions.py``. You will also need to install the latest
version of ``typing`` if you are using a version of Python that does not
include ``typing`` as a part of the standard library.

16 changes: 4 additions & 12 deletions typing_extensions/setup.py
Expand Up @@ -4,8 +4,8 @@
import sys
from setuptools import setup

if sys.version_info < (2, 7, 0) or (3, 0, 0) <= sys.version_info < (3, 6, 0):
sys.stderr.write('ERROR: You need Python 2.7 or 3.6+ '
if sys.version_info < (3, 6, 0):
sys.stderr.write('ERROR: You need Python 3.6+ '
'to install typing_extensions.\n')
exit(1)

Expand All @@ -31,7 +31,6 @@
'Intended Audience :: Developers',
'License :: OSI Approved :: Python Software Foundation License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
Expand All @@ -40,13 +39,6 @@
'Topic :: Software Development',
]

if sys.version_info.major == 2:
package_dir = 'src_py2'
elif sys.version_info.major == 3:
package_dir = 'src_py3'
else:
raise AssertionError()

setup(name='typing_extensions',
version=version,
description=description,
Expand All @@ -57,7 +49,7 @@
license='PSF',
keywords='typing function annotations type hints hinting checking '
'checker typehints typehinting typechecking backport',
package_dir={'': package_dir},
package_dir={'': 'src_py3'},
py_modules=['typing_extensions'],
classifiers=classifiers,
install_requires=["typing >= 3.7.4; python_version < '3.5'"])
)