Skip to content

Commit

Permalink
chore: move default Python version to 3.10 (#2106)
Browse files Browse the repository at this point in the history
* chore: move default python version to 3.10

* chore: some tox env require python 3.8

* chore(ci): add cython jobs

* chore: fix misspelled pkg name greenlen (sic) ==> greenlet

* style: trim trailing whitespace

Co-authored-by: Kurt Griffiths <mail@kgriffs.com>
Co-authored-by: Vytautas Liuolia <vytautas.liuolia@gmail.com>
  • Loading branch information
3 people committed Oct 3, 2022
1 parent bce4ad3 commit f9647c8
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 63 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/create-wheels.yaml
Expand Up @@ -320,7 +320,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2.1.4
with:
python-version: "3.8"
python-version: "3.10"
architecture: "x64"

- name: Publish wheel
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/tests-emulated.yaml
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
run_tox_emulate:
name: tox -e py38_cython (${{ matrix.architecture }})
name: tox -e py310_cython (${{ matrix.architecture }})
runs-on: ubuntu-20.04
strategy:
fail-fast: false
Expand Down Expand Up @@ -41,7 +41,7 @@ jobs:
#
- name: Run tox s390x
if: ${{ matrix.architecture == 's390x' }}
uses: docker://s390x/python:3.8-buster
uses: docker://s390x/python:3.10-buster
env:
PIP_CACHE_DIR: /github/workspace/.pip/
with:
Expand All @@ -58,11 +58,11 @@ jobs:
pip --version &&
tox --version &&
pip install ujson &&
tox -e py38_cython"
tox -e py310_cython"
- name: Run tox arm64v8
if: ${{ matrix.architecture == 'arm64v8' }}
uses: docker://arm64v8/python:3.8-buster
uses: docker://arm64v8/python:3.10-buster
env:
PIP_CACHE_DIR: /github/workspace/.pip/
with:
Expand All @@ -75,7 +75,7 @@ jobs:
python --version &&
pip --version &&
tox --version &&
tox -e py38_cython"
tox -e py310_cython"
- name: Fix cache permission
run: |
Expand Down
51 changes: 30 additions & 21 deletions .github/workflows/tests.yaml
Expand Up @@ -18,7 +18,7 @@ jobs:
fail-fast: false
matrix:
python-version:
- "3.8"
- "3.10"
os:
- "ubuntu-20.04"
toxenv:
Expand All @@ -27,11 +27,9 @@ jobs:
- "pep8-examples"
- "pep8-docstrings"
- "mypy"
- "py38"
- "py38_sans_msgpack"
- "py38_cython"
- "py38_smoke"
- "py38_smoke_cython"
- "py310"
- "py310_sans_msgpack"
- "py310_cython"
- "docs"
- "towncrier"
- "look"
Expand All @@ -43,24 +41,28 @@ jobs:
- "e2e_chrome"
- "e2e_firefox"
- "no_optional_packages"
- "wsgi_servers"
# TODO(kgriffs): Re-enable once hug has a chance to address
# breaking changes in Falcon 3.0
# - "hug"
include:
- python-version: pypy3
os: ubuntu-20.04
toxenv: pypy3
- python-version: 3.7
- python-version: "3.7"
os: ubuntu-20.04
toxenv: py37
- python-version: 3.9
- python-version: "3.8"
os: ubuntu-20.04
toxenv: py38
- python-version: "3.8"
os: ubuntu-20.04
toxenv: py38_cython
- python-version: "3.9"
os: ubuntu-20.04
toxenv: py39
- python-version: 3.9
- python-version: "3.9"
os: ubuntu-20.04
toxenv: py39_cython
# NOTE(vytas): Quote "3.10" or else it is parsed as a YAML float 3.1.
- python-version: "3.10"
os: ubuntu-20.04
toxenv: py310
Expand All @@ -73,15 +75,22 @@ jobs:
- python-version: "3.11.0-rc - 3.11"
os: ubuntu-latest
toxenv: py311_cython
- python-version: 3.8
os: ubuntu-20.04
toxenv: py38_sans_msgpack
- python-version: 3.8
- python-version: "3.10"
os: macos-latest
toxenv: py38_nocover
- python-version: 3.8
toxenv: py310_nocover
- python-version: "3.10"
os: windows-latest
toxenv: py38_nocover
toxenv: py310_nocover
# These env require 3.8, see tox.ini
- python-version: "3.8"
os: ubuntu-latest
toxenv: py38_smoke
- python-version: "3.8"
os: ubuntu-latest
toxenv: py38_smoke_cython
- python-version: "3.8"
os: ubuntu-latest
toxenv: "wsgi_servers"

# Steps to run in each job.
# Some are GitHub actions, others run shell commands.
Expand Down Expand Up @@ -117,14 +126,14 @@ jobs:
run: tox -e ${{ matrix.toxenv }}

- name: Combine coverage
if: ${{ matrix.toxenv == 'py38' || matrix.toxenv == 'py38_sans_msgpack' }}
if: ${{ matrix.toxenv == 'py310' || matrix.toxenv == 'py310_sans_msgpack' }}
run: |
coverage --version
coverage combine
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
if: ${{ matrix.toxenv == 'py38' || matrix.toxenv == 'py38_sans_msgpack' }}
uses: codecov/codecov-action@v1
if: ${{ matrix.toxenv == 'py310' || matrix.toxenv == 'py310_sans_msgpack' }}
with:
env_vars: PYTHON
fail_ci_if_error: true
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Expand Up @@ -94,21 +94,21 @@ If you wish, you can customize Falcon's `tox.ini` to install alternative debugge
A few simple benchmarks are included with the source under ``falcon/bench``. These can be taken as a rough measure of the performance impact (if any) that your changes have on the framework. You can run these tests by invoking one of the tox environments included for this purpose (see also the ``tox.ini`` file). For example:

```bash
$ tox -e py38_bench
$ tox -e py310_bench
```

Note that you may pass additional arguments via tox to the falcon-bench command:

```bash
$ tox -e py38_bench -- -h
$ tox -e py38_bench -- -b falcon -i 20000
$ tox -e py310_bench -- -h
$ tox -e py310_bench -- -b falcon -i 20000
```

Alternatively, you may run falcon-bench directly by creating a new virtual environment and installing falcon directly in development mode. In this example we use pyenv with pyenv-virtualenv from within a falcon source directory:

```bash
$ pyenv virtualenv 3.8.0 falcon-sandbox-38
$ pyenv shell falcon-sandbox-38
$ pyenv virtualenv 3.10.6 falcon-sandbox-310
$ pyenv shell falcon-sandbox-310
$ pip install -r requirements/bench
$ pip install -e .
$ falcon-bench
Expand Down
8 changes: 4 additions & 4 deletions docker/Makefile
Expand Up @@ -7,11 +7,11 @@ build-benchmark-images:
sudo docker pull python:3.8
sudo docker pull pypy:3-slim

sudo docker build --no-cache -t falconry/falcon-bench:${FALCON_VERSION}-py38 -f bench_py3.Dockerfile ./
sudo docker build --no-cache -t falconry/falcon-bench:${FALCON_VERSION}-py38-cython -f bench_py3_cython.Dockerfile ./
sudo docker build --no-cache -t falconry/falcon-bench:${FALCON_VERSION}-py310 -f bench_py3.Dockerfile ./
sudo docker build --no-cache -t falconry/falcon-bench:${FALCON_VERSION}-py310-cython -f bench_py3_cython.Dockerfile ./
sudo docker build --no-cache -t falconry/falcon-bench:${FALCON_VERSION}-pypy3 -f bench_pypy3.Dockerfile ./

push:
sudo docker push falconry/falcon-bench:${FALCON_VERSION}-py38
sudo docker push falconry/falcon-bench:${FALCON_VERSION}-py38-cython
sudo docker push falconry/falcon-bench:${FALCON_VERSION}-py310
sudo docker push falconry/falcon-bench:${FALCON_VERSION}-py310-cython
sudo docker push falconry/falcon-bench:${FALCON_VERSION}-pypy3
1 change: 1 addition & 0 deletions requirements/bench
Expand Up @@ -4,4 +4,5 @@ pecan
bottle

pprofile
# NOTE(caselit): vmprof requires python 3.8 https://github.com/vmprof/vmprof-python/issues/240
vmprof
57 changes: 30 additions & 27 deletions tox.ini
Expand Up @@ -98,21 +98,21 @@ deps = {[testenv]deps}
commands = pip uninstall --yes msgpack
coverage run -m pytest tests -k "test_ws and test_msgpack_missing"

[testenv:py38]
basepython = python3.8
[testenv:py310]
basepython = python3.10
deps = {[testenv]deps}
pytest-randomly
jsonschema
commands = {[with-coverage]commands}

[testenv:py38_sans_msgpack]
basepython = python3.8
[testenv:py310_sans_msgpack]
basepython = python3.10
deps = {[testenv]deps}
commands = pip uninstall --yes msgpack
coverage run -m pytest tests -k "test_ws and test_msgpack_missing"

[testenv:py38_nocover]
basepython = python3.8
[testenv:py310_nocover]
basepython = python3.10
deps = {[testenv]deps}
pytest-randomly
jsonschema
Expand All @@ -134,7 +134,7 @@ deps = -r{toxinidir}/requirements/tests
pdbpp

[testenv:py3_debug]
basepython = python3.8
basepython = python3.10
deps = {[with-debug-tools]deps}
uvicorn
jsonschema
Expand Down Expand Up @@ -212,6 +212,7 @@ install_command = {[with-cython]install_command}
setenv = {[with-cython]setenv}
deps = {[with-cython]deps}
gunicorn
# NOTE(caselit): meinheld requires greenlet<0.5 that's not compatible with py3.10
meinheld
uwsgi
waitress
Expand All @@ -230,11 +231,13 @@ commands = pip install "setuptools < 58.0"
falcon-bench -t 1 -b falcon-ext

[testenv:py38_smoke]
# NOTE(caselit): vmprof requires python 3.8 https://github.com/vmprof/vmprof-python/issues/240
basepython = python3.8
deps =
commands = {[smoke-test]commands}

[testenv:py38_smoke_cython]
# NOTE(caselit): vmprof requires python 3.8 https://github.com/vmprof/vmprof-python/issues/240
basepython = python3.8
deps = cython
setenv = {[with-cython]setenv}
Expand All @@ -261,7 +264,7 @@ commands = blue . []
[testenv:pep8-docstrings]
deps = flake8
flake8-docstrings
basepython = python3.8
basepython = python3.10
commands = flake8 \
--docstring-convention=pep257 \
--exclude=.ecosystem,.eggs,.git,.tox,.venv,build,dist,docs,examples,tests,falcon/vendor,falcon/bench/nuts \
Expand All @@ -273,7 +276,7 @@ deps = flake8
flake8-quotes
flake8-import-order

basepython = python3.8
basepython = python3.10

commands = flake8 examples \
--max-complexity=12 \
Expand All @@ -287,31 +290,31 @@ commands = flake8 examples \
# For viewing environ dicts generated by various WSGI servers
# --------------------------------------------------------------------

[testenv:py38_dump_gunicorn]
basepython = python3.8
[testenv:py310_dump_gunicorn]
basepython = python3.10
deps = gunicorn
commands = gunicorn -b localhost:8000 tests.dump_wsgi

[testenv:py38_dump_waitress]
basepython = python3.8
[testenv:py310_dump_waitress]
basepython = python3.10
deps = waitress
commands = waitress-serve --listen=localhost:8000 tests.dump_wsgi:application

[testenv:py38_dump_wsgiref]
basepython = python3.8
[testenv:py310_dump_wsgiref]
basepython = python3.10
commands = python tests/dump_wsgi.py

# --------------------------------------------------------------------
# Benchmarking
# --------------------------------------------------------------------

[testenv:py37_bench]
basepython = python3.7
[testenv:py310_bench]
basepython = python3.10
deps = -r{toxinidir}/requirements/bench
commands = falcon-bench []

[testenv:py37_bench_cython]
basepython = python3.7
[testenv:py310_bench_cython]
basepython = python3.10
deps = -r{toxinidir}/requirements/bench
cython
commands = falcon-bench []
Expand Down Expand Up @@ -342,7 +345,7 @@ commands = falcon-bench []
# --------------------------------------------------------------------

[testenv:check_vendored]
basepython = python3.8
basepython = python3.10
deps =
commands = {toxinidir}/tools/check-vendored.sh

Expand All @@ -351,7 +354,7 @@ commands = {toxinidir}/tools/check-vendored.sh
# --------------------------------------------------------------------

[testenv:twine_check]
basepython = python3.8
basepython = python3.10
skipsdist = True
deps = setuptools
twine
Expand All @@ -365,7 +368,7 @@ commands =
# --------------------------------------------------------------------

[testenv:docs]
basepython = python3.8
basepython = python3.10
deps = -r{toxinidir}/requirements/docs
commands =
sphinx-build -j auto -W -E -b html docs docs/_build/html []
Expand Down Expand Up @@ -396,7 +399,7 @@ commands =
{toxinidir}/tools/towncrier_draft.py --dry-run

[testenv:dash]
basepython = python3.7
basepython = python3.10
setenv =
DASHBUILD = True
deps = -r{toxinidir}/requirements/docs
Expand All @@ -409,7 +412,7 @@ commands =
# --------------------------------------------------------------------

[testenv:look]
basepython = python3.8
basepython = python3.10
deps =
-r{toxinidir}/examples/look/requirements/test
commands =
Expand All @@ -420,7 +423,7 @@ commands =
# --------------------------------------------------------------------

[testenv:asgilook]
basepython = python3.8
basepython = python3.10
deps =
-r{toxinidir}/examples/asgilook/requirements/asgilook
-r{toxinidir}/examples/asgilook/requirements/test
Expand Down Expand Up @@ -448,14 +451,14 @@ commands =
# --------------------------------------------------------------------

[testenv:e2e_chrome]
basepython = python3.8
basepython = python3.10
deps =
-r{toxinidir}/requirements/e2e
commands =
pytest {toxinidir}/e2e-tests/ --browser=chrome

[testenv:e2e_firefox]
basepython = python3.8
basepython = python3.10
deps =
-r{toxinidir}/requirements/e2e
commands =
Expand Down

0 comments on commit f9647c8

Please sign in to comment.