From 22dc1bc7e90acd5991c42f818ae833ddce00503d Mon Sep 17 00:00:00 2001 From: "Paul J. Dorn" Date: Fri, 29 Dec 2023 06:39:50 +0100 Subject: [PATCH] CI: verify minimal dependencies --- .github/workflows/tox.yml | 9 ++++++ pyproject.toml | 63 +++++++++++++++++++++++++++++++++++---- tox.ini | 9 ++++++ 3 files changed, 75 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 308fab11a..513e2b1dd 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -26,6 +26,13 @@ jobs: # PyPy <= 3.8 is EoL since 2023-06-16 - "pypy-3.9" - "pypy-3.10" + mindep: [false] + include: + # pin OS lower than usual tests, even if that is slow / soon removed + # point is to prove we got our minimum deps documented + - os: ubuntu-20.04 + python-version: "3.7" + mindep: true steps: - uses: actions/checkout@v4 - name: Using Python ${{ matrix.python-version }} @@ -42,3 +49,5 @@ jobs: - run: tox -e run-module - run: tox -e run-entrypoint - run: tox -e py + - if: ${{ matrix.mindep }} + run: tox -e mindep diff --git a/pyproject.toml b/pyproject.toml index eaca1eac0..6dae38c38 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,6 +38,7 @@ classifiers = [ requires-python = ">=3.7" dependencies = [ 'importlib_metadata; python_version<"3.8"', + #"packaging>=21.0", "packaging", ] dynamic = ["version"] @@ -50,11 +51,52 @@ Documentation = "https://docs.gunicorn.org" Changelog = "https://docs.gunicorn.org/en/stable/news.html" [project.optional-dependencies] -gevent = ["gevent>=1.4.0"] -eventlet = ["eventlet>=0.24.1,!=0.36.0"] -tornado = ["tornado>=0.2"] +gevent = [ + # 21.8.0 is what Ubuntu 22.04 shipped + # 22.8.0 is lowest tested OK on 3.11 + # 22.10 is the last version to support 3.7 + #'gevent>=21.8.0; python_version<"3.11"', + #'gevent>=22.8.0; python_version>="3.11"', + # gevent 1.4.0 does not build for 3.11 (incompat Cython) + "gevent>=1.4.0", +] +eventlet = [ + # eventlet 0.34.1 known to break older gunicorn + # eventlet 0.36.0 https://github.com/eventlet/eventlet/issues/946 + # (removed toplevel __version__, re-added since) + # eventlet 0.26.0 needed for 3.7 + # eventlet 0.26.1 needed for 3.7 dependencies + # eventlet 0.33.0 needed for python 3.10 + #'eventlet>=0.26.1; python_version<"3.10"', + #'eventlet>=0.33.3; python_version>="3.10"', + "eventlet>=0.24.1,!=0.36.0", +] +tornado = [ + # arbitrary unsupported release with grave issues + # pick version that does not play nice with CPython3 and work our way up + #"tornado>=3.0.2", + "tornado>=0.2", +] gthread = [] -setproctitle = ["setproctitle"] +setproctitle = [ + # 1.2.0 needed for Python 3.8 + #"setproctitle>=1.2.0", + "setproctitle", +] +testing-mindep = [ + # this sections helps tox/pip select lowest version + # .. needs to manually kept in sync with other sections + "coverage[toml]==5.2.1", + "packaging==21.0", + "pytest==7.2.0", + "setproctitle==1.2.0", + "setuptools==61.2", + "tornado==3.0.2", + 'eventlet==0.26.1; python_version<"3.10"', + 'eventlet==0.33.3; python_version>="3.10"', + 'gevent==21.8.0; python_version<"3.11"', + 'gevent==22.8.0; python_version>="3.11"', +] testing = [ "gevent", "eventlet", @@ -67,12 +109,21 @@ testing = [ # duplicates "python -m gunicorn" handling in __main__.py gunicorn = "gunicorn.app.wsgiapp:run" -# note the quotes around "paste.server_runner" to escape the dot [project.entry-points."paste.server_runner"] +# note the quotes around "paste.server_runner" to escape the dot main = "gunicorn.app.pasterapp:serve" +[tool.coverage.report] +omit = [ + # workaround for bad test tripping pytest+coverage: + # tests will load such file as configuration + # when we delete the source, we do not care for its coverage + "*/gunicorn.conf.py", +] + [tool.pytest.ini_options] -# # can override these: python -m pytest --override-ini="addopts=" +# can override these: python -m pytest --override-ini="addopts=" +faulthandler_timeout = 25 norecursedirs = ["examples", "lib", "local", "src"] testpaths = ["tests/"] addopts = "--assert=plain --cov=gunicorn --cov-report=xml" diff --git a/tox.ini b/tox.ini index c1c2fd053..f0a8237fa 100644 --- a/tox.ini +++ b/tox.ini @@ -15,6 +15,15 @@ commands = pytest --cov=gunicorn {posargs} deps = -rrequirements_test.txt +[testenv:mindep] +# this need not match default testenv. both editable & wheel must work! +package = wheel +extras = testing-mindep +commands = + python -m pip freeze + python -m coverage run -m pytest {posargs} + python -m coverage xml + [testenv:run-entrypoint] # entry point: console script (provided by setuptools from pyproject.toml) commands = python -c 'import subprocess; cmd_out = subprocess.check_output(["gunicorn", "--version"])[:79].decode("utf-8", errors="replace"); print(cmd_out); assert cmd_out.startswith("gunicorn ")'