Skip to content

Commit

Permalink
Support Python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinfriede committed Jun 26, 2024
1 parent e7e9a21 commit f4edb43
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 8 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,15 @@ jobs:
# only test oldest and newest version of torch
torch-version: ["1.11.0", "2.2.2"]
exclude:
# Check latest versions here: https://download.pytorch.org/whl/torch/
#
# PyTorch now fully supports Python=<3.11
# see: https://github.com/pytorch/pytorch/issues/86566
#
# PyTorch does not support Python 3.12 (all platforms)
# PyTorch does now support Python 3.12 (macOS only 2.2)
# see: https://github.com/pytorch/pytorch/issues/110436
- python-version: "3.12"
torch-version: "1.11.0"
# PyTorch<1.13.0 does only support Python=<3.10
# On macOS and Windows, 1.13.x is also not supported for Python>=3.10
- python-version: "3.11"
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,25 @@ jobs:
matrix:
os: [ubuntu-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
torch-version: ["1.11.0", "1.12.1", "1.13.1", "2.0.1", "2.1.2", "2.2.2"]
torch-version: ["1.11.0", "1.12.1", "1.13.1", "2.0.1", "2.1.2", "2.2.2", "2.3.1"]
exclude:
# Check latest versions here: https://download.pytorch.org/whl/torch/
#
# PyTorch now fully supports Python=<3.11
# see: https://github.com/pytorch/pytorch/issues/86566
#
# PyTorch does not support Python 3.12 (all platforms)
# PyTorch does now support Python 3.12 (Linux) for 2.2.0 and newer
# see: https://github.com/pytorch/pytorch/issues/110436
- python-version: "3.12"
torch-version: "1.11.0"
- python-version: "3.12"
torch-version: "1.12.1"
- python-version: "3.12"
torch-version: "1.13.1"
- python-version: "3.12"
torch-version: "2.0.1"
- python-version: "3.12"
torch-version: "2.1.2"
# PyTorch<1.13.0 does only support Python=<3.10
- python-version: "3.11"
torch-version: "1.11.0"
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,15 @@ jobs:
# only test oldest and newest version of torch
torch-version: ["1.11.0", "2.2.2"]
exclude:
# Check latest versions here: https://download.pytorch.org/whl/torch/
#
# PyTorch now fully supports Python=<3.11
# see: https://github.com/pytorch/pytorch/issues/86566
#
# PyTorch does not support Python 3.12 (all platforms)
# see: https://github.com/pytorch/pytorch/issues/110436
- os: windows-latest
python-version: "3.12"
- python-version: "3.12"
torch-version: "1.11.0"
# PyTorch<1.13.0 does only support Python=<3.10
- python-version: "3.11"
torch-version: "1.11.0"
Expand Down
7 changes: 4 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ classifiers =
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: Implementation :: CPython
project_urls =
Documentation = https://tad-dftd3.readthedocs.io/en/latest/
Expand All @@ -23,10 +24,10 @@ project_urls =
[options]
packages = find:
install_requires =
numpy
numpy<2
tad-mctc
torch
python_requires = >=3.8
torch>=1.11,<2.4
python_requires = >=3.8, <3.13
include_package_data = True
package_dir =
=src
Expand Down
9 changes: 9 additions & 0 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@
"""Name of Device."""


# A bug in PyTorch 2.3.0 and 2.3.1 somehow requires manual import of
# `torch._dynamo` to avoid errors with functorch in custom backward
# functions. See https://github.com/pytorch/pytorch/issues/128607.
from tad_mctc._version import __tversion__

if __tversion__ in ((2, 3, 0), (2, 3, 1)):
import torch._dynamo


def pytest_addoption(parser: pytest.Parser) -> None:
"""Set up additional command line options."""

Expand Down
3 changes: 3 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ envlist =
py39-torch{1110,1121,1131,201,212,222},
py310-torch{1110,1121,1131,201,212,222},
py311-torch{1131,201,212,221}
py312-torch{222,231}

[testenv]
setenv =
Expand All @@ -39,6 +40,8 @@ deps =
torch220: torch==2.2.0
torch221: torch==2.2.1
torch222: torch==2.2.2
torch230: torch==2.3.0
torch231: torch==2.3.1
.[tox]
commands =
pytest -vv {posargs: \
Expand Down

0 comments on commit f4edb43

Please sign in to comment.