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

chore: add python 3.11 support #169

Merged
merged 7 commits into from
Oct 9, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/main-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-22.04]
python: ["3.8", "3.9", "3.10"]
python: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .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.8", "3.9", "3.10"]
python: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows-subprocess-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
os: [windows-latest]
python: ["3.8", "3.9", "3.10"]
python: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## \[Unreleased\]

### Added

- Support on Python 3.11 ([#169](https://github.com/Substra/substrafl/pull/169))

## [0.41.1](https://github.com/Substra/substrafl/releases/tag/0.41.1) - 2023-10-06

### Fixed
Expand Down
6 changes: 3 additions & 3 deletions benchmark/camelyon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Being able to compare substrafl local speed to a full torch example with a varia

**All the commands should be run from `benchmark/camelyon`**

In a new python 3.10 environment :
In a new python 3.11 environment :

```sh
pip install -r requirements.txt
Expand All @@ -33,13 +33,13 @@ Please ensure that your python installation is complete. For Mac users if you ge
UserWarning: Could not import the lzma module. Your installed Python is incomplete. Attempting to use lzma compression will result in a RuntimeError.
```

You'll need to uninstall python 3.10, and install the `xz` package :
You'll need to uninstall python 3.11, and install the `xz` package :

```sh
brew install xz
```

then reinstall python 3.10.
then reinstall python 3.11.

### Getting Started

Expand Down
6 changes: 3 additions & 3 deletions benchmark/camelyon/pure_substrafl/register_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def add_duplicated_dataset(
data_sample_folder: os.PathLike,
asset_keys: dict,
msp_id: str,
kind: str = TaskType.TRAIN,
kind: str = TaskType.TRAIN.value,
) -> dict:
"""Update asset_keys.msp_id.{kind}_data_sample_keys so there is exactly `nb_data_sample` keys
by adding the `data_sample_folder` as a data sample with the provided `client` as many times as it's need
Expand Down Expand Up @@ -126,7 +126,7 @@ def add_duplicated_dataset(
}
msp_id (str): asset_keys key where to find the registered assets for the given client
kind (str, optional): Kind of data sample to add, either train or test. Defaults to
TaskType.TRAIN.
TaskType.TRAIN.value.

Returns:
dict: The updated asset_keys.
Expand Down Expand Up @@ -193,7 +193,7 @@ def get_train_data_nodes(
data_sample_folder=train_folder,
asset_keys=asset_keys,
msp_id=msp_id,
kind=TaskType.TRAIN,
kind=TaskType.TRAIN.value,
)

train_data_nodes.append(
Expand Down
8 changes: 4 additions & 4 deletions benchmark/camelyon/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tqdm==4.62.3
numpy==1.23.1
scikit-learn==1.1.1
torch==1.13.1
torchvision==0.14.1
numpy==1.24.3
scikit-learn==1.3.1
torch==2.0.1
torchvision==0.15.2
2 changes: 1 addition & 1 deletion benchmark/camelyon/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def substrafl_fed_avg(
# Dependencies
base = Path(__file__).parent
dependencies = Dependency(
pypi_dependencies=["numpy==1.23.5", "torch==2.0.1", "scikit-learn==1.1.1"],
pypi_dependencies=["numpy==1.24.3", "torch==2.0.1", "scikit-learn==1.3.1"],
local_code=[base / "common", base / "weldon_fedavg.py"],
# Keeping editable_mode=True to ensure nightly test benchmarks are ran against main substrafl git ref
editable_mode=True,
Expand Down
2 changes: 1 addition & 1 deletion docker/substrafl-tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.10
FROM python:3.11

WORKDIR /usr/src/app

Expand Down
2 changes: 1 addition & 1 deletion examples/template/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def __init__(self):
# Algo dependencies
# =================

algo_deps = Dependency(pypi_dependencies=["numpy==1.23.1", "torch==1.12.0"])
algo_deps = Dependency(pypi_dependencies=["numpy==1.24.3", "torch==2.0.1"])

# %%
# Federated Learning strategies
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
],
keywords=["substrafl"],
packages=find_packages(exclude=["tests*", "benchmark*"]),
# Not compatible with substratools 0.8.0 because
# that release is private and in the Docker container
# it has access only to the public PyPi
install_requires=[
"numpy>=1.20.3, <1.24",
"numpy>=1.24",
"cloudpickle>=1.6.0",
"substra~=0.48.1",
"substratools~=0.21.0",
Expand Down
4 changes: 2 additions & 2 deletions substrafl/remote/register/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
MINIMAL_DOCKER_SUBSTRATOOLS_VERSION = "0.16.0"

# minimal and maximal values of Python 3 minor versions supported
# we need to store this as integer, else "3.10" < "3.9" (string comparison)
# we need to store this as integer, else "3.11" < "3.9" (string comparison)
MINIMAL_PYTHON_VERSION = 8 # 3.8
MAXIMAL_PYTHON_VERSION = 10 # 3.10
MAXIMAL_PYTHON_VERSION = 11 # 3.11

_DEFAULT_SUBSTRATOOLS_IMAGE = "ghcr.io/substra/substra-tools:\
{substratools_version}-nvidiacuda11.8.0-base-ubuntu22.04-python{python_version}"
Expand Down
2 changes: 1 addition & 1 deletion tests/remote/register/test_register.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_check_python_version(version):
register._check_python_version(version)


@pytest.mark.parametrize("version", ["3.8", "3.9", "3.10"])
@pytest.mark.parametrize("version", ["3.8", "3.9", "3.10", "3.11"])
def test_check_python_version_valid(version):
"""Does not raise for supported versions"""
register._check_python_version(version)
Expand Down
Loading