Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Python 3.13 to the test matrix #356

Merged
merged 5 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .ci/py-requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
set -e -u

pip install -U pip
if [ "$(python -c 'import sys; print(sys.version_info >= (3, 12))')" == "True" ]; then
if [ "$(python -c 'import sys; print(sys.version_info >= (3, 13))')" == "True" ]; then
pip install -r requirements-3.13.txt
elif [ "$(python -c 'import sys; print(sys.version_info >= (3, 12))')" == "True" ]; then
pip install -r requirements-3.12.txt
else
pip install -r requirements.txt
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.13'
cache: 'pip'
- uses: actions/setup-python@v5
with:
python-version: '3.12'
Expand Down Expand Up @@ -244,7 +248,7 @@ jobs:
fail-fast: false
matrix:
arch: [x86_64, aarch64]
python: [cp38, cp39, cp310, cp311, cp312]
python: [cp38, cp39, cp310, cp311, cp312, cp313]
env:
SCCACHE_GHA_ENABLED: "true"
steps:
Expand Down Expand Up @@ -274,7 +278,7 @@ jobs:
fail-fast: false
matrix:
os: [macos-13, macos-14]
python: [cp38, cp39, cp310, cp311, cp312]
python: [cp38, cp39, cp310, cp311, cp312, cp313]
exclude:
# Python 3.8 not natively available for Apple Silicon. cibuildwheel
# tries to do a cross build, which fails.
Expand Down
13 changes: 10 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,18 @@ repos:
hooks:
- name: pip-compile (py 3.12)
id: pip-compile
args: [requirements.in, -o, requirements-3.12.txt]
args: [--strip-extras, requirements.in, -o, requirements-3.12.txt]
language_version: python3.12
files: '^(?:requirements\.in|requirements-3\.12\.txt)$'
- name: pip-compile (py 3.13)
id: pip-compile
args: [--strip-extras, requirements.in, -o, requirements-3.13.txt]
language_version: python3.13
files: '^(?:requirements\.in|requirements-3\.13\.txt)$'
- name: pip-compile (readthedocs)
id: pip-compile
args: [requirements-readthedocs.in, -o, requirements-readthedocs.txt]
# --no-annotation because otherwise -r requirements-3.12.txt sometimes gets
# rewritten into an absolute path.
args: [--strip-extras, --no-annotate, requirements-readthedocs.in, -o, requirements-readthedocs.txt]
language_version: python3.12
files: '^requirements(?:-readthedocs)?\.(?:in|txt)$'
files: '^requirements(?:-readthedocs|3\.12)?\.(?:in|txt)$'
12 changes: 7 additions & 5 deletions doc/dev-setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ of editable installs. Also install the development runtime dependencies:
.. code-block:: sh

pip install -r requirements.txt # If Python < 3.12
pip install -r requirements-3.12.txt # If Python >= 3.12
pip install -r requirements-3.12.txt # If Python = 3.12
pip install -r requirements-3.13.txt # If Python >= 3.13

Now you should be able to run the unit tests by executing :command:`pytest`.
It is expected that some tests will be skipped, because they require specific
Expand Down Expand Up @@ -142,10 +143,11 @@ Committing
----------
Before committing, remember to run :command:`pre-commit install` to set up
pre-commit. One of the pre-commit hooks checks that the requirements files are
up to date, and (at the time of writing) depends on having both
:command:`python3.8` and :command:`python3.12` commands on the path. If you're
not touching the requirements, you can skip this hook by setting the
environment variable :envvar:`SKIP=pip-compile` when committing.
up to date, and (at the time of writing) depends on having
:command:`python3.8`, :command:`python3.12` and :command:`python3.13` commands
on the path. If you're not touching the requirements, you can skip this hook
by setting the environment variable :envvar:`SKIP=pip-compile` when
committing.

.. _ninja-build: https://ninja-build.org/
.. _pyenv: https://github.com/pyenv/pyenv/
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ py_version = 38

[tool.black]
line-length = 100
target-versions = ["py38", "py39", "py310", "py311", "py312"]
target-versions = ["py38", "py39", "py310", "py311", "py312", "py313"]

[tool.ruff]
select = ["E", "F", "W", "UP", "PYI", "RUF100"]
Expand Down
4 changes: 2 additions & 2 deletions requirements-3.12.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --output-file=requirements-3.12.txt requirements.in
# pip-compile --output-file=requirements-3.12.txt --strip-extras requirements.in
#
iniconfig==2.0.0
# via pytest
llvmlite==0.43.0
# via numba
netifaces2==0.0.22
# via -r requirements.in
numba==0.60.0
numba==0.60.0 ; python_version < "3.13"
# via -r requirements.in
numpy==2.0.2
# via
Expand Down
32 changes: 32 additions & 0 deletions requirements-3.13.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#
# This file is autogenerated by pip-compile with Python 3.13
# by the following command:
#
# pip-compile --output-file=requirements-3.13.txt --strip-extras requirements.in
#
iniconfig==2.0.0
# via pytest
netifaces2==0.0.22
# via -r requirements.in
numpy==2.1.2
# via
# -r requirements.in
# scipy
packaging==24.1
# via pytest
pluggy==1.5.0
# via pytest
pytest==8.3.3
# via
# -r requirements.in
# pytest-asyncio
# pytest-custom-exit-code
# pytest-timeout
pytest-asyncio==0.24.0
# via -r requirements.in
pytest-custom-exit-code==0.3.0
# via -r requirements.in
pytest-timeout==2.3.1
# via -r requirements.in
scipy==1.14.1
# via -r requirements.in
66 changes: 2 additions & 64 deletions requirements-readthedocs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,104 +2,42 @@
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --output-file=requirements-readthedocs.txt requirements-readthedocs.in
# pip-compile --no-annotate --output-file=requirements-readthedocs.txt --strip-extras requirements-readthedocs.in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. It makes for a cleaner file but I kind of like knowing why all the things are in the requirements file.

I guess it's easy enough for the interested reader to generate themselves though.

#
alabaster==0.7.16
# via sphinx
babel==2.16.0
# via sphinx
breathe==4.35.0
# via -r requirements-readthedocs.in
certifi==2024.7.4
# via requests
charset-normalizer==3.3.2
# via requests
docutils==0.20.1
# via
# breathe
# sphinx
# sphinx-rtd-theme
idna==3.8
# via requests
imagesize==1.4.1
# via sphinx
iniconfig==2.0.0
# via
# -r requirements-3.12.txt
# pytest
jinja2==3.1.4
# via sphinx
llvmlite==0.43.0
# via
# -r requirements-3.12.txt
# numba
markupsafe==2.1.5
# via jinja2
netifaces2==0.0.22
# via -r requirements-3.12.txt
numba==0.60.0
# via -r requirements-3.12.txt
numba==0.60.0 ; python_version < "3.13"
numpy==2.0.2
# via
# -r requirements-3.12.txt
# numba
# scipy
packaging==24.1
# via
# -r requirements-3.12.txt
# pytest
# sphinx
pluggy==1.5.0
# via
# -r requirements-3.12.txt
# pytest
pygments==2.18.0
# via sphinx
pytest==8.3.3
# via
# -r requirements-3.12.txt
# pytest-asyncio
# pytest-custom-exit-code
# pytest-timeout
pytest-asyncio==0.24.0
# via -r requirements-3.12.txt
pytest-custom-exit-code==0.3.0
# via -r requirements-3.12.txt
pytest-timeout==2.3.1
# via -r requirements-3.12.txt
requests==2.32.3
# via sphinx
scipy==1.14.1
# via -r requirements-3.12.txt
snowballstemmer==2.2.0
# via sphinx
sphinx==8.1.3
# via
# -r requirements-readthedocs.in
# breathe
# sphinx-design
# sphinx-rtd-theme
# sphinxcontrib-jquery
# sphinxcontrib-tikz
sphinx-design==0.6.1
# via -r requirements-readthedocs.in
sphinx-rtd-theme==3.0.1
# via -r requirements-readthedocs.in
sphinxcontrib-applehelp==2.0.0
# via sphinx
sphinxcontrib-devhelp==2.0.0
# via sphinx
sphinxcontrib-htmlhelp==2.1.0
# via sphinx
sphinxcontrib-jquery==4.1
# via sphinx-rtd-theme
sphinxcontrib-jsmath==1.0.1
# via sphinx
sphinxcontrib-qthelp==2.0.0
# via sphinx
sphinxcontrib-serializinghtml==2.0.0
# via sphinx
sphinxcontrib-tikz==0.4.20
# via -r requirements-readthedocs.in
urllib3==2.2.2
# via requests
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
netifaces2
numba
numba; python_version<"3.13" # numba doesn't yet support 3.13
james-smith-za marked this conversation as resolved.
Show resolved Hide resolved
numpy
pytest
pytest-asyncio
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ llvmlite==0.41.1
# via numba
netifaces2==0.0.22
# via -r requirements.in
numba==0.58.1
numba==0.58.1 ; python_version < "3.13"
# via -r requirements.in
numpy==1.24.4
# via
Expand Down
Loading