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

Support Python 3.13 #511

Merged
merged 8 commits into from
Feb 20, 2025
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
1 change: 1 addition & 0 deletions .cspell/library_terms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ pytest
PYTHONHASHSEED
pytorch
pyupgrade
pywinpty
qualnames
quickstart
randn
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ body:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
validations:
required: true
- type: input
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check_todos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: 3.12
python-version: 3.13
- name: Upgrade pip
run: python -m pip install --upgrade pip
- name: Install Ruff
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
# `uv` manages its own version of Python.
# For speed, we use the same version for both, but in principle these could
# differ.
python-version: 3.12
python-version: 3.13
- name: Set up uv cache directory location (Linux/Mac)
run: echo "UV_CACHE_DIR=${{ runner.temp }}/.uv-cache" >> $GITHUB_ENV
if: runner.os != 'Windows'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ jobs:
runs-on: ubuntu-latest
env:
# Set the Python version that `uv` will use for its virtual environment.
UV_PYTHON: 3.12
UV_PYTHON: 3.13
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
# Note that this is just the version of Python that we use to run `uv` with.
# `uv` manages its own version of Python.
# For speed, we use the same version for both, but in principle these could differ.
python-version: 3.12
python-version: 3.13
- name: Set up uv cache directory location
run: echo "UV_CACHE_DIR=${{ runner.temp }}/.uv-cache" >> $GITHUB_ENV
- name: Restore uv cache
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pre_commit_autoupdate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ jobs:
fi

# Pre-commit setup and autoupdate steps
- name: Set up Python 3.12
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: 3.12
python-version: 3.13
# Re-enable when going public
# cache: pip
- name: Upgrade Pip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre_commit_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
env:
# Set the Python version that `uv` will use for its virtual environment.
UV_PYTHON: 3.12
UV_PYTHON: 3.13
steps:
- uses: actions/checkout@v4
- name: Set up base Python
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Set up base Python
uses: actions/setup-python@v5
with:
python-version: 3.12
python-version: 3.13
- name: Install and upgrade build tools
run: |
python -m pip install --upgrade pip
Expand Down Expand Up @@ -54,6 +54,7 @@ jobs:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
os:
- ubuntu-latest
- windows-latest
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ jobs:
strategy:
fail-fast: false
matrix:
# Note that we only do type checking on Python 3.12.
# Note that we only do type checking on Python 3.13 (the latest Python version).
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
os:
- ubuntu-latest
- windows-latest
Expand Down Expand Up @@ -65,21 +66,21 @@ jobs:
--ignore=tests/test_examples.py
-W "error::vanguard.utils.UnseededRandomWarning"
-m "no_beartype"
if: matrix.python-version == '3.12'
if: matrix.python-version == '3.13'
- name: Test with pytest (and type checking)
run: >
uv run pytest
--ignore=tests/test_examples.py
-W "error::vanguard.utils.UnseededRandomWarning"
-m "not no_beartype"
--beartype-packages="vanguard"
if: matrix.python-version == '3.12'
if: matrix.python-version == '3.13'
- name: Run all tests
run: >
uv run pytest
--ignore=tests/test_examples.py
-W "error::vanguard.utils.UnseededRandomWarning"
if: matrix.python-version != '3.12'
if: matrix.python-version != '3.13'
- name: Minimize UV cache
run: uv cache prune --ci
if: always()
1 change: 1 addition & 0 deletions .github/workflows/unittests_lowest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
os:
- ubuntu-latest
- windows-latest
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/uv_lock_autoupdate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ jobs:
fi

# uv setup and lockfile upgrading steps
- name: Set up Python 3.12
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: 3.12
python-version: 3.13
cache: pip
- name: Upgrade Pip
run: python -m pip install --upgrade pip
Expand Down
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.12
3.13
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.12"
python: "3.13"

sphinx:
configuration: docs/source/conf.py
Expand Down
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Version 4 will be the first stable version.

### Added

-
- Support for Python 3.13. (https://github.com/gchq/Vanguard/pull/511)

### Fixed

Expand All @@ -22,7 +22,8 @@ Version 4 will be the first stable version.

### Removed

-
- [BREAKING CHANGE] Removed support for old versions of some dependencies; most importantly, we no longer support
NumPy 1.x. (https://github.com/gchq/Vanguard/pull/511)

### Deprecated

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ pip install -r requirements-docs.txt --no-deps
from the repo root. Note that the pinned dependencies are not guaranteed to work on Windows or macOS.

In both cases, these commands should be run in a fresh virtual environment (to avoid any issues with already-existing
packages), and on Python 3.12.
packages), and on Python 3.13.

### Building the documentation

Expand Down
25 changes: 15 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Typing :: Typed",
]
license = {file = "LICENSE.md"}
Expand All @@ -35,17 +36,18 @@ dependencies = [
"kmedoids>=0.3.3", # first version with prebuilt wheels; earlier versions require a rust toolchain to build
"kmedoids>=0.4; python_version>='3.11'", # earlier versions don't have prebuilt wheels for python 3.11
"kmedoids>=0.4.4; python_version>='3.12'", # earlier versions don't have prebuilt wheels for python 3.12
"matplotlib>=3.5", # earlier versions don't install properly on Windows
"matplotlib>=3.6; python_version>='3.11'", # earlier versions don't install properly on Windows
"numpy>=1.21", # numpy.typing introduced in 1.21
"numpy>=1.26; python_version>='3.12'", # 1.25 and earlier require distutils, which was removed in 3.12
"kmedoids>=0.5.3; python_version>='3.13'", # earlier versions don't have prebuilt wheels for python 3.13
"matplotlib>=3.8.4", # first version to support numpy 2
"numpy>=2", # modern versions of packages are incompatible with numpy<2
"numpy>=2.1.0; python_version>='3.13'", # first version to support python 3.13
"pandas>=2",
"pandas>=2.2.3; python_version>='3.13'", # earlier versions don't provide prebuilt wheels for python 3.13
"scikit-learn>=1.5.0", # CVE-2024-5206 affects versions earlier than 1.5.0
"scipy>=1.4", # earlier versions fail to build with recent setuptools versions
"scipy>=1.12; python_version>='3.12'", # earlier versions don't provide prebuilt wheels for python 3.12
"torch>=2.2", # torch.optim.LRScheduler made public in 2.0.0;
# versions <2.2 have issues with C library dependencies in our CI
"typing_extensions>=4.4", # @override introduced in 4.4
"scikit-learn>=1.6.0; python_version>='3.13'", # earlier versions don't provide prebuilt wheels for python 3.13
"scipy>=1.13", # first version to support numpy 2
"scipy>=1.14.1; python_version>='3.13'", # earlier versions don't provide prebuilt wheels for python 3.13
"torch>=2.6", # earlier versions have issues in CI in lower-bound tests
"typing_extensions>=4.12", # ParamSpec behaviour improved in 4.12
"urllib3>=2.0.4", # BaseHttpResponse added to urllib3.__all__ in 2.0.4
]

Expand Down Expand Up @@ -117,7 +119,6 @@ constraint-dependencies = [
"six>=1.16; python_version>='3.10'", # earlier versions don't work on 3.10+
"pyzmq>=26",
"contourpy>=1.1; python_version>='3.11'",
"nvidia-nvjitlink-cu12>=12.6.77", # torch CUDA dependency
"lxml>=4.7.1", # earlier versions fail to build to missing libxml2
"argon2-cffi>=19", # earlier versions have issues building on Linux
"bleach>=1", # some pre-1.0 versions fail to build
Expand All @@ -127,8 +128,12 @@ constraint-dependencies = [
"pywin32>=302; python_version>='3.10'", # first version to support 3.10
"pywin32>=303; python_version>='3.11'", # first version to support 3.11
"pywin32>=306; python_version>='3.12'", # first version to support 3.12
"pywin32>=307; python_version>='3.13'", # first version to support 3.13
"wheel>=0.30", # picking a too-low version of this was causing CI failures that couldn't be replicated locally,
# so this is a guessed lower bound
"cffi>=1.17; python_version>='3.13'",
"pywinpty>=2.0.14; python_version>='3.13'",
"pillow>=11; python_version>='3.13'",
]

# force the lockfile to be split by Python version, ensuring we get the latest dependencies for each version
Expand Down
37 changes: 19 additions & 18 deletions requirements-docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.
alabaster==0.7.16 ; python_full_version < '3.10'
alabaster==1.0.0 ; python_full_version >= '3.10'
appnope==0.1.4 ; sys_platform == 'darwin'
appnope==0.1.4 ; (python_full_version < '3.13' and sys_platform == 'darwin') or (os_name != 'nt' and sys_platform == 'darwin')
asttokens==3.0.0
attrs==25.1.0
babel==2.17.0
Expand Down Expand Up @@ -69,18 +69,19 @@ networkx==3.2.1 ; python_full_version < '3.10'
networkx==3.4.2 ; python_full_version >= '3.10'
numpy==2.0.2 ; python_full_version < '3.10'
numpy==2.2.3 ; python_full_version >= '3.10'
nvidia-cublas-cu12==12.1.3.1 ; platform_machine == 'x86_64' and sys_platform == 'linux'
nvidia-cuda-cupti-cu12==12.1.105 ; platform_machine == 'x86_64' and sys_platform == 'linux'
nvidia-cuda-nvrtc-cu12==12.1.105 ; platform_machine == 'x86_64' and sys_platform == 'linux'
nvidia-cuda-runtime-cu12==12.1.105 ; platform_machine == 'x86_64' and sys_platform == 'linux'
nvidia-cudnn-cu12==9.1.0.70 ; platform_machine == 'x86_64' and sys_platform == 'linux'
nvidia-cufft-cu12==11.0.2.54 ; platform_machine == 'x86_64' and sys_platform == 'linux'
nvidia-curand-cu12==10.3.2.106 ; platform_machine == 'x86_64' and sys_platform == 'linux'
nvidia-cusolver-cu12==11.4.5.107 ; platform_machine == 'x86_64' and sys_platform == 'linux'
nvidia-cusparse-cu12==12.1.0.106 ; platform_machine == 'x86_64' and sys_platform == 'linux'
nvidia-nccl-cu12==2.20.5 ; platform_machine == 'x86_64' and sys_platform == 'linux'
nvidia-nvjitlink-cu12==12.8.61 ; platform_machine == 'x86_64' and sys_platform == 'linux'
nvidia-nvtx-cu12==12.1.105 ; platform_machine == 'x86_64' and sys_platform == 'linux'
nvidia-cublas-cu12==12.4.5.8 ; (python_full_version < '3.13' and platform_machine == 'x86_64' and sys_platform == 'linux') or (os_name != 'nt' and platform_machine == 'x86_64' and sys_platform == 'linux')
nvidia-cuda-cupti-cu12==12.4.127 ; (python_full_version < '3.13' and platform_machine == 'x86_64' and sys_platform == 'linux') or (os_name != 'nt' and platform_machine == 'x86_64' and sys_platform == 'linux')
nvidia-cuda-nvrtc-cu12==12.4.127 ; (python_full_version < '3.13' and platform_machine == 'x86_64' and sys_platform == 'linux') or (os_name != 'nt' and platform_machine == 'x86_64' and sys_platform == 'linux')
nvidia-cuda-runtime-cu12==12.4.127 ; (python_full_version < '3.13' and platform_machine == 'x86_64' and sys_platform == 'linux') or (os_name != 'nt' and platform_machine == 'x86_64' and sys_platform == 'linux')
nvidia-cudnn-cu12==9.1.0.70 ; (python_full_version < '3.13' and platform_machine == 'x86_64' and sys_platform == 'linux') or (os_name != 'nt' and platform_machine == 'x86_64' and sys_platform == 'linux')
nvidia-cufft-cu12==11.2.1.3 ; (python_full_version < '3.13' and platform_machine == 'x86_64' and sys_platform == 'linux') or (os_name != 'nt' and platform_machine == 'x86_64' and sys_platform == 'linux')
nvidia-curand-cu12==10.3.5.147 ; (python_full_version < '3.13' and platform_machine == 'x86_64' and sys_platform == 'linux') or (os_name != 'nt' and platform_machine == 'x86_64' and sys_platform == 'linux')
nvidia-cusolver-cu12==11.6.1.9 ; (python_full_version < '3.13' and platform_machine == 'x86_64' and sys_platform == 'linux') or (os_name != 'nt' and platform_machine == 'x86_64' and sys_platform == 'linux')
nvidia-cusparse-cu12==12.3.1.170 ; (python_full_version < '3.13' and platform_machine == 'x86_64' and sys_platform == 'linux') or (os_name != 'nt' and platform_machine == 'x86_64' and sys_platform == 'linux')
nvidia-cusparselt-cu12==0.6.2 ; (python_full_version < '3.13' and platform_machine == 'x86_64' and sys_platform == 'linux') or (os_name != 'nt' and platform_machine == 'x86_64' and sys_platform == 'linux')
nvidia-nccl-cu12==2.21.5 ; (python_full_version < '3.13' and platform_machine == 'x86_64' and sys_platform == 'linux') or (os_name != 'nt' and platform_machine == 'x86_64' and sys_platform == 'linux')
nvidia-nvjitlink-cu12==12.4.127 ; (python_full_version < '3.13' and platform_machine == 'x86_64' and sys_platform == 'linux') or (os_name != 'nt' and platform_machine == 'x86_64' and sys_platform == 'linux')
nvidia-nvtx-cu12==12.4.127 ; (python_full_version < '3.13' and platform_machine == 'x86_64' and sys_platform == 'linux') or (os_name != 'nt' and platform_machine == 'x86_64' and sys_platform == 'linux')
packaging==24.2
pandas==2.2.3
pandocfilters==1.5.1
Expand All @@ -107,7 +108,7 @@ requests==2.32.3
rpds-py==0.22.3
scikit-learn==1.6.1
scipy==1.13.1 ; python_full_version < '3.10'
scipy==1.15.1 ; python_full_version >= '3.10'
scipy==1.15.2 ; python_full_version >= '3.10'
setuptools==75.8.0 ; python_full_version >= '3.12'
six==1.17.0
snowballstemmer==2.2.0
Expand All @@ -125,16 +126,16 @@ sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
stack-data==0.6.3
sympy==1.13.3
sympy==1.13.1
threadpoolctl==3.5.0
tinycss2==1.4.0
tomli==2.2.1 ; python_full_version < '3.11'
torch==2.4.1
torch==2.6.0
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
triton==3.0.0 ; python_full_version < '3.13' and platform_machine == 'x86_64' and sys_platform == 'linux'
typeguard==4.4.1 ; python_full_version < '3.10'
triton==3.2.0 ; (python_full_version < '3.13' and platform_machine == 'x86_64' and sys_platform == 'linux') or (os_name != 'nt' and platform_machine == 'x86_64' and sys_platform == 'linux')
typeguard==4.4.2 ; python_full_version < '3.10'
typing-extensions==4.12.2
tzdata==2025.1
urllib3==2.3.0
Expand Down
Loading
Loading