Skip to content

Commit

Permalink
Drop support for Python 3.6, part 1
Browse files Browse the repository at this point in the history
* Document that typeshed support 3.7+.
* Don't run tests on Python 3.6.
* Remove Python 3.6 allow lists.
* Merge common allowlist items.

Part of python#6189
  • Loading branch information
srittau committed Jul 6, 2022
1 parent b941cff commit f51206e
Show file tree
Hide file tree
Showing 27 changed files with 51 additions and 411 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
matrix:
# macos-11 does not have tcl/tk installed, needed for stubtesting tkinter
os: ["ubuntu-latest", "windows-latest", "macos-10.15"]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11-dev"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11-dev"]
fail-fast: false

steps:
Expand Down Expand Up @@ -49,7 +49,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: "3.9"
- name: Install dependencies
run: pip install $(grep tomli== requirements-tests.txt) termcolor
- name: Install apt packages
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stubtest_stdlib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
matrix:
# macos-11 does not have tcl/tk installed, needed for stubtesting tkinter
os: ["ubuntu-latest", "windows-latest", "macos-10.15"]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11-dev"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11-dev"]
fail-fast: false

steps:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
strategy:
matrix:
platform: ["linux", "win32", "darwin"]
python-version: ["2.7", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["2.7", "3.7", "3.8", "3.9", "3.10", "3.11"]
fail-fast: false
steps:
- uses: actions/checkout@v3
Expand All @@ -82,7 +82,7 @@ jobs:
strategy:
matrix:
python-platform: ["Linux", "Windows", "Darwin"]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
fail-fast: false
env:
PYRIGHT_VERSION: 1.1.255 # Must match pyright_test.py.
Expand Down Expand Up @@ -112,7 +112,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: "3.9"
- name: Install dependencies
run: pip install $(grep tomli== requirements-tests.txt) termcolor
- name: Run stubtest
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ contributors can be found in [CONTRIBUTING.md](CONTRIBUTING.md). **Please read
it before submitting pull requests; do not report issues with annotations to
the project the stubs are for, but instead report them here to typeshed.**

Typeshed supports Python versions 2.7 and 3.6 and up.
Typeshed supports Python versions 2.7 and 3.7 and up.

## Using

Expand Down
2 changes: 1 addition & 1 deletion tests/mypy_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import tomli
from colors import colored, print_error, print_success_msg

SUPPORTED_VERSIONS = [(3, 11), (3, 10), (3, 9), (3, 8), (3, 7), (3, 6), (2, 7)]
SUPPORTED_VERSIONS = [(3, 11), (3, 10), (3, 9), (3, 8), (3, 7), (2, 7)]
SUPPORTED_PLATFORMS = frozenset({"linux", "win32", "darwin"})
TYPESHED_DIRECTORIES = frozenset({"stdlib", "stubs", "tests", "test_cases", "scripts"})

Expand Down
1 change: 0 additions & 1 deletion tests/stubtest_allowlists/darwin-py310.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
_?curses.A_ITALIC
_?curses.color_pair
webbrowser.MacOSXOSAScript.__init__
distutils.util.__warningregistry__
Expand Down
1 change: 0 additions & 1 deletion tests/stubtest_allowlists/darwin-py311.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
_?curses.A_ITALIC
_?curses.color_pair
xxlimited.Xxo.x_exports
distutils.util.__warningregistry__
Expand Down
20 changes: 0 additions & 20 deletions tests/stubtest_allowlists/darwin-py36.txt

This file was deleted.

1 change: 0 additions & 1 deletion tests/stubtest_allowlists/darwin-py37.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
_?curses.A_ITALIC
ctypes.wintypes
pwd.getpwnam
webbrowser.MacOSXOSAScript.__init__
Expand Down
1 change: 0 additions & 1 deletion tests/stubtest_allowlists/darwin-py38.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
_?curses.A_ITALIC
webbrowser.MacOSXOSAScript.__init__

# ==========
Expand Down
1 change: 0 additions & 1 deletion tests/stubtest_allowlists/darwin-py39.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
_?curses.A_ITALIC
webbrowser.MacOSXOSAScript.__init__

# ==========
Expand Down
2 changes: 2 additions & 0 deletions tests/stubtest_allowlists/darwin.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
_?curses.A_ITALIC

_posixsubprocess.cloexec_pipe
os.EX_NOTFOUND
os.SF_MNOWAIT
Expand Down
17 changes: 0 additions & 17 deletions tests/stubtest_allowlists/linux-py36.txt

This file was deleted.

22 changes: 0 additions & 22 deletions tests/stubtest_allowlists/py310.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,14 @@ _collections_abc.ValuesView.__reversed__
_weakref.ProxyType.__reversed__ # Doesn't really exist
asyncio.Future.__init__ # Usually initialized from c object
asyncio.futures.Future.__init__ # Usually initialized from c object
builtins.dict.get
builtins.float.__setformat__ # Internal method for CPython test suite
builtins.property.__set_name__ # Doesn't actually exist
contextlib.AbstractAsyncContextManager.__class_getitem__
contextlib.AbstractContextManager.__class_getitem__
enum.Enum._generate_next_value_
fractions.Fraction.__new__ # overload is too complicated for stubtest to resolve
gettext.install
gettext.translation
hmac.new # Stub is a white lie; see comments in the stub
http.server.SimpleHTTPRequestHandler.__init__ # *args is expanded
ipaddress.IPv4Interface.hostmask
ipaddress.IPv6Interface.hostmask
ipaddress._BaseNetwork.broadcast_address
Expand All @@ -31,15 +28,13 @@ platform.uname_result.__match_args__
platform.uname_result.__new__
platform.uname_result._fields
platform.uname_result.processor
re.Pattern.scanner # Undocumented and not useful. #6405
sys.UnraisableHookArgs # Not exported from sys
tkinter.Tk.split
types.GenericAlias.__getattr__
types.GenericAlias.__mro_entries__
types.GenericAlias.__call__ # Would be complicated to fix properly, Any could silence problems. #6392
typing._SpecialForm.__mro_entries__
typing.ForwardRef._evaluate
typing._SpecialForm.__init__
typing._TypedDict.__delitem__
typing._TypedDict.__ior__
typing._TypedDict.__or__
Expand Down Expand Up @@ -76,9 +71,6 @@ _csv.Reader
_csv.Writer
asynchat.__warningregistry__ # Removal planned for 3.12, can add if someone needs this
bdb.Breakpoint.clearBreakpoints
distutils.dist.DistributionMetadata.set_classifiers
distutils.dist.DistributionMetadata.set_keywords
distutils.dist.DistributionMetadata.set_platforms
distutils.util.get_host_platform
functools.partial.__vectorcalloffset__ # undocumented implementation detail
inspect.Signature.from_builtin # Removed in 3.11, can add if someone needs this
Expand All @@ -89,7 +81,6 @@ multiprocessing.managers.SharedMemoryServer.public
multiprocessing.managers.SharedMemoryServer.release_segment
multiprocessing.managers.SharedMemoryServer.shutdown
multiprocessing.managers.SharedMemoryServer.track_segment
typing._SpecialForm.__call__

# ==========
# Related to positional-only arguments
Expand Down Expand Up @@ -152,7 +143,6 @@ ast.Index.__new__
ast.NameConstant.__new__
ast.Num.__new__
ast.Str.__new__
contextvars.Context.__init__
queue.SimpleQueue.__init__
xml.etree.ElementTree.XMLParser.__init__
xml.etree.cElementTree.XMLParser.__init__
Expand All @@ -172,21 +162,9 @@ typing.SupportsRound.__init__

ftplib.FTP.trust_server_pasv_ipv4_address # Dangerous to use, intentionally undocumented, intentionally missing from typeshed. #6154
os.PathLike.__class_getitem__ # PathLike is a protocol; we don't expect all PathLike classes to implement class_getitem
ssl.PROTOCOL_SSLv3 # Depends on ssl compilation
ssl.RAND_egd # Depends on openssl compilation
types.CodeType.replace # stubtest thinks default values are None but None doesn't work at runtime
_ast.ImportFrom.level # None on the class, but never None on instances
ast.ImportFrom.level # None on the class, but never None on instances

# These enums derive from (str, Enum). See comment in py3_common.txt
pstats.SortKey.__new__
tkinter.EventType.__new__

# White lies around defaults
dataclasses.field
dataclasses.KW_ONLY

# Runtime signature is incorrect (https://github.com/python/cpython/issues/93021)
types.ClassMethodDescriptorType.__get__
types.MethodDescriptorType.__get__
types.WrapperDescriptorType.__get__
22 changes: 0 additions & 22 deletions tests/stubtest_allowlists/py311.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,9 @@ _operator.attrgetter.__vectorcalloffset__
_operator.itemgetter.__vectorcalloffset__
argparse._MutuallyExclusiveGroup.add_mutually_exclusive_group
asynchat.__warningregistry__ # Removal planned for 3.12, can add if someone needs this
builtins.dict.get
configparser.LegacyInterpolation.__init__
contextvars.Context.__init__
distutils.dist.DistributionMetadata.set_classifiers
distutils.dist.DistributionMetadata.set_keywords
distutils.dist.DistributionMetadata.set_platforms
distutils.util.get_host_platform
enum.Enum.__init__
enum.Enum._generate_next_value_
fractions.Fraction.__new__ # overload is too complicated for stubtest to resolve
ftplib.FTP.trust_server_pasv_ipv4_address
functools.partial.__vectorcalloffset__
Expand Down Expand Up @@ -107,9 +101,7 @@ builtins.property.__set_name__ # Doesn't actually exist
enum.StrEnum.value # read-only property at runtime but too magical for stubtest
hmac.new # Stub is a white lie; see comments in the stub
http.HTTPMethod.description # mutable instance attribute at runtime but we pretend it's a property
http.server.SimpleHTTPRequestHandler.__init__ # *args is expanded
pickle.Pickler.reducer_override # implemented in C pickler
re.Pattern.scanner # Undocumented and not useful. #6405
types.GenericAlias.__call__ # Would be complicated to fix properly, Any could silence problems. #6392
types.GenericAlias.__getattr__
types.GenericAlias.__mro_entries__
Expand Down Expand Up @@ -152,24 +144,16 @@ xml.etree.ElementTree.XMLParser.__init__
xml.etree.cElementTree.XMLParser.__init__

os.PathLike.__class_getitem__ # PathLike is a protocol; we don't expect all PathLike classes to implement class_getitem
ssl.PROTOCOL_SSLv3 # Depends on ssl compilation
ssl.RAND_egd # Depends on openssl compilation
types.CodeType.replace # stubtest thinks default values are None but None doesn't work at runtime
_ast.ImportFrom.level # None on the class, but never None on instances
ast.ImportFrom.level # None on the class, but never None on instances

# These enums derive from (str, Enum). See comment in py3_common.txt
pstats.SortKey.__new__
tkinter.EventType.__new__

# Treated an alias of a typing class in the stubs,
# they are generic to type checkers anyway.
contextlib.AbstractAsyncContextManager.__class_getitem__
contextlib.AbstractContextManager.__class_getitem__

# Super-special typing primitives
typing._SpecialForm.__call__
typing._SpecialForm.__init__
typing._SpecialForm.__mro_entries__
typing._TypedDict.__delitem__
typing._TypedDict.__ior__
Expand All @@ -184,7 +168,6 @@ typing._TypedDict.values

# White lies around defaults
dataclasses.KW_ONLY
dataclasses.field

# https://github.com/python/mypy/issues/12819 (... in runtime default)
wsgiref.types.InputStream.read
Expand All @@ -198,8 +181,3 @@ wsgiref.types.WSGIApplication

# Really it's mad about dict.get
wsgiref.types.WSGIEnvironment.get

# Runtime signature is incorrect (https://github.com/python/cpython/issues/93021)
types.ClassMethodDescriptorType.__get__
types.MethodDescriptorType.__get__
types.WrapperDescriptorType.__get__

0 comments on commit f51206e

Please sign in to comment.