Skip to content

Commit d298120

Browse files
authored
typing_extensions: Drop Python 2.7, modernize build (#931)
* Drop Python 2.7 support -- tests, linting * Adopt pyproject.toml and a build backend (flit) * Add Python 3.7+ types to README.rst
1 parent 7d797ba commit d298120

File tree

8 files changed

+86
-78
lines changed

8 files changed

+86
-78
lines changed

.flake8

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
[flake8]
22

3-
# fake builtins for python2/*
4-
builtins = basestring, unicode
53
max-line-length = 90
64
ignore =
75
# irrelevant plugins

.flake8-tests

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
# This will be possibly merged in the future.
77

88
[flake8]
9-
# fake builtins for python2/*
10-
builtins = basestring, unicode
119
max-line-length = 100
1210
ignore =
1311
# temporary ignores until we sort it out

CONTRIBUTING.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ standard library, so that users can experiment with them before they are added t
1818
standard library. Such features should ideally already be specified in a PEP or draft
1919
PEP.
2020

21-
`typing_extensions` supports Python versions 3.6 an up.
21+
`typing_extensions` supports Python versions 3.6 and up.
2222

2323
# Versioning scheme
2424

@@ -30,17 +30,14 @@ backwards-incompatible changes.
3030

3131
- Ensure that GitHub Actions reports no errors.
3232

33-
- Update the version number in `setup.py`.
33+
- Update the version number in `pyproject.toml`.
3434

3535
- Build the source and wheel distributions:
3636

37-
- `pip3 install -U setuptools wheel`
38-
- `pip2 install -U setuptools wheel`
39-
- `rm -rf dist/ build/`
40-
- `python3 setup.py sdist bdist_wheel`
41-
- `rm -rf build/` (Works around
42-
`a Wheel bug <https://bitbucket.org/pypa/wheel/issues/147/bdist_wheel-should-start-by-cleaning-up>`\_)
43-
- `python2 setup.py bdist_wheel`
37+
- `pip3 install -U flit`
38+
- `cd typing_extensions`
39+
- `rm -rf dist/`
40+
- `flit build --no-setup-py`
4441

4542
- Install the built distributions locally and test (if you were using `tox`, you already
4643
tested the source distribution).

test-requirements.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
flake8; python_version >= '3.6'
2-
flake8-bugbear; python_version >= '3.6'
3-
flake8-pyi; python_version >= '3.6'
4-
pytest==4.6.11; python_version < '3.0'
5-
pytest; python_version >= '3.0'
1+
flake8
2+
flake8-bugbear
3+
flake8-pyi
4+
pytest

typing_extensions/README.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ This module currently contains the following:
5050
- ``Literal``
5151
- ``NewType``
5252
- ``NoReturn``
53-
- ``overload`` (note that older versions of ``typing`` only let you use ``overload`` in stubs)
53+
- ``overload``
5454
- ``OrderedDict``
5555
- ``ParamSpec``
5656
- ``ParamSpecArgs``
@@ -64,6 +64,14 @@ This module currently contains the following:
6464
- ``TypeGuard``
6565
- ``TYPE_CHECKING``
6666

67+
Python 3.7+
68+
-----------
69+
70+
- ``get_origin``
71+
- ``get_args``
72+
- ``get_type_hints``
73+
74+
6775
Other Notes and Limitations
6876
===========================
6977

typing_extensions/pyproject.toml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Build system requirements.
2+
[build-system]
3+
requires = ["flit_core >=3.4,<4"]
4+
build-backend = "flit_core.buildapi"
5+
6+
# Project metadata
7+
[project]
8+
name = "typing_extensions"
9+
version = "4.0.0-pre"
10+
description = "Backported and Experimental Type Hints for Python 3.6+"
11+
readme.text = """\
12+
Typing Extensions -- Backported and Experimental Type Hints for Python
13+
14+
The ``typing`` module was added to the standard library in Python 3.5, but
15+
many new features have been added to the module since then.
16+
This means users of older Python versions who are unable to upgrade will not be
17+
able to take advantage of new types added to the ``typing`` module, such as
18+
``typing.Protocol`` or ``typing.TypedDict``.
19+
20+
The ``typing_extensions`` module contains backports of these changes.
21+
Experimental types that may eventually be added to the ``typing``
22+
module are also included in ``typing_extensions``.
23+
"""
24+
readme.content-type = "text/x-rst"
25+
requires-python = ">=3.6"
26+
urls.Home = "https://github.com/python/typing/blob/master/typing_extensions/README.rst"
27+
license.file = "LICENSE"
28+
keywords = [
29+
"annotations",
30+
"backport",
31+
"checker",
32+
"checking",
33+
"function",
34+
"hinting",
35+
"hints",
36+
"type",
37+
"typechecking",
38+
"typehinting",
39+
"typehints",
40+
"typing"
41+
]
42+
# Classifiers list: https://pypi.org/classifiers/
43+
classifiers = [
44+
"Development Status :: 3 - Alpha",
45+
"Environment :: Console",
46+
"Intended Audience :: Developers",
47+
"License :: OSI Approved :: Python Software Foundation License",
48+
"Operating System :: OS Independent",
49+
"Programming Language :: Python :: 3",
50+
"Programming Language :: Python :: 3 :: Only",
51+
"Programming Language :: Python :: 3.6",
52+
"Programming Language :: Python :: 3.7",
53+
"Programming Language :: Python :: 3.8",
54+
"Programming Language :: Python :: 3.9",
55+
"Programming Language :: Python :: 3.10",
56+
"Topic :: Software Development"
57+
]
58+
59+
# Project metadata -- authors. Flit stores this as a list of dicts, so it can't
60+
# be inline above.
61+
[[project.authors]]
62+
name = "Guido van Rossum, Jukka Lehtosalo, Łukasz Langa, Michael Lee"
63+
email = "levkivskyi@gmail.com"
64+
65+
# This tells Flit that the module is stored in the src_py3 directory.
66+
[tool.flit.module]
67+
name = "src_py3/typing_extensions"

typing_extensions/setup.cfg

Lines changed: 0 additions & 6 deletions
This file was deleted.

typing_extensions/setup.py

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)