Skip to content

Commit d81999c

Browse files
authored
feat(workflows): enable Python 3.12 build (#216)
1 parent 330ef57 commit d81999c

File tree

4 files changed

+24
-11
lines changed

4 files changed

+24
-11
lines changed

.github/workflows/build.yml

+15-6
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,12 @@ jobs:
5656
- name: Set up Python
5757
uses: actions/setup-python@v5
5858
with:
59-
python-version: "3.8 - 3.11" # sync with requires-python in pyproject.toml
59+
python-version: "3.8 - 3.12" # sync with requires-python in pyproject.toml
6060
update-environment: true
6161

62+
- name: Install dependencies
63+
run: python -m pip install --upgrade pip setuptools wheel build
64+
6265
- name: Set __release__
6366
if: |
6467
startsWith(github.ref, 'refs/tags/') ||
@@ -69,9 +72,6 @@ jobs:
6972
- name: Print version
7073
run: python setup.py --version
7174

72-
- name: Install dependencies
73-
run: python -m pip install --upgrade pip setuptools wheel build
74-
7575
- name: Build sdist and pure-Python wheel
7676
run: python -m build
7777
env:
@@ -120,6 +120,9 @@ jobs:
120120
python-version: ${{ matrix.python-version }}
121121
update-environment: true
122122

123+
- name: Install dependencies
124+
run: python -m pip install --upgrade pip setuptools wheel build
125+
123126
- name: Set __release__
124127
if: |
125128
startsWith(github.ref, 'refs/tags/') ||
@@ -155,7 +158,7 @@ jobs:
155158
strategy:
156159
matrix:
157160
os: [ubuntu-latest]
158-
python-version: ["3.9", "3.10", "3.11"] # sync with requires-python in pyproject.toml
161+
python-version: ["3.9", "3.10", "3.11", "3.12"] # sync with requires-python in pyproject.toml
159162
fail-fast: false
160163
timeout-minutes: 60
161164
steps:
@@ -171,6 +174,9 @@ jobs:
171174
python-version: ${{ matrix.python-version }}
172175
update-environment: true
173176

177+
- name: Install dependencies
178+
run: python -m pip install --upgrade pip setuptools wheel build
179+
174180
- name: Set __release__
175181
if: |
176182
startsWith(github.ref, 'refs/tags/') ||
@@ -249,9 +255,12 @@ jobs:
249255
uses: actions/setup-python@v5
250256
if: startsWith(github.ref, 'refs/tags/')
251257
with:
252-
python-version: "3.8 - 3.11" # sync with requires-python in pyproject.toml
258+
python-version: "3.8 - 3.12" # sync with requires-python in pyproject.toml
253259
update-environment: true
254260

261+
- name: Install dependencies
262+
run: python -m pip install --upgrade pip setuptools wheel build
263+
255264
- name: Set __release__
256265
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
257266
run: |

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
### Added
1515

16-
-
16+
- Enable CI workflow to build CXX/CUDA extension for Python 3.12 by [@XuehaiPan](https://github.com/XuehaiPan) in [#216](https://github.com/metaopt/torchopt/pull/216).
1717

1818
### Changed
1919

Makefile

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ install:
2222
install-editable:
2323
$(PYTHON) -m pip install --upgrade pip
2424
$(PYTHON) -m pip install --upgrade setuptools wheel
25-
$(PYTHON) -m pip install torch numpy pybind11 cmake
25+
$(PYTHON) -m pip install --upgrade pybind11 cmake
26+
$(PYTHON) -m pip install torch numpy
2627
USE_FP16=ON TORCH_CUDA_ARCH_LIST=Auto $(PYTHON) -m pip install -vvv --no-build-isolation --editable .
2728

2829
install-e: install-editable # alias
@@ -114,7 +115,7 @@ addlicense-install: go-install
114115
pytest: test-install
115116
$(PYTHON) -m pytest --version
116117
cd tests && $(PYTHON) -c 'import $(PROJECT_PATH)' && \
117-
$(PYTHON) -m pytest --verbose --color=yes --durations=0 \
118+
$(PYTHON) -m pytest --verbose --color=yes \
118119
--cov="$(PROJECT_PATH)" --cov-config=.coveragerc --cov-report=xml --cov-report=term-missing \
119120
$(PYTESTOPTS) .
120121

pyproject.toml

+5-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ authors = [
2222
license = { text = "Apache License, Version 2.0" }
2323
keywords = [
2424
"PyTorch",
25-
"functorch",
25+
"FuncTorch",
2626
"JAX",
2727
"Meta-Learning",
2828
"Optimizer",
@@ -38,6 +38,8 @@ classifiers = [
3838
"Programming Language :: Python :: 3.9",
3939
"Programming Language :: Python :: 3.10",
4040
"Programming Language :: Python :: 3.11",
41+
"Programming Language :: Python :: 3.12",
42+
"Programming Language :: Python :: Implementation :: CPython",
4143
"Operating System :: Microsoft :: Windows",
4244
"Operating System :: POSIX :: Linux",
4345
"Operating System :: MacOS",
@@ -179,7 +181,7 @@ test-command = """
179181
line-length = 100
180182
skip-string-normalization = true
181183
# Sync with requires-python
182-
target-version = ["py38", "py39", "py310", "py311"]
184+
target-version = ["py38"]
183185

184186
[tool.isort]
185187
atomic = true
@@ -314,6 +316,7 @@ filterwarnings = [
314316
"error",
315317
'ignore:Explicitly requested dtype float64 requested in .* is not available, and will be truncated to dtype float32\.:UserWarning',
316318
'ignore:jax\.numpy\.DeviceArray is deprecated\. Use jax\.Array\.:DeprecationWarning',
319+
'ignore:(ast\.Str|ast\.NameConstant|Attribute s) is deprecated and will be removed in Python 3\.14:DeprecationWarning',
317320
'ignore:.*functorch.*deprecate.*:UserWarning',
318321
'ignore:.*Apple Paravirtual device.*:UserWarning',
319322
'ignore:.*NVML.*:UserWarning',

0 commit comments

Comments
 (0)