From ec402ea56474344c51b0827b1133654737f50404 Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Fri, 30 Oct 2020 13:57:36 -0400 Subject: [PATCH] Drop support for python 3.5 --- .travis.yml | 11 +---- demos/blog/README | 2 +- docs/index.rst | 2 +- maint/test/cython/tox.ini | 3 +- maint/test/websocket/fuzzingclient.json | 57 ++++++++++++++++++------- maint/test/websocket/run-client.sh | 2 +- maint/test/websocket/run-server.sh | 6 +-- maint/test/websocket/tox.ini | 2 +- setup.cfg | 2 +- setup.py | 3 +- tornado/options.py | 4 +- tornado/testing.py | 6 +-- tornado/util.py | 16 ++----- tox.ini | 5 +-- 14 files changed, 61 insertions(+), 60 deletions(-) diff --git a/.travis.yml b/.travis.yml index 83943b296..f7b1e825e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ addons: env: global: - - CIBW_BUILD="cp3[56789]*" + - CIBW_BUILD="cp3[6789]*" - CIBW_TEST_COMMAND="python3 -m tornado.test" - CIBW_TEST_COMMAND_WINDOWS="python -m tornado.test --fail-if-logs=false" @@ -63,15 +63,6 @@ jobs: arch: amd64 env: BUILD_SDIST=1 - # 3.5.2 is interesting because it's the version in ubuntu 16.04, and due to python's - # "provisional feature" rules there are significant differences between patch - # versions for asyncio and typing. - - python: 3.5.2 - # Twisted doesn't install on python 3.5.2, so don't run the "full" tests. - env: TOX_ENV=py35 - stage: test - - python: '3.5' - env: TOX_ENV=py35-full - python: '3.6' env: TOX_ENV=py36-full - python: '3.7' diff --git a/demos/blog/README b/demos/blog/README index d674c876e..f54ad0abc 100644 --- a/demos/blog/README +++ b/demos/blog/README @@ -15,7 +15,7 @@ its prerequisites can be installed with `docker-compose up`. 2. Install Python prerequisites - This demo requires Python 3.5 or newer, and the packages listed in + This demo requires Python 3.6 or newer, and the packages listed in requirements.txt. Install them with `pip -r requirements.txt` 3. Create a database and user for the blog. diff --git a/docs/index.rst b/docs/index.rst index 8a663c307..6f59bd708 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -96,7 +96,7 @@ installed in this way, so you may wish to download a copy of the source tarball or clone the `git repository `_ as well. -**Prerequisites**: Tornado 6.0 requires Python 3.5.2 or newer (See +**Prerequisites**: Tornado 6.0 requires Python 3.6 or newer (See `Tornado 5.1 `_ if compatibility with Python 2.7 is required). The following optional packages may be useful: diff --git a/maint/test/cython/tox.ini b/maint/test/cython/tox.ini index bbf8f1574..c79ab7db5 100644 --- a/maint/test/cython/tox.ini +++ b/maint/test/cython/tox.ini @@ -1,6 +1,6 @@ [tox] # This currently segfaults on pypy. -envlist = py27,py35,py36 +envlist = py27,py36 [testenv] deps = @@ -13,5 +13,4 @@ commands = python -m unittest cythonapp_test # defaults for the others. basepython = py27: python2.7 - py35: python3.5 py36: python3.6 diff --git a/maint/test/websocket/fuzzingclient.json b/maint/test/websocket/fuzzingclient.json index 7b4cb318c..2ac091f37 100644 --- a/maint/test/websocket/fuzzingclient.json +++ b/maint/test/websocket/fuzzingclient.json @@ -1,17 +1,42 @@ { - "options": {"failByDrop": false}, - "outdir": "./reports/servers", - - "servers": [ - {"agent": "Tornado/py27", "url": "ws://localhost:9001", - "options": {"version": 18}}, - {"agent": "Tornado/py35", "url": "ws://localhost:9002", - "options": {"version": 18}}, - {"agent": "Tornado/pypy", "url": "ws://localhost:9003", - "options": {"version": 18}} - ], - - "cases": ["*"], - "exclude-cases": ["9.*", "12.*.1","12.2.*", "12.3.*", "12.4.*", "12.5.*", "13.*.1"], - "exclude-agent-cases": {} -} + "options": { + "failByDrop": false + }, + "outdir": "./reports/servers", + "servers": [ + { + "agent": "Tornado/py27", + "url": "ws://localhost:9001", + "options": { + "version": 18 + } + }, + { + "agent": "Tornado/py39", + "url": "ws://localhost:9002", + "options": { + "version": 18 + } + }, + { + "agent": "Tornado/pypy", + "url": "ws://localhost:9003", + "options": { + "version": 18 + } + } + ], + "cases": [ + "*" + ], + "exclude-cases": [ + "9.*", + "12.*.1", + "12.2.*", + "12.3.*", + "12.4.*", + "12.5.*", + "13.*.1" + ], + "exclude-agent-cases": {} +} \ No newline at end of file diff --git a/maint/test/websocket/run-client.sh b/maint/test/websocket/run-client.sh index bd35f4dca..f32e72aff 100755 --- a/maint/test/websocket/run-client.sh +++ b/maint/test/websocket/run-client.sh @@ -10,7 +10,7 @@ FUZZING_SERVER_PID=$! sleep 1 .tox/py27/bin/python client.py --name='Tornado/py27' -.tox/py35/bin/python client.py --name='Tornado/py35' +.tox/py39/bin/python client.py --name='Tornado/py39' .tox/pypy/bin/python client.py --name='Tornado/pypy' kill $FUZZING_SERVER_PID diff --git a/maint/test/websocket/run-server.sh b/maint/test/websocket/run-server.sh index 2a8387136..401795a00 100755 --- a/maint/test/websocket/run-server.sh +++ b/maint/test/websocket/run-server.sh @@ -15,8 +15,8 @@ tox .tox/py27/bin/python server.py --port=9001 & PY27_SERVER_PID=$! -.tox/py35/bin/python server.py --port=9002 & -PY35_SERVER_PID=$! +.tox/py39/bin/python server.py --port=9002 & +PY39_SERVER_PID=$! .tox/pypy/bin/python server.py --port=9003 & PYPY_SERVER_PID=$! @@ -26,7 +26,7 @@ sleep 1 .tox/py27/bin/wstest -m fuzzingclient kill $PY27_SERVER_PID -kill $PY35_SERVER_PID +kill $PY39_SERVER_PID kill $PYPY_SERVER_PID wait diff --git a/maint/test/websocket/tox.ini b/maint/test/websocket/tox.ini index 289d127b1..7c4b72ebc 100644 --- a/maint/test/websocket/tox.ini +++ b/maint/test/websocket/tox.ini @@ -2,7 +2,7 @@ # to install autobahn and build the speedups module. # See run.sh for the real test runner. [tox] -envlist = py27, py35, pypy +envlist = py27, py39, pypy setupdir=../../.. [testenv] diff --git a/setup.cfg b/setup.cfg index e00a914f3..a365d2c33 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ license_file = LICENSE [mypy] -python_version = 3.5 +python_version = 3.6 no_implicit_optional = True [mypy-tornado.*,tornado.platform.*] diff --git a/setup.py b/setup.py index e627b1a79..7c9b35c5a 100644 --- a/setup.py +++ b/setup.py @@ -138,7 +138,7 @@ if ( if setuptools is not None: - python_requires = ">= 3.5" + python_requires = ">= 3.6" kwargs["python_requires"] = python_requires setup( @@ -180,7 +180,6 @@ setup( classifiers=[ "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", diff --git a/tornado/options.py b/tornado/options.py index f0b89a933..010c9077a 100644 --- a/tornado/options.py +++ b/tornado/options.py @@ -651,7 +651,9 @@ class _Option(object): num = float(m.group(1)) units = m.group(2) or "seconds" units = self._TIMEDELTA_ABBREV_DICT.get(units, units) - sum += datetime.timedelta(**{units: num}) + # This line confuses mypy when setup.py sets python_version=3.6 + # https://github.com/python/mypy/issues/9676 + sum += datetime.timedelta(**{units: num}) # type: ignore start = m.end() return sum except Exception: diff --git a/tornado/testing.py b/tornado/testing.py index 3351b9256..98b54eabb 100644 --- a/tornado/testing.py +++ b/tornado/testing.py @@ -33,14 +33,10 @@ from tornado.util import raise_exc_info, basestring_type from tornado.web import Application import typing -from typing import Tuple, Any, Callable, Type, Dict, Union, Optional +from typing import Tuple, Any, Callable, Type, Dict, Union, Optional, Coroutine from types import TracebackType if typing.TYPE_CHECKING: - # Coroutine wasn't added to typing until 3.5.3, so only import it - # when mypy is running and use forward references. - from typing import Coroutine # noqa: F401 - _ExcInfoTuple = Tuple[ Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType] ] diff --git a/tornado/util.py b/tornado/util.py index 77c5f942e..b69500e2a 100644 --- a/tornado/util.py +++ b/tornado/util.py @@ -74,8 +74,7 @@ class TimeoutError(Exception): class ObjectDict(Dict[str, Any]): - """Makes a dictionary behave like an object, with attribute-style access. - """ + """Makes a dictionary behave like an object, with attribute-style access.""" def __getattr__(self, name: str) -> Any: try: @@ -115,8 +114,7 @@ class GzipDecompressor(object): @property def unconsumed_tail(self) -> bytes: - """Returns the unconsumed portion left over - """ + """Returns the unconsumed portion left over""" return self.decompressobj.unconsumed_tail def flush(self) -> bytes: @@ -168,14 +166,8 @@ def exec_in( def raise_exc_info( - exc_info, # type: Tuple[Optional[type], Optional[BaseException], Optional[TracebackType]] -): - # type: (...) -> typing.NoReturn - # - # This function's type annotation must use comments instead of - # real annotations because typing.NoReturn does not exist in - # python 3.5's typing module. The formatting is funky because this - # is apparently what flake8 wants. + exc_info: Tuple[Optional[type], Optional[BaseException], Optional["TracebackType"]] +) -> typing.NoReturn: try: if exc_info[1] is not None: raise exc_info[1].with_traceback(exc_info[2]) diff --git a/tox.ini b/tox.ini index 8976cab3d..72ec5d5a1 100644 --- a/tox.ini +++ b/tox.ini @@ -13,7 +13,7 @@ [tox] envlist = # Basic configurations: Run the tests for each python version. - py35-full,py36-full,py37-full,py38-full,py39-full,pypy3-full + py36-full,py37-full,py38-full,py39-full,pypy3-full # Build and test the docs with sphinx. docs @@ -27,7 +27,6 @@ whitelist_externals = /bin/sh [testenv] basepython = py3: python3 - py35: python3.5 py36: python3.6 py37: python3.7 py38: python3.8 @@ -64,8 +63,6 @@ setenv = # during sdist installation (and it doesn't seem to be # possible to set environment variables during that phase of # tox). - # ResourceWarnings are too noisy on py35 so don't enable - # warnings-as-errors there. {py3,py36,py37,py38,py39,pypy3}: PYTHONWARNINGS=error:::tornado -- 2.47.2