Skip to content

Commit

Permalink
chore: support Python 3.12 (#226)
Browse files Browse the repository at this point in the history
Signed-off-by: SdgJlbl <[email protected]>
  • Loading branch information
SdgJlbl authored Jul 24, 2024
1 parent 1412f88 commit 5c3d3e4
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 20 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/main-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ jobs:
repository: substra/substra
path: substra

- uses: actions/[email protected]
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-${{ env.pythonLocation }}-pip-${{ hashFiles('substrafl/pyproject.toml') }}-${{ hashFiles ('substrafl/docs/requirements.txt') }}-${{ hashFiles('substrafl/benchmark/camelyon/requirements.txt') }}
# - uses: actions/[email protected]
# id: cache
# with:
# path: ${{ env.pythonLocation }}
# key: ${{ runner.os }}-${{ env.pythonLocation }}-pip-${{ hashFiles('substrafl/pyproject.toml') }}-${{ hashFiles ('substrafl/docs/requirements.txt') }}-${{ hashFiles('substrafl/benchmark/camelyon/requirements.txt') }}

- name: Install package
run: |
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/validate-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-22.04]
python: ["3.9", "3.10", "3.11"]
python: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.11"

- uses: actions/[email protected]
id: cache
Expand Down Expand Up @@ -105,11 +105,16 @@ jobs:
make clean html
benchmark:
runs-on: ubuntu-22.04
name: benchmark-${{ matrix.python }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
python: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/setup-python@v5
with:
python-version: 3.11
python-version: 3.12

- uses: actions/checkout@v4
with:
Expand Down
8 changes: 4 additions & 4 deletions benchmark/camelyon/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
tqdm==4.66.3
numpy==1.24.3
scikit-learn==1.5.0
torch==2.0.1
torchvision==0.15.2
numpy==1.26.4
scikit-learn==1.5.1
torch==2.3.0
torchvision==0.18.0
--extra-index-url https://download.pytorch.org/whl/cpu
6 changes: 3 additions & 3 deletions benchmark/camelyon/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ def substrafl_fed_avg(
)

pypi_dependencies = [
"numpy==1.24.3",
"torch==2.0.1",
"scikit-learn==1.3.1",
"numpy==1.26.4",
"torch==2.3.0",
"scikit-learn==1.5.1",
]
if not torch_gpu:
pypi_dependencies += ["--extra-index-url https://download.pytorch.org/whl/cpu"]
Expand Down
1 change: 1 addition & 0 deletions changes/226.added
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Python 3.12 support
2 changes: 1 addition & 1 deletion docs/api/algorithms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ TorchFedAvgAlgo
TorchScaffoldAlgo
-----------------

.. automodule:: substrafl.algorithms.pytorch.torch_scaffold_algo
.. autoclass:: substrafl.algorithms.pytorch.torch_scaffold_algo.TorchScaffoldAlgo
:private-members: _local_train, _local_predict, _scaffold_parameters_update, _save_predictions
:inherited-members:

Expand Down
2 changes: 2 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@
("py:class", "FieldInfo"),
("py:class", "ConfigDict"),
("py:class", "ComputedFieldInfo"),
("py:class", "CUpdateRule"),
("py:class", "substrafl.algorithms.pytorch.torch_scaffold_algo.CUpdateRule"),
]

html_css_files = [
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dynamic = ["version"]
readme = "README.md"
dependencies = [
"numpy>=1.24,<2.0",
"cloudpickle>=1.6.0",
"substra~=0.53.0",
"substratools~=0.21.4",
"substra~=0.54.0a1",
"substratools~=0.22.0a2",
"pydantic>=2.3.0,<3.0",
"pip>=21.2",
"tqdm",
Expand Down
2 changes: 1 addition & 1 deletion substrafl/remote/register/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# minimal and maximal values of Python 3 minor versions supported
# we need to store this as integer, else "3.11" < "3.9" (string comparison)
MINIMAL_PYTHON_VERSION = 9 # 3.9
MAXIMAL_PYTHON_VERSION = 11 # 3.11
MAXIMAL_PYTHON_VERSION = 12 # 3.12

_DEFAULT_BASE_DOCKER_IMAGE = "python:{python_version}-slim"

Expand Down

0 comments on commit 5c3d3e4

Please sign in to comment.