Skip to content

Commit

Permalink
chore(platform): declare CPython 3.13 support (#2263)
Browse files Browse the repository at this point in the history
* chore(platform): declare CPython 3.13 support

* chore(platform): use a more specific interpreter version in Actions

* chore(CI): specify a version range for py313 Action

* test(test_hello.py): prevent an exception from getting raised during gc

* chore(platform): demote 3.7 & 3.8 to best effort, add more 3.13 gates

* chore(Actions): cleaner naming of pre-release Python gates
  • Loading branch information
vytas7 authored Aug 11, 2024
1 parent 6adc303 commit 3b35eea
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 11 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/mintest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,27 @@ jobs:
fail-fast: false
matrix:
python-version:
- "3.8"
- "3.10"
- "3.11"
- "3.12"
- "3.13"

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
if: ${{ matrix.python-version != '3.13' }}
with:
python-version: ${{ matrix.python-version }}

- name: Set up Python 3.13
uses: actions/setup-python@v4
if: ${{ matrix.python-version == '3.13' }}
with:
python-version: "3.13.0-rc.1 - 3.13"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
20 changes: 17 additions & 3 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
matrix:
python-version:
- "3.12"
python-dev-version:
- ""
os:
- "ubuntu-latest"
toxenv:
Expand Down Expand Up @@ -56,9 +58,6 @@ jobs:
- python-version: "3.8"
os: ubuntu-latest
toxenv: py38
- python-version: "3.8"
os: ubuntu-latest
toxenv: py38_cython
- python-version: "3.9"
os: ubuntu-latest
toxenv: py39
Expand Down Expand Up @@ -89,6 +88,14 @@ jobs:
- python-version: "3.12"
os: windows-latest
toxenv: py312_nocover
- python-version: "3.13"
python-dev-version: "3.13.0-rc.1 - 3.13"
os: ubuntu-latest
toxenv: py313
- python-version: "3.13"
python-dev-version: "3.13.0-rc.1 - 3.13"
os: ubuntu-latest
toxenv: py313_cython
# These env require 3.8 and 20.04, see tox.ini
- python-version: "3.8"
os: ubuntu-20.04
Expand All @@ -112,9 +119,16 @@ jobs:

- name: Set up Python
uses: actions/setup-python@v4
if: ${{ !matrix.python-dev-version }}
with:
python-version: ${{ matrix.python-version }}

- name: Set up Python (pre-release)
uses: actions/setup-python@v4
if: ${{ matrix.python-dev-version }}
with:
python-version: ${{ matrix.python-dev-version }}

- name: Install smoke test dependencies
if: ${{ matrix.toxenv == 'py38_smoke' || matrix.toxenv == 'py38_smoke_cython' }}
run: |
Expand Down
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ $ pip install -U ruff
$ ruff format
```

You can check all this by running ``tox`` from within the Falcon project directory. Your environment must be based on CPython 3.8, 3.10, 3.11 or 3.12:
You can check all this by running ``tox`` from within the Falcon project directory.
Your environment must be based on CPython 3.10, 3.11, 3.12 or 3.13:

```bash
$ pip install -U tox
Expand Down
14 changes: 9 additions & 5 deletions docs/changes/4.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ Changes to Supported Platforms

- CPython 3.11 is now fully supported. (`#2072 <https://github.com/falconry/falcon/issues/2072>`__)
- CPython 3.12 is now fully supported. (`#2196 <https://github.com/falconry/falcon/issues/2196>`__)
- CPython 3.13 is now fully supported. (`#2258 <https://github.com/falconry/falcon/issues/2258>`__)
- End-of-life Python 3.5 & 3.6 are no longer supported. (`#2074 <https://github.com/falconry/falcon/pull/2074>`__)
- Python 3.7 is no longer actively supported, but the framework should still
continue to install from source. We may remove the support for 3.7 altogether
later in the 4.x series if we are faced with incompatible ecosystem changes
in typing, Cython, etc.

- End-of-life Python 3.7 and (soon end-of-life) 3.8 are no longer actively
supported, but the framework should still continue to install from source and
function.
- The Falcon 4.x series is guaranteed to support CPython 3.10 and
PyPy3.10 (v7.3.16).
This means that we may drop the support for Python 3.7-3.9 altogether in a
later 4.x release, especially if we are faced with incompatible ecosystem
changes in typing, Cython, etc.

.. towncrier release notes start
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ classifiers =
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: 3.13
Programming Language :: Cython
keywords =
asgi
Expand Down
9 changes: 8 additions & 1 deletion tests/test_hello.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,17 @@ def close(self):
self.close_called = True


class NonClosingBytesIO(io.BytesIO):
# NOTE(vytas): Do not inherit from BytesIO but encapsulate instead, as on
# CPython 3.13 garbage-collecting a BytesIO instance with an invalid .close()
# sometimes bubbles up a warning about exception when trying to call it.
class NonClosingBytesIO:
# Not callable; test that CloseableStreamIterator ignores it
close = False # type: ignore

def __init__(self, data=b''):
self._stream = io.BytesIO(data)
self.read = self._stream.read


class ClosingFilelikeHelloResource:
sample_status = '200 OK'
Expand Down
8 changes: 8 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,14 @@ deps = {[with-cython]deps}
setenv = {[with-cython]setenv}
commands = {[with-cython]commands}

[testenv:py313_cython]
basepython = python3.13
# NOTE(vytas): pyximport relies on distutils.extension
deps = {[with-cython]deps}
setuptools
setenv = {[with-cython]setenv}
commands = {[with-cython]commands}

# --------------------------------------------------------------------
# WSGI servers (Cythonized Falcon)
# --------------------------------------------------------------------
Expand Down

0 comments on commit 3b35eea

Please sign in to comment.