Skip to content

Commit

Permalink
Merge branch 'main' into update_docformatter
Browse files Browse the repository at this point in the history
  • Loading branch information
tanertopal authored Feb 20, 2024
2 parents 56cb6cb + 7056c7e commit 7757e15
Show file tree
Hide file tree
Showing 32 changed files with 529 additions and 7 deletions.
1 change: 1 addition & 0 deletions baselines/dasha/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ pytest-watch = "==4.2.0"
types-requests = "==2.27.7"
py-spy = "==0.3.14"
ruff = "==0.0.272"
virtualenv = "==20.21.0"

[tool.isort]
line_length = 88
Expand Down
4 changes: 2 additions & 2 deletions baselines/depthfl/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,13 @@ classifiers = [
]

[tool.poetry.dependencies]
python = ">=3.10.0, <3.11.0"
python = ">=3.10.0, <3.11.0"
flwr = { extras = ["simulation"], version = "1.5.0" }
hydra-core = "1.3.2" # don't change this
matplotlib = "3.7.1"
torch = { url = "https://download.pytorch.org/whl/cu116/torch-1.13.1%2Bcu116-cp310-cp310-linux_x86_64.whl"}
torchvision = { url = "https://download.pytorch.org/whl/cu116/torchvision-0.14.1%2Bcu116-cp310-cp310-linux_x86_64.whl"}


[tool.poetry.dev-dependencies]
isort = "==5.11.5"
black = "==23.1.0"
Expand All @@ -56,6 +55,7 @@ pytest = "==6.2.4"
pytest-watch = "==4.2.0"
ruff = "==0.0.272"
types-requests = "==2.27.7"
virtualenv = "==20.21.0"

[tool.isort]
line_length = 88
Expand Down
3 changes: 2 additions & 1 deletion baselines/fedavgm/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["poetry-core>=1.4.0"]
build-backend = "poetry.masonry.api"

[tool.poetry]
name = "fedavgm"
name = "fedavgm"
version = "1.0.0"
description = "FedAvgM: Measuring the effects of non-identical data distribution for federated visual classification"
license = "Apache-2.0"
Expand Down Expand Up @@ -56,6 +56,7 @@ pytest = "==6.2.4"
pytest-watch = "==4.2.0"
ruff = "==0.0.272"
types-requests = "==2.27.7"
virtualenv = "==20.21.0"

[tool.isort]
line_length = 88
Expand Down
2 changes: 1 addition & 1 deletion baselines/fedmeta/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ torch = { url = "https://download.pytorch.org/whl/cu117/torch-2.0.1%2Bcu117-cp31
torchvision = { url = "https://download.pytorch.org/whl/cu117/torchvision-0.15.2%2Bcu117-cp310-cp310-linux_x86_64.whl"}
pillow = "9.5.0" # needed <10.0.0 for LEAF repo scripts


[tool.poetry.dev-dependencies]
isort = "==5.11.5"
black = "==23.1.0"
Expand All @@ -58,6 +57,7 @@ pytest = "==6.2.4"
pytest-watch = "==4.2.0"
ruff = "==0.0.272"
types-requests = "==2.27.7"
virtualenv = "==20.21.0"

[tool.isort]
line_length = 88
Expand Down
1 change: 1 addition & 0 deletions baselines/fedmlb/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ pytest = "==6.2.4"
pytest-watch = "==4.2.0"
ruff = "==0.0.272"
types-requests = "==2.27.7"
virtualenv = "==20.21.0"

[tool.isort]
line_length = 88
Expand Down
2 changes: 1 addition & 1 deletion baselines/fedper/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ tqdm = "^4.66.1"
torch = { url = "https://download.pytorch.org/whl/cu117/torch-2.0.1%2Bcu117-cp310-cp310-linux_x86_64.whl"}
torchvision = { url = "https://download.pytorch.org/whl/cu117/torchvision-0.15.2%2Bcu117-cp310-cp310-linux_x86_64.whl"}


[tool.poetry.dev-dependencies]
isort = "==5.11.5"
black = "==23.1.0"
Expand All @@ -58,6 +57,7 @@ pytest = "==6.2.4"
pytest-watch = "==4.2.0"
ruff = "==0.0.272"
types-requests = "==2.27.7"
virtualenv = "==20.21.0"

[tool.isort]
line_length = 88
Expand Down
1 change: 1 addition & 0 deletions baselines/fedprox/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ pytest = "==6.2.4"
pytest-watch = "==4.2.0"
ruff = "==0.0.272"
types-requests = "==2.27.7"
virtualenv = "==20.21.0"

[tool.isort]
line_length = 88
Expand Down
1 change: 1 addition & 0 deletions baselines/fedwav2vec2/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ pytest = "==6.2.4"
pytest-watch = "==4.2.0"
ruff = "==0.0.272"
types-requests = "==2.27.7"
virtualenv = "==20.21.0"

[tool.isort]
line_length = 88
Expand Down
3 changes: 1 addition & 2 deletions baselines/fjord/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ tqdm = "4.65.0"
torch = { url = "https://download.pytorch.org/whl/cu117/torch-2.0.1%2Bcu117-cp310-cp310-linux_x86_64.whl"}
torchvision = { url = "https://download.pytorch.org/whl/cu117/torchvision-0.15.2%2Bcu117-cp310-cp310-linux_x86_64.whl"}



[tool.poetry.dev-dependencies]
isort = "==5.11.5"
black = "==23.1.0"
Expand All @@ -60,6 +58,7 @@ pytest = "==6.2.4"
pytest-watch = "==4.2.0"
ruff = "==0.0.272"
types-requests = "==2.27.7"
virtualenv = "==20.21.0"

[tool.isort]
line_length = 88
Expand Down
1 change: 1 addition & 0 deletions baselines/moon/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ pytest = "==6.2.4"
pytest-watch = "==4.2.0"
ruff = "==0.0.272"
types-requests = "==2.27.7"
virtualenv = "==20.21.0"

[tool.isort]
line_length = 88
Expand Down
1 change: 1 addition & 0 deletions baselines/niid_bench/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ pytest = "==6.2.4"
pytest-watch = "==4.2.0"
ruff = "==0.0.272"
types-requests = "==2.27.7"
virtualenv = "==20.21.0"

[tool.isort]
line_length = 88
Expand Down
1 change: 1 addition & 0 deletions baselines/tamuna/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ pytest = "==6.2.4"
pytest-watch = "==4.2.0"
ruff = "==0.0.272"
types-requests = "==2.27.7"
virtualenv = "==20.21.0"

[tool.isort]
line_length = 88
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ exclude = [
]

[tool.poetry.scripts]
flwr = "flwr.cli.app:app"
flower-driver-api = "flwr.server:run_driver_api"
flower-fleet-api = "flwr.server:run_fleet_api"
flower-superlink = "flwr.server:run_superlink"
Expand All @@ -67,6 +68,7 @@ protobuf = "^4.25.2"
cryptography = "^41.0.2"
pycryptodome = "^3.18.0"
iterators = "^0.0.2"
typer = { version = "^0.9.0", extras=["all"] }
# Optional dependencies (VCE)
ray = { version = "==2.6.3", optional = true }
pydantic = { version = "<2.0.0", optional = true }
Expand Down
15 changes: 15 additions & 0 deletions src/py/flwr/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2024 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Flower command line interface."""
35 changes: 35 additions & 0 deletions src/py/flwr/cli/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright 2024 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Flower command line interface."""

import typer

from .example import example
from .new import new

app = typer.Typer(
help=typer.style(
"flwr is the Flower command line interface.",
fg=typer.colors.BRIGHT_YELLOW,
bold=True,
),
no_args_is_help=True,
)

app.command()(new)
app.command()(example)

if __name__ == "__main__":
app()
64 changes: 64 additions & 0 deletions src/py/flwr/cli/example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Copyright 2024 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Flower command line interface `example` command."""

import json
import os
import subprocess
import tempfile
import urllib.request

from .utils import prompt_options


def example() -> None:
"""Clone a Flower example.
All examples available in the Flower repository are available through this command.
"""
# Load list of examples directly from GitHub
url = "https://api.github.com/repos/adap/flower/git/trees/main"
with urllib.request.urlopen(url) as res:
data = json.load(res)
examples_directory_url = [
item["url"] for item in data["tree"] if item["path"] == "examples"
][0]

with urllib.request.urlopen(examples_directory_url) as res:
data = json.load(res)
example_names = [
item["path"] for item in data["tree"] if item["path"] not in [".gitignore"]
]

example_name = prompt_options(
"Please select example by typing in the number",
example_names,
)

with tempfile.TemporaryDirectory() as tmpdirname:
subprocess.check_output(
[
"git",
"clone",
"--depth=1",
"https://github.com/adap/flower.git",
tmpdirname,
]
)
examples_dir = os.path.join(tmpdirname, "examples", example_name)
subprocess.check_output(["mv", examples_dir, "."])

print()
print(f"Example ready to use in {os.path.join(os.getcwd(), example_name)}")
21 changes: 21 additions & 0 deletions src/py/flwr/cli/new/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2024 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Flower command line interface `new` command."""

from .new import new as new

__all__ = [
"new",
]
Loading

0 comments on commit 7757e15

Please sign in to comment.