From 1991681036505f634a74dda8c6aa3c2e452a5d15 Mon Sep 17 00:00:00 2001 From: Chong Shen Ng Date: Tue, 21 May 2024 11:39:28 +0100 Subject: [PATCH 01/19] Omit one directory and test CI skipping [skip ci] --- .github/workflows/e2e.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 57802e598546..46cb55fca629 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -83,10 +83,10 @@ jobs: import tensorflow_datasets as tfds tfds.load(name='iris', split=tfds.Split.TRAIN) - - directory: opacus - dataset: | - from torchvision.datasets import CIFAR10 - CIFAR10('./data', download=True) + # - directory: opacus + # dataset: | + # from torchvision.datasets import CIFAR10 + # CIFAR10('./data', download=True) - directory: pytorch-lightning dataset: | From 1ade3f11a860870a9e24004d47793fe22d5d248b Mon Sep 17 00:00:00 2001 From: Chong Shen Ng Date: Tue, 21 May 2024 12:27:20 +0100 Subject: [PATCH 02/19] Add cache for dependencies --- .github/workflows/e2e.yml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 46cb55fca629..fc472908e0c9 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -83,10 +83,10 @@ jobs: import tensorflow_datasets as tfds tfds.load(name='iris', split=tfds.Split.TRAIN) - # - directory: opacus - # dataset: | - # from torchvision.datasets import CIFAR10 - # CIFAR10('./data', download=True) + - directory: opacus + dataset: | + from torchvision.datasets import CIFAR10 + CIFAR10('./data', download=True) - directory: pytorch-lightning dataset: | @@ -122,6 +122,20 @@ jobs: uses: ./.github/actions/bootstrap with: python-version: 3.8 + # virtualenv cache should depends on OS, Python version and `poetry.lock` (and optionally workflow files). + - name: Cache Packages + id: cache-packages + uses: actions/cache@v4 + with: + # Cache directory used by Poetry for Unix, described here: + # https://python-poetry.org/docs/configuration/#cache-dir + path: ~/.config/pypoetry + key: poetry-local-${{ runner.os }}-3.8-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('.github/workflows/*.yml') }} + restore-keys: | + poetry-local-${{ runner.os }}-3.8- + - name: Check cache hits + if: ${{ steps.cache-packages.outputs.cache-hit != 'true' }} + run: echo "No cache hit, installing from scratch" - name: Install dependencies run: python -m poetry install - name: Install Flower wheel from artifact store From c57d55d8e080a396cca8e204a5cd0c0d7e77b998 Mon Sep 17 00:00:00 2001 From: Chong Shen Ng Date: Tue, 21 May 2024 12:44:08 +0100 Subject: [PATCH 03/19] Add conditional install on cache miss --- .github/workflows/e2e.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index fc472908e0c9..2221668790bd 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -129,15 +129,17 @@ jobs: with: # Cache directory used by Poetry for Unix, described here: # https://python-poetry.org/docs/configuration/#cache-dir - path: ~/.config/pypoetry + path: | + ~/.config/pypoetry + ~/.local key: poetry-local-${{ runner.os }}-3.8-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('.github/workflows/*.yml') }} restore-keys: | poetry-local-${{ runner.os }}-3.8- - - name: Check cache hits + - name: Install dependencies if no cache hits if: ${{ steps.cache-packages.outputs.cache-hit != 'true' }} - run: echo "No cache hit, installing from scratch" - - name: Install dependencies - run: python -m poetry install + run: echo "No cache hit, installing from scratch" && python -m poetry install + # - name: Install dependencies + # run: python -m poetry install - name: Install Flower wheel from artifact store if: ${{ github.repository == 'adap/flower' && !github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]' }} run: | From 32d1fd10b6e4f2f64209d5bbcb6d785c9c94ef72 Mon Sep 17 00:00:00 2001 From: Chong Shen Ng Date: Tue, 21 May 2024 12:57:13 +0100 Subject: [PATCH 04/19] Revert conditional action to install always --- .github/workflows/e2e.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 2221668790bd..800d7c0cfb01 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -135,11 +135,8 @@ jobs: key: poetry-local-${{ runner.os }}-3.8-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('.github/workflows/*.yml') }} restore-keys: | poetry-local-${{ runner.os }}-3.8- - - name: Install dependencies if no cache hits - if: ${{ steps.cache-packages.outputs.cache-hit != 'true' }} - run: echo "No cache hit, installing from scratch" && python -m poetry install - # - name: Install dependencies - # run: python -m poetry install + - name: Install dependencies + run: python -m poetry install - name: Install Flower wheel from artifact store if: ${{ github.repository == 'adap/flower' && !github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]' }} run: | From ee29dee4f1dd3eb6ce6359caed529c97abc231f0 Mon Sep 17 00:00:00 2001 From: Chong Shen Ng Date: Tue, 21 May 2024 13:44:49 +0100 Subject: [PATCH 05/19] Pin setuptools version --- .github/workflows/e2e.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 800d7c0cfb01..2ec691de69ef 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -136,7 +136,9 @@ jobs: restore-keys: | poetry-local-${{ runner.os }}-3.8- - name: Install dependencies - run: python -m poetry install + run: | + python -m pip install 'setuptools==69.5.1' + python -m poetry install - name: Install Flower wheel from artifact store if: ${{ github.repository == 'adap/flower' && !github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]' }} run: | From dd7dfb5d34f300e2c5d80cb798232bea8f9e3bcd Mon Sep 17 00:00:00 2001 From: Chong Shen Ng Date: Tue, 21 May 2024 15:31:16 +0100 Subject: [PATCH 06/19] Remove comment --- .github/workflows/e2e.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 2ec691de69ef..9c25546c3a11 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -122,7 +122,6 @@ jobs: uses: ./.github/actions/bootstrap with: python-version: 3.8 - # virtualenv cache should depends on OS, Python version and `poetry.lock` (and optionally workflow files). - name: Cache Packages id: cache-packages uses: actions/cache@v4 @@ -136,9 +135,7 @@ jobs: restore-keys: | poetry-local-${{ runner.os }}-3.8- - name: Install dependencies - run: | - python -m pip install 'setuptools==69.5.1' - python -m poetry install + run: python -m poetry install - name: Install Flower wheel from artifact store if: ${{ github.repository == 'adap/flower' && !github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]' }} run: | From 921a8a8204dcd28ec8b4175d31f3e86f680ec53a Mon Sep 17 00:00:00 2001 From: Chong Shen Ng Date: Tue, 21 May 2024 20:03:08 +0100 Subject: [PATCH 07/19] Test dataset cache --- .github/workflows/e2e.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 9c25546c3a11..0cfe11f741dc 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -140,6 +140,16 @@ jobs: if: ${{ github.repository == 'adap/flower' && !github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]' }} run: | python -m pip install https://${{ env.ARTIFACT_BUCKET }}/py/${{ needs.wheel.outputs.dir }}/${{ needs.wheel.outputs.short_sha }}/${{ needs.wheel.outputs.whl_path }} + - name: Cache datasets + id: cache-datasets + uses: actions/cache@v4 + with: + path: | + ~/.fastai + ./data + key: datasets-${{ runner.os }} + restore-keys: | + datasets- - name: Download dataset if: ${{ matrix.dataset }} run: python -c "${{ matrix.dataset }}" From db60651d801f8ea577b1eb0afe0580d964d60395 Mon Sep 17 00:00:00 2001 From: Chong Shen Ng Date: Tue, 21 May 2024 20:19:31 +0100 Subject: [PATCH 08/19] Add condition to download dataset --- .github/workflows/e2e.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 0cfe11f741dc..b876471c23df 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -151,7 +151,7 @@ jobs: restore-keys: | datasets- - name: Download dataset - if: ${{ matrix.dataset }} + if: ${{ matrix.dataset }} && ${{ steps.cache-datasets.outputs.cache-hit != 'true' }} run: python -c "${{ matrix.dataset }}" - name: Run edge client test if: ${{ matrix.directory != 'bare-client-auth' }} From ed074f22ff135d94a361e0c28cfd5d4a39c1d9fa Mon Sep 17 00:00:00 2001 From: Chong Shen Ng Date: Tue, 21 May 2024 20:30:19 +0100 Subject: [PATCH 09/19] Update syntax --- .github/workflows/e2e.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index b876471c23df..e6008775dbc0 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -151,7 +151,7 @@ jobs: restore-keys: | datasets- - name: Download dataset - if: ${{ matrix.dataset }} && ${{ steps.cache-datasets.outputs.cache-hit != 'true' }} + if: ${{ (matrix.dataset) && (steps.cache-datasets.outputs.cache-hit != 'true') }} run: python -c "${{ matrix.dataset }}" - name: Run edge client test if: ${{ matrix.directory != 'bare-client-auth' }} From 1c0288f38c34cfa8f4fba10034a6ea41ed782ed4 Mon Sep 17 00:00:00 2001 From: Chong Shen Ng Date: Tue, 21 May 2024 20:42:23 +0100 Subject: [PATCH 10/19] Update keys with additional GitHub context --- .github/workflows/e2e.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index e6008775dbc0..7d13803ceee9 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -131,7 +131,7 @@ jobs: path: | ~/.config/pypoetry ~/.local - key: poetry-local-${{ runner.os }}-3.8-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('.github/workflows/*.yml') }} + key: poetry-local-${{ runner.os }}-3.8-${{ matrix.directory }}-${{ hashFiles('.github/workflows/*.yml') }} restore-keys: | poetry-local-${{ runner.os }}-3.8- - name: Install dependencies @@ -147,7 +147,7 @@ jobs: path: | ~/.fastai ./data - key: datasets-${{ runner.os }} + key: datasets-${{ runner.os }}-${{ matrix.directory }}-${{ hashFiles('.github/workflows/*.yml') }} restore-keys: | datasets- - name: Download dataset From e2a06bddba147d1fa2005d0cbd95c0da2e893e2b Mon Sep 17 00:00:00 2001 From: Chong Shen Ng Date: Tue, 21 May 2024 20:59:18 +0100 Subject: [PATCH 11/19] Remove restore keys --- .github/workflows/e2e.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 7d13803ceee9..0fb6c618dcc4 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -132,8 +132,6 @@ jobs: ~/.config/pypoetry ~/.local key: poetry-local-${{ runner.os }}-3.8-${{ matrix.directory }}-${{ hashFiles('.github/workflows/*.yml') }} - restore-keys: | - poetry-local-${{ runner.os }}-3.8- - name: Install dependencies run: python -m poetry install - name: Install Flower wheel from artifact store @@ -148,10 +146,8 @@ jobs: ~/.fastai ./data key: datasets-${{ runner.os }}-${{ matrix.directory }}-${{ hashFiles('.github/workflows/*.yml') }} - restore-keys: | - datasets- - name: Download dataset - if: ${{ (matrix.dataset) && (steps.cache-datasets.outputs.cache-hit != 'true') }} + if: ${{ matrix.dataset }} run: python -c "${{ matrix.dataset }}" - name: Run edge client test if: ${{ matrix.directory != 'bare-client-auth' }} From 3e3baa71123adf5d86164240aba522382b23c398 Mon Sep 17 00:00:00 2001 From: Chong Shen Ng Date: Tue, 21 May 2024 21:29:57 +0100 Subject: [PATCH 12/19] Add poetry cache --- .github/workflows/e2e.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 0fb6c618dcc4..1f5e6d996d7f 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -118,10 +118,22 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Bootstrap - uses: ./.github/actions/bootstrap + - name: Install poetry + run: pipx install poetry + - name: Set up Python + uses: actions/setup-python@v5 with: python-version: 3.8 + cache: 'poetry' + - name: Install build tools + run: | + python -m pip install -U pip==23.3.1 + python -m pip install -U setuptools==68.2.2 + shell: bash + # - name: Bootstrap + # uses: ./.github/actions/bootstrap + # with: + # python-version: 3.8 - name: Cache Packages id: cache-packages uses: actions/cache@v4 From 503b130537e326cab6051f06e755ca6cd5f00bb6 Mon Sep 17 00:00:00 2001 From: Chong Shen Ng Date: Wed, 22 May 2024 09:31:59 +0100 Subject: [PATCH 13/19] Test cache pip dependencies, update pyproject.toml --- .github/workflows/e2e.yml | 43 +++++++++++++--------------- e2e/bare-client-auth/pyproject.toml | 21 +++++++++----- e2e/bare-https/pyproject.toml | 21 +++++++++----- e2e/bare/pyproject.toml | 21 +++++++++----- e2e/fastai/pyproject.toml | 25 ++++++++++------ e2e/jax/pyproject.toml | 31 ++++++++++++-------- e2e/opacus/pyproject.toml | 27 ++++++++++------- e2e/pandas/pyproject.toml | 33 +++++++++++++-------- e2e/pytorch-lightning/pyproject.toml | 27 ++++++++++------- e2e/pytorch/pyproject.toml | 31 ++++++++++++-------- e2e/scikit-learn/pyproject.toml | 29 +++++++++++-------- e2e/tabnet/pyproject.toml | 35 +++++++++++++--------- e2e/tensorflow/pyproject.toml | 29 ++++++++++++------- 13 files changed, 227 insertions(+), 146 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 1f5e6d996d7f..192d828a4d45 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -118,46 +118,43 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Install poetry - run: pipx install poetry - name: Set up Python uses: actions/setup-python@v5 with: python-version: 3.8 - cache: 'poetry' + cache: 'pip' - name: Install build tools run: | python -m pip install -U pip==23.3.1 - python -m pip install -U setuptools==68.2.2 shell: bash # - name: Bootstrap # uses: ./.github/actions/bootstrap # with: # python-version: 3.8 - - name: Cache Packages - id: cache-packages - uses: actions/cache@v4 - with: - # Cache directory used by Poetry for Unix, described here: - # https://python-poetry.org/docs/configuration/#cache-dir - path: | - ~/.config/pypoetry - ~/.local - key: poetry-local-${{ runner.os }}-3.8-${{ matrix.directory }}-${{ hashFiles('.github/workflows/*.yml') }} + # - name: Cache Packages + # id: cache-packages + # uses: actions/cache@v4 + # with: + # # Cache directory used by Poetry for Unix, described here: + # # https://python-poetry.org/docs/configuration/#cache-dir + # path: | + # ~/.config/pypoetry + # ~/.local + # key: poetry-local-${{ runner.os }}-3.8-${{ matrix.directory }}-${{ hashFiles('.github/workflows/*.yml') }} - name: Install dependencies - run: python -m poetry install + run: python -m pip install . - name: Install Flower wheel from artifact store if: ${{ github.repository == 'adap/flower' && !github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]' }} run: | python -m pip install https://${{ env.ARTIFACT_BUCKET }}/py/${{ needs.wheel.outputs.dir }}/${{ needs.wheel.outputs.short_sha }}/${{ needs.wheel.outputs.whl_path }} - - name: Cache datasets - id: cache-datasets - uses: actions/cache@v4 - with: - path: | - ~/.fastai - ./data - key: datasets-${{ runner.os }}-${{ matrix.directory }}-${{ hashFiles('.github/workflows/*.yml') }} + # - name: Cache datasets + # id: cache-datasets + # uses: actions/cache@v4 + # with: + # path: | + # ~/.fastai + # ./data + # key: datasets-${{ runner.os }}-${{ matrix.directory }}-${{ hashFiles('.github/workflows/*.yml') }} - name: Download dataset if: ${{ matrix.dataset }} run: python -c "${{ matrix.dataset }}" diff --git a/e2e/bare-client-auth/pyproject.toml b/e2e/bare-client-auth/pyproject.toml index 693fec815474..839f0779cc01 100644 --- a/e2e/bare-client-auth/pyproject.toml +++ b/e2e/bare-client-auth/pyproject.toml @@ -1,13 +1,20 @@ [build-system] -requires = ["poetry-core>=1.4.0"] -build-backend = "poetry.core.masonry.api" +requires = ["hatchling"] +build-backend = "hatchling.build" -[tool.poetry] +[project] name = "bare_client_auth_test" version = "0.1.0" description = "Client-auth-enabled bare Federated Learning test with Flower" -authors = ["The Flower Authors "] +authors = [ + { name = "The Flower Authors", email = "hello@flower.ai" }, +] +dependencies = [ + "flwr @ {root:parent:parent:uri}", +] -[tool.poetry.dependencies] -python = "^3.8" -flwr = { path = "../../", develop = true } +[tool.hatch.build.targets.wheel] +packages = ["."] + +[tool.hatch.metadata] +allow-direct-references = true diff --git a/e2e/bare-https/pyproject.toml b/e2e/bare-https/pyproject.toml index 3afb7b57a084..de8aa92cbd02 100644 --- a/e2e/bare-https/pyproject.toml +++ b/e2e/bare-https/pyproject.toml @@ -1,13 +1,20 @@ [build-system] -requires = ["poetry-core>=1.4.0"] -build-backend = "poetry.core.masonry.api" +requires = ["hatchling"] +build-backend = "hatchling.build" -[tool.poetry] +[project] name = "bare_https_test" version = "0.1.0" description = "HTTPS-enabled bare Federated Learning test with Flower" -authors = ["The Flower Authors "] +authors = [ + { name = "The Flower Authors", email = "hello@flower.ai" }, +] +dependencies = [ + "flwr @ {root:parent:parent:uri}", +] -[tool.poetry.dependencies] -python = "^3.8" -flwr = { path = "../../", develop = true } +[tool.hatch.build.targets.wheel] +packages = ["."] + +[tool.hatch.metadata] +allow-direct-references = true diff --git a/e2e/bare/pyproject.toml b/e2e/bare/pyproject.toml index 45ce7ea333af..ba8c1b2b2276 100644 --- a/e2e/bare/pyproject.toml +++ b/e2e/bare/pyproject.toml @@ -1,13 +1,20 @@ [build-system] -requires = ["poetry-core>=1.4.0"] -build-backend = "poetry.core.masonry.api" +requires = ["hatchling"] +build-backend = "hatchling.build" -[tool.poetry] +[project] name = "bare_test" version = "0.1.0" description = "Bare Federated Learning test with Flower" -authors = ["The Flower Authors "] +authors = [ + { name = "The Flower Authors", email = "hello@flower.ai" }, +] +dependencies = [ + "flwr[simulation,rest] @ {root:parent:parent:uri}", +] -[tool.poetry.dependencies] -python = "^3.8" -flwr = { path = "../../", develop = true, extras = ["simulation", "rest"] } +[tool.hatch.build.targets.wheel] +packages = ["."] + +[tool.hatch.metadata] +allow-direct-references = true diff --git a/e2e/fastai/pyproject.toml b/e2e/fastai/pyproject.toml index feed31f6d202..53d3b7e7baf1 100644 --- a/e2e/fastai/pyproject.toml +++ b/e2e/fastai/pyproject.toml @@ -1,15 +1,22 @@ [build-system] -requires = ["poetry-core>=1.4.0"] -build-backend = "poetry.core.masonry.api" +requires = ["hatchling"] +build-backend = "hatchling.build" -[tool.poetry] +[project] name = "quickstart-fastai" version = "0.1.0" description = "Fastai Federated Learning E2E test with Flower" -authors = ["The Flower Authors "] +authors = [ + { name = "The Flower Authors", email = "hello@flower.ai" }, +] +dependencies = [ + "flwr[simulation] @ {root:parent:parent:uri}", + "fastai>=2.7.12,<3.0.0", + "torch>=2.0.0,!=2.0.1,<2.1.0", +] -[tool.poetry.dependencies] -python = ">=3.8,<3.10" -flwr = { path = "../../", develop = true, extras = ["simulation"] } -fastai = "^2.7.12" -torch = ">=2.0.0, !=2.0.1, < 2.1.0" +[tool.hatch.build.targets.wheel] +packages = ["."] + +[tool.hatch.metadata] +allow-direct-references = true diff --git a/e2e/jax/pyproject.toml b/e2e/jax/pyproject.toml index 9a4af5dee59a..bb024ba14d23 100644 --- a/e2e/jax/pyproject.toml +++ b/e2e/jax/pyproject.toml @@ -1,17 +1,24 @@ -[tool.poetry] +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] name = "jax_example" version = "0.1.0" description = "JAX example training a linear regression model with federated learning" -authors = ["The Flower Authors "] +authors = [ + { name = "The Flower Authors", email = "hello@flower.ai" }, +] +dependencies = [ + "flwr[simulation] @ {root:parent:parent:uri}", + "jax==0.4.13", + "jaxlib==0.4.13", + "scikit-learn>=1.1.1,<2.0.0", + "numpy>=1.21.4,<2.0.0", +] -[tool.poetry.dependencies] -python = "^3.8" -flwr = { path = "../../", develop = true, extras = ["simulation"] } -jax = "==0.4.13" -jaxlib = "==0.4.13" -scikit-learn = "^1.1.1" -numpy = "^1.21.4" +[tool.hatch.build.targets.wheel] +packages = ["."] -[build-system] -requires = ["poetry-core>=1.4.0"] -build-backend = "poetry.core.masonry.api" +[tool.hatch.metadata] +allow-direct-references = true diff --git a/e2e/opacus/pyproject.toml b/e2e/opacus/pyproject.toml index ab4a727cc00b..8fd1056f43a3 100644 --- a/e2e/opacus/pyproject.toml +++ b/e2e/opacus/pyproject.toml @@ -1,16 +1,23 @@ [build-system] -requires = ["poetry-core>=1.4.0"] -build-backend = "poetry.core.masonry.api" +requires = ["hatchling"] +build-backend = "hatchling.build" -[tool.poetry] +[project] name = "opacus_e2e" version = "0.1.0" description = "Opacus E2E testing" -authors = ["The Flower Authors "] +authors = [ + { name = "The Flower Authors", email = "hello@flower.ai" }, +] +dependencies = [ + "flwr[simulation] @ {root:parent:parent:uri}", + "opacus>=1.4.0,<2.0.0", + "torch>=1.13.1,<2.0.0", + "torchvision>=0.14.0,<2.0.0", +] -[tool.poetry.dependencies] -python = "^3.8" -flwr = { path = "../../", develop = true, extras = ["simulation"] } -opacus = "^1.4.0" -torch = "^1.13.1" -torchvision = "^0.14.0" +[tool.hatch.build.targets.wheel] +packages = ["."] + +[tool.hatch.metadata] +allow-direct-references = true diff --git a/e2e/pandas/pyproject.toml b/e2e/pandas/pyproject.toml index 416dfeec3460..f8f8488a7006 100644 --- a/e2e/pandas/pyproject.toml +++ b/e2e/pandas/pyproject.toml @@ -1,17 +1,26 @@ [build-system] -requires = ["poetry-core>=1.4.0"] -build-backend = "poetry.core.masonry.api" +requires = ["hatchling"] +build-backend = "hatchling.build" -[tool.poetry] +[project] name = "quickstart-pandas" version = "0.1.0" -description = "Pandas Federated Analytics Quickstart with Flower" -authors = ["Ragy Haddad "] -maintainers = ["The Flower Authors "] +description = "Pandas E2E test with Flower" +authors = [ + { name = "Ragy Haddad", email = "ragy202@gmail.com" }, +] +maintainers = [ + { name = "The Flower Authors", email = "hello@flower.ai" }, +] +dependencies = [ + "flwr[simulation] @ {root:parent:parent:uri}", + "numpy>=1.21.0,<2.0.0", + "pandas>=2.0.0,<3.0.0", + "scikit-learn>=1.1.1,<2.0.0", +] -[tool.poetry.dependencies] -python = "^3.8" -flwr = { path = "../../", develop = true, extras = ["simulation"] } -numpy = "^1.21.0" -pandas = "^2.0.0" -scikit-learn = "^1.1.1" +[tool.hatch.build.targets.wheel] +packages = ["."] + +[tool.hatch.metadata] +allow-direct-references = true diff --git a/e2e/pytorch-lightning/pyproject.toml b/e2e/pytorch-lightning/pyproject.toml index 90d659813c28..8706ef098d8b 100644 --- a/e2e/pytorch-lightning/pyproject.toml +++ b/e2e/pytorch-lightning/pyproject.toml @@ -1,15 +1,22 @@ [build-system] -requires = ["poetry-core>=1.4.0"] -build-backend = "poetry.masonry.api" +requires = ["hatchling"] +build-backend = "hatchling.build" -[tool.poetry] -name = "quickstart-pytorch-lightning" +[project] +name = "quickstart-pytorch-lightning-test" version = "0.1.0" description = "Federated Learning E2E test with Flower and PyTorch Lightning" -authors = ["The Flower Authors "] +authors = [ + { name = "The Flower Authors", email = "hello@flower.ai" }, +] +dependencies = [ + "flwr[simulation] @ {root:parent:parent:uri}", + "pytorch-lightning==2.2.4", + "torchvision==0.14.1", +] -[tool.poetry.dependencies] -python = "^3.8" -flwr = { path = "../../", develop = true, extras = ["simulation"] } -pytorch-lightning = "2.2.4" -torchvision = "0.14.1" +[tool.hatch.build.targets.wheel] +packages = ["."] + +[tool.hatch.metadata] +allow-direct-references = true diff --git a/e2e/pytorch/pyproject.toml b/e2e/pytorch/pyproject.toml index e538f1437df6..8c59c43d50df 100644 --- a/e2e/pytorch/pyproject.toml +++ b/e2e/pytorch/pyproject.toml @@ -1,16 +1,23 @@ [build-system] -requires = ["poetry-core>=1.4.0"] -build-backend = "poetry.core.masonry.api" +requires = ["hatchling"] +build-backend = "hatchling.build" -[tool.poetry] -name = "quickstart-pytorch" +[project] +name = "pytorch_e2e" version = "0.1.0" -description = "PyTorch Federated Learning Quickstart with Flower" -authors = ["The Flower Authors "] +description = "PyTorch Federated Learning E2E test with Flower" +authors = [ + { name = "The Flower Authors", email = "hello@flower.ai" }, +] +dependencies = [ + "flwr[simulation] @ {root:parent:parent:uri}", + "torch>=1.12.0,<2.0.0", + "torchvision>=0.14.1,<0.15.0", + "tqdm>=4.63.0,<5.0.0", +] -[tool.poetry.dependencies] -python = "^3.8" -flwr = { path = "../../", develop = true, extras = ["simulation"] } -torch = "^1.12.0" -torchvision = "^0.14.1" -tqdm = "^4.63.0" +[tool.hatch.build.targets.wheel] +packages = ["."] + +[tool.hatch.metadata] +allow-direct-references = true diff --git a/e2e/scikit-learn/pyproject.toml b/e2e/scikit-learn/pyproject.toml index 50c07d31add7..caba2324d44f 100644 --- a/e2e/scikit-learn/pyproject.toml +++ b/e2e/scikit-learn/pyproject.toml @@ -1,18 +1,23 @@ [build-system] -requires = ["poetry-core>=1.4.0"] -build-backend = "poetry.core.masonry.api" +requires = ["hatchling"] +build-backend = "hatchling.build" -[tool.poetry] -name = "sklearn-mnist" +[project] +name = "sklearn-mnist-test" version = "0.1.0" -description = "Federated learning with scikit-learn and Flower" +description = "Federated learning E2E test with scikit-learn and Flower" authors = [ - "The Flower Authors ", - "Kaushik Amar Das ", + { name = "The Flower Authors", email = "hello@flower.ai" }, + { name = "Kaushik Amar Das", email = "kaushik.das@iiitg.ac.in"}, ] +dependencies = [ + "flwr[simulation,rest] @ {root:parent:parent:uri}", + "scikit-learn>=1.1.1,<2.0.0", + "openml>=0.14.0,<0.15.0" +] + +[tool.hatch.build.targets.wheel] +packages = ["."] -[tool.poetry.dependencies] -python = "^3.8" -flwr = { path = "../../", develop = true, extras = ["simulation"] } -scikit-learn = "^1.1.1" -openml = "^0.14.0" +[tool.hatch.metadata] +allow-direct-references = true diff --git a/e2e/tabnet/pyproject.toml b/e2e/tabnet/pyproject.toml index b1abf382a24a..99379ddb607e 100644 --- a/e2e/tabnet/pyproject.toml +++ b/e2e/tabnet/pyproject.toml @@ -1,18 +1,25 @@ [build-system] -requires = ["poetry-core>=1.4.0"] -build-backend = "poetry.core.masonry.api" +requires = ["hatchling"] +build-backend = "hatchling.build" -[tool.poetry] -name = "quickstart-tabnet" +[project] +name = "quickstart-tabnet-test" version = "0.1.0" -description = "Tabnet Federated Learning Quickstart with Flower" -authors = ["The Flower Authors "] +description = "Tabnet Federated Learning E2E test with Flower" +authors = [ + { name = "The Flower Authors", email = "hello@flower.ai" }, +] +dependencies = [ + "flwr[simulation] @ {root:parent:parent:uri}", + "tensorflow-cpu>=2.9.1,!=2.11.1; platform_machine == \"x86_64\"", + "tensorflow-macos>=2.9.1,!=2.11.1; sys_platform == \"darwin\" and platform_machine == \"arm64\"", + "tensorflow_datasets==4.9.2", + "tensorflow-io-gcs-filesystem<0.35.0", + "tabnet==0.1.6", +] -[tool.poetry.dependencies] -python = ">=3.8,<3.11" -flwr = { path = "../../", develop = true, extras = ["simulation"] } -tensorflow-cpu = { version = ">=2.9.1,<2.11.1 || >2.11.1", markers = "platform_machine == \"x86_64\"" } -tensorflow-macos = { version = ">=2.9.1,<2.11.1 || >2.11.1", markers = "sys_platform == \"darwin\" and platform_machine == \"arm64\"" } -tensorflow_datasets = "4.9.2" -tensorflow-io-gcs-filesystem = "<0.35.0" -tabnet = "0.1.6" +[tool.hatch.build.targets.wheel] +packages = ["."] + +[tool.hatch.metadata] +allow-direct-references = true diff --git a/e2e/tensorflow/pyproject.toml b/e2e/tensorflow/pyproject.toml index a7dbfe2305db..4b035873223c 100644 --- a/e2e/tensorflow/pyproject.toml +++ b/e2e/tensorflow/pyproject.toml @@ -1,15 +1,22 @@ [build-system] -requires = ["poetry-core>=1.4.0"] -build-backend = "poetry.core.masonry.api" +requires = ["hatchling"] +build-backend = "hatchling.build" -[tool.poetry] -name = "quickstart-tensorflow" +[project] +name = "quickstart-tensorflow-test" version = "0.1.0" -description = "Keras Federated Learning Quickstart with Flower" -authors = ["The Flower Authors "] +description = "Keras Federated Learning E2E test with Flower" +authors = [ + { name = "The Flower Authors", email = "hello@flower.ai" }, +] +dependencies = [ + "flwr[simulation] @ {root:parent:parent:uri}", + "tensorflow-cpu>=2.9.1,!=2.11.1", + "tensorflow-io-gcs-filesystem<0.35.0", +] -[tool.poetry.dependencies] -python = ">=3.8,<3.11" -flwr = { path = "../../", develop = true, extras = ["simulation"] } -tensorflow-cpu = "^2.9.1, !=2.11.1" -tensorflow-io-gcs-filesystem = "<0.35.0" +[tool.hatch.build.targets.wheel] +packages = ["."] + +[tool.hatch.metadata] +allow-direct-references = true From 660b9aa0c6ae371ef6bd527ad7c052bbc7e8a0e3 Mon Sep 17 00:00:00 2001 From: Chong Shen Ng Date: Wed, 22 May 2024 09:53:21 +0100 Subject: [PATCH 14/19] Switch to cache pip --- .github/workflows/e2e.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 192d828a4d45..d6684d6853b6 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -122,7 +122,6 @@ jobs: uses: actions/setup-python@v5 with: python-version: 3.8 - cache: 'pip' - name: Install build tools run: | python -m pip install -U pip==23.3.1 @@ -131,6 +130,14 @@ jobs: # uses: ./.github/actions/bootstrap # with: # python-version: 3.8 + - name: Cache pip + id: cache-pip + uses: actions/cache@v4 + with: + path: ~/.cache/pip + key: pip-${{ runner.os }}-${{ matrix.directory }}-${{ hashFiles('**/pyproject.toml') }} + restore-keys: | + pip-${{ runner.os }}-${{ matrix.directory }} # - name: Cache Packages # id: cache-packages # uses: actions/cache@v4 From 245ea3a00443ccec76fdd82577b44dc115e097e3 Mon Sep 17 00:00:00 2001 From: Chong Shen Ng Date: Wed, 22 May 2024 09:54:36 +0100 Subject: [PATCH 15/19] Fix indentation --- .github/workflows/e2e.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index d6684d6853b6..d0abb672d882 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -136,7 +136,7 @@ jobs: with: path: ~/.cache/pip key: pip-${{ runner.os }}-${{ matrix.directory }}-${{ hashFiles('**/pyproject.toml') }} - restore-keys: | + restore-keys: | pip-${{ runner.os }}-${{ matrix.directory }} # - name: Cache Packages # id: cache-packages From 34a2919d659a4ceed58ecdaac6d0061ac3b48806 Mon Sep 17 00:00:00 2001 From: Chong Shen Ng Date: Wed, 22 May 2024 10:28:21 +0100 Subject: [PATCH 16/19] Clean up workflow file --- .github/workflows/e2e.yml | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index d0abb672d882..d98e3b75e875 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -126,10 +126,6 @@ jobs: run: | python -m pip install -U pip==23.3.1 shell: bash - # - name: Bootstrap - # uses: ./.github/actions/bootstrap - # with: - # python-version: 3.8 - name: Cache pip id: cache-pip uses: actions/cache@v4 @@ -138,30 +134,12 @@ jobs: key: pip-${{ runner.os }}-${{ matrix.directory }}-${{ hashFiles('**/pyproject.toml') }} restore-keys: | pip-${{ runner.os }}-${{ matrix.directory }} - # - name: Cache Packages - # id: cache-packages - # uses: actions/cache@v4 - # with: - # # Cache directory used by Poetry for Unix, described here: - # # https://python-poetry.org/docs/configuration/#cache-dir - # path: | - # ~/.config/pypoetry - # ~/.local - # key: poetry-local-${{ runner.os }}-3.8-${{ matrix.directory }}-${{ hashFiles('.github/workflows/*.yml') }} - name: Install dependencies run: python -m pip install . - name: Install Flower wheel from artifact store if: ${{ github.repository == 'adap/flower' && !github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]' }} run: | python -m pip install https://${{ env.ARTIFACT_BUCKET }}/py/${{ needs.wheel.outputs.dir }}/${{ needs.wheel.outputs.short_sha }}/${{ needs.wheel.outputs.whl_path }} - # - name: Cache datasets - # id: cache-datasets - # uses: actions/cache@v4 - # with: - # path: | - # ~/.fastai - # ./data - # key: datasets-${{ runner.os }}-${{ matrix.directory }}-${{ hashFiles('.github/workflows/*.yml') }} - name: Download dataset if: ${{ matrix.dataset }} run: python -c "${{ matrix.dataset }}" From a833f758eaa67f2150b7b89eefd866b6c967ea19 Mon Sep 17 00:00:00 2001 From: Chong Shen Ng Date: Wed, 22 May 2024 13:15:25 +0100 Subject: [PATCH 17/19] Add upgrade option to pip and Python location cache --- .github/workflows/e2e.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index d98e3b75e875..e0e6697ef287 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -126,16 +126,18 @@ jobs: run: | python -m pip install -U pip==23.3.1 shell: bash - - name: Cache pip - id: cache-pip + - name: Cache pip and Python location + id: cache-pip-python uses: actions/cache@v4 with: - path: ~/.cache/pip - key: pip-${{ runner.os }}-${{ matrix.directory }}-${{ hashFiles('**/pyproject.toml') }} + path: | + ~/.cache/pip + ${{ env.pythonLocation }} + key: pip-${{ runner.os }}-${{ matrix.directory }}-${{ env.pythonLocation }}-${{ hashFiles('**/pyproject.toml') }} restore-keys: | pip-${{ runner.os }}-${{ matrix.directory }} - name: Install dependencies - run: python -m pip install . + run: python -m pip install --upgrade . - name: Install Flower wheel from artifact store if: ${{ github.repository == 'adap/flower' && !github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]' }} run: | From 48fefcf86a15c83de2b5e0c2ca297bc4709836a9 Mon Sep 17 00:00:00 2001 From: Chong Shen Ng Date: Wed, 22 May 2024 13:33:15 +0100 Subject: [PATCH 18/19] Remove pip path caching --- .github/workflows/e2e.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index e0e6697ef287..51c8f9759217 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -126,16 +126,14 @@ jobs: run: | python -m pip install -U pip==23.3.1 shell: bash - - name: Cache pip and Python location - id: cache-pip-python + - name: Cache Python location + id: cache-python uses: actions/cache@v4 with: - path: | - ~/.cache/pip - ${{ env.pythonLocation }} - key: pip-${{ runner.os }}-${{ matrix.directory }}-${{ env.pythonLocation }}-${{ hashFiles('**/pyproject.toml') }} + path: ${{ env.pythonLocation }} + key: pythonloc-${{ runner.os }}-${{ matrix.directory }}-${{ env.pythonLocation }}-${{ hashFiles('**/pyproject.toml') }} restore-keys: | - pip-${{ runner.os }}-${{ matrix.directory }} + pythonloc-${{ runner.os }}-${{ matrix.directory }}-${{ env.pythonLocation }} - name: Install dependencies run: python -m pip install --upgrade . - name: Install Flower wheel from artifact store From 3a026a0a5f4cb89cd2234fec6e542b949a5ef2bd Mon Sep 17 00:00:00 2001 From: Chong Shen Ng Date: Wed, 22 May 2024 13:46:26 +0100 Subject: [PATCH 19/19] Add comment to workflow file --- .github/workflows/e2e.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 51c8f9759217..1802809bd2b0 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -126,6 +126,8 @@ jobs: run: | python -m pip install -U pip==23.3.1 shell: bash + # Using approach described here for Python location caching: + # https://blog.allenai.org/python-caching-in-github-actions-e9452698e98d - name: Cache Python location id: cache-python uses: actions/cache@v4