From 7d317aab82dba1bb937518fbccb2b9640dd8e092 Mon Sep 17 00:00:00 2001 From: Bert JW Regeer Date: Mon, 17 Jan 2022 00:15:19 -0700 Subject: [PATCH 1/5] Update supported Python versions for Waitress --- .github/workflows/ci-tests.yml | 10 +++---- CHANGES.txt | 7 +++++ README.rst | 6 ++-- docs/index.rst | 4 +-- setup.cfg | 4 +-- tox.ini | 50 ++++++++++++++-------------------- 6 files changed, 39 insertions(+), 42 deletions(-) diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index f28f6caf..4bae72be 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -53,14 +53,14 @@ jobs: name: Validate coverage steps: - uses: actions/checkout@v2 - - name: Setup python 3.8 + - name: Setup python 3.10 uses: actions/setup-python@v2 with: - python-version: 3.8 + python-version: "3.10" architecture: x64 - run: pip install tox - - run: tox -e py38,coverage + - run: tox -e py310,coverage docs: runs-on: ubuntu-latest name: Build the documentation @@ -69,7 +69,7 @@ jobs: - name: Setup python uses: actions/setup-python@v2 with: - python-version: 3.8 + python-version: "3.10" architecture: x64 - run: pip install tox - run: tox -e docs @@ -81,7 +81,7 @@ jobs: - name: Setup python uses: actions/setup-python@v2 with: - python-version: 3.8 + python-version: "3.10" architecture: x64 - run: pip install tox - run: tox -e lint diff --git a/CHANGES.txt b/CHANGES.txt index 56e33400..5ccaa642 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,13 @@ Next Release ------------ +Python Version Support +~~~~~~~~~~~~~~~~~~~~~~ + +- Python 3.6 is no longer supported by Waitress + +- Python 3.10 is fully supported by Waitress + Bugfix ~~~~~~ diff --git a/README.rst b/README.rst index a7b63c4b..0d9c5e94 100644 --- a/README.rst +++ b/README.rst @@ -18,9 +18,9 @@ Waitress Waitress is a production-quality pure-Python WSGI server with very acceptable performance. It has no dependencies except ones which live in the Python -standard library. It runs on CPython on Unix and Windows under Python 3.6+. It -is also known to run on PyPy (version 3.6 compatible) on UNIX. It supports -HTTP/1.0 and HTTP/1.1. +standard library. It runs on CPython on Unix and Windows under Python 3.7+. It +is also known to run on PyPy 3 (version 3.7 compatible python) on UNIX. It +supports HTTP/1.0 and HTTP/1.1. For more information, see the "docs" directory of the Waitress package or visit https://docs.pylonsproject.org/projects/waitress/en/latest/ diff --git a/docs/index.rst b/docs/index.rst index 2e12be0c..ba34b5e2 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -7,8 +7,8 @@ Waitress Waitress is meant to be a production-quality pure-Python WSGI server with very acceptable performance. It has no dependencies except ones which live in the Python standard library. It runs on CPython on Unix and Windows under Python -3.6+. It is also known to run on PyPy 7.3.2 (PyPy3) on UNIX. It supports -HTTP/1.0 and HTTP/1.1. +3.7+. It is also known to run on PyPy 3 (python version 3.7+) on UNIX. It +supports HTTP/1.0 and HTTP/1.1. Extended Documentation diff --git a/setup.cfg b/setup.cfg index 245b7f49..efb02cc0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -13,10 +13,10 @@ classifiers = License :: OSI Approved :: Zope Public License Programming Language :: Python Programming Language :: Python :: 3 - Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 Programming Language :: Python :: Implementation :: CPython Programming Language :: Python :: Implementation :: PyPy Operating System :: OS Independent @@ -37,7 +37,7 @@ maintainer_email = pylons-discuss@googlegroups.com package_dir= =src packages=find: -python_requires = >=3.6.0 +python_requires = >=3.7.0 [options.entry_points] paste.server_runner = diff --git a/tox.ini b/tox.ini index f37689fc..c22929b4 100644 --- a/tox.ini +++ b/tox.ini @@ -1,15 +1,14 @@ [tox] envlist = lint, - py36,py37,py38,py39,pypy3, - docs, - coverage -isolated_build = True + py37,py38,py39,py310,pypy3, + coverage, + docs [testenv] commands = python --version - pytest {posargs:} + pytest --cov {posargs:} extras = testing setenv = @@ -25,46 +24,37 @@ deps = coverage setenv = COVERAGE_FILE=.coverage -depends = py38 + +[testenv:docs] +whitelist_externals = + make +commands = + make -C docs html BUILDDIR={envdir} "SPHINXOPTS=-W -E -D suppress_warnings=ref.term" +extras = + docs [testenv:lint] skip_install = True commands = - black --check --diff . isort --check-only --df src/waitress tests + black --check --diff . check-manifest # flake8 src/waitress/ tests # build sdist/wheel - python -m pep517.build . + python -m build . twine check dist/* deps = black + build check-manifest flake8 flake8-bugbear isort - pep517 readme_renderer twine -[testenv:docs] -whitelist_externals = - make -commands = - make -C docs html BUILDDIR={envdir} SPHINXOPTS="-W -E" -extras = - docs - -[testenv:run-flake8] -skip_install = True -commands = - flake8 src/waitress/ tests -deps = - flake8 - flake8-bugbear - -[testenv:run-format] -skip_install = True +[testenv:format] +skip_install = true commands = isort src/waitress tests black . @@ -80,12 +70,12 @@ commands = # Make sure we aren't forgetting anything check-manifest # build sdist/wheel - python -m pep517.build . + python -m build . # Verify all is well twine check dist/* deps = - readme_renderer + build check-manifest - pep517 + readme_renderer twine From 73a0fbe575f3519acd3eb8d51be6ce9a0dc2551e Mon Sep 17 00:00:00 2001 From: Bert JW Regeer Date: Mon, 17 Jan 2022 15:09:20 -0700 Subject: [PATCH 2/5] Bind to localhost only during tests --- tests/test_functional.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_functional.py b/tests/test_functional.py index 01fcda60..31033916 100644 --- a/tests/test_functional.py +++ b/tests/test_functional.py @@ -52,6 +52,7 @@ class FixtureTcpWSGIServer(server.TcpWSGIServer): def __init__(self, application, queue, **kw): # pragma: no cover # Coverage doesn't see this as it's ran in a separate process. + kw["host"] = "127.0.0.1" kw["port"] = 0 # Bind to any available port. super().__init__(application, **kw) host, port = self.socket.getsockname() From b502635db39a85248de4501e87a0ce5fb2d473d6 Mon Sep 17 00:00:00 2001 From: Bert JW Regeer Date: Mon, 17 Jan 2022 15:10:03 -0700 Subject: [PATCH 3/5] Call gc.collect() cause these tests leak file descriptors --- tests/test_functional.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_functional.py b/tests/test_functional.py index 31033916..4d1bcc36 100644 --- a/tests/test_functional.py +++ b/tests/test_functional.py @@ -102,6 +102,15 @@ def stop_subprocess(self): self.proc.join() self.proc.close() + # The following is for the benefit of PyPy 3, for some reason it is + # holding on to some resources way longer than necessary causing tests + # to fail with file desctriptor exceeded errors on macOS which defaults + # to 256 file desctriptors per process. While we could use ulimit to + # increase the limits before running tests, this works as well and + # means we don't need to remember to do that. + import gc + gc.collect() + def assertline(self, line, status, reason, version): v, s, r = (x.strip() for x in line.split(None, 2)) self.assertEqual(s, status.encode("latin-1")) From 2e2138865c122f47008d129aebf97b42e3af04b6 Mon Sep 17 00:00:00 2001 From: Bert JW Regeer Date: Mon, 17 Jan 2022 15:10:27 -0700 Subject: [PATCH 4/5] Disable coverage on pypy3 --- tox.ini | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index c22929b4..c1684047 100644 --- a/tox.ini +++ b/tox.ini @@ -4,11 +4,14 @@ envlist = py37,py38,py39,py310,pypy3, coverage, docs +isolated_build = True [testenv] commands = python --version - pytest --cov {posargs:} + python -mpytest \ + pypy3: --no-cov \ + {posargs:} extras = testing setenv = From 9db35068c1410a2fdce508d84739457c0ca69007 Mon Sep 17 00:00:00 2001 From: Bert JW Regeer Date: Mon, 17 Jan 2022 15:15:56 -0700 Subject: [PATCH 5/5] Join the queue thread after closing it in tests --- tests/test_functional.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_functional.py b/tests/test_functional.py index 4d1bcc36..f74a2527 100644 --- a/tests/test_functional.py +++ b/tests/test_functional.py @@ -98,9 +98,10 @@ def stop_subprocess(self): self.proc.terminate() self.sock.close() # This give us one FD back ... - self.queue.close() self.proc.join() self.proc.close() + self.queue.close() + self.queue.join_thread() # The following is for the benefit of PyPy 3, for some reason it is # holding on to some resources way longer than necessary causing tests @@ -109,6 +110,7 @@ def stop_subprocess(self): # increase the limits before running tests, this works as well and # means we don't need to remember to do that. import gc + gc.collect() def assertline(self, line, status, reason, version):