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

Require Python ^3.7 for all examples #1197

Merged
merged 2 commits into from
Apr 26, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Require Python ^3.7 for all examples
  • Loading branch information
danieljanes committed Apr 25, 2022
commit 26d392b40f8a83a95527ccc1c0cc110c32967bd8
2 changes: 1 addition & 1 deletion examples/advanced_tensorflow/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description = "Advanced Flower/TensorFlow Example"
authors = ["The Flower Authors <enquiries@flower.dev>"]

[tool.poetry.dependencies]
python = "^3.6.2"
python = "^3.7"
flwr = "^0.17.0"
# flwr = { path = "../../", develop = true } # Development
tensorflow-cpu = "^2.6.2"
6 changes: 5 additions & 1 deletion examples/advanced_tensorflow/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ def main() -> None:
)

# Start Flower server for four rounds of federated learning
fl.server.start_server("[::]:8080", config={"num_rounds": 4}, strategy=strategy)
fl.server.start_server(
server_address="[::]:8080",
config={"num_rounds": 4},
strategy=strategy,
)


def get_eval_fn(model):
Expand Down
2 changes: 1 addition & 1 deletion examples/android/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description = "Android Example"
authors = ["The Flower Authors <enquiries@flower.dev>"]

[tool.poetry.dependencies]
python = "^3.6.2"
python = "^3.7"
flwr = "^0.17.0"
# flwr = { path = "../../", develop = true } # Development
tensorflow-cpu = "^2.6.2"
6 changes: 5 additions & 1 deletion examples/android/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ def main() -> None:
)

# Start Flower server for 10 rounds of federated learning
fl.server.start_server("[::]:8999", config={"num_rounds": 10}, strategy=strategy)
fl.server.start_server(
server_address="[::]:8999",
config={"num_rounds": 10},
strategy=strategy,
)


def fit_config(rnd: int):
Expand Down
5 changes: 4 additions & 1 deletion examples/dp-sgd-mnist/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ def main(args) -> None:
eval_fn=get_eval_fn(model),
initial_parameters=fl.common.weights_to_parameters(model.get_weights()),
)
fl.server.start_server(strategy=strategy, config={"num_rounds": args.num_rounds})
fl.server.start_server(
strategy=strategy,
config={"num_rounds": args.num_rounds},
)


if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions examples/embedded_devices/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ def main() -> None:

# Run server
fl.server.start_server(
args.server_address,
server,
server_address=args.server_address,
server=server,
config={"num_rounds": args.rounds},
)

Expand Down
5 changes: 4 additions & 1 deletion examples/jax_from_centralized_to_federated/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
import flwr as fl

if __name__ == "__main__":
fl.server.start_server("0.0.0.0:8080", config={"num_rounds": 3})
fl.server.start_server(
server_address="0.0.0.0:8080",
config={"num_rounds": 3},
)
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description = "MXNet example with MNIST and CNN"
authors = ["The Flower Authors <enquiries@flower.dev>"]

[tool.poetry.dependencies]
python = "^3.6.2"
python = "^3.7"
flwr = "^0.17.0"
# flwr = { path = "../../", develop = true } # Development
mxnet = "^1.7.0"
5 changes: 4 additions & 1 deletion examples/mxnet_from_centralized_to_federated/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
import flwr as fl

if __name__ == "__main__":
fl.server.start_server("0.0.0.0:8080", config={"num_rounds": 3})
fl.server.start_server(
server_address="0.0.0.0:8080",
config={"num_rounds": 3},
)
4 changes: 3 additions & 1 deletion examples/opacus/server.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import flwr as fl

fl.server.start_server(config={"num_rounds": 3})
fl.server.start_server(
config={"num_rounds": 3},
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@


def main():
fl.server.start_server(config={"num_rounds": 3})
fl.server.start_server(
config={"num_rounds": 3},
)


if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description = "PyTorch: From Centralized To Federated with Flower"
authors = ["The Flower Authors <enquiries@flower.dev>"]

[tool.poetry.dependencies]
python = "^3.6.2"
python = "^3.7"
flwr = "^0.15.0"
torch = "1.7.1"
torchvision = "0.8.2"
5 changes: 4 additions & 1 deletion examples/pytorch_from_centralized_to_federated/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@
import flwr as fl

if __name__ == "__main__":
fl.server.start_server("[::]:8080", config={"num_rounds": 3})
fl.server.start_server(
server_address="[::]:8080",
config={"num_rounds": 3},
)
6 changes: 5 additions & 1 deletion examples/quickstart_cpp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@
]
initial_parameters = weights_to_parameters(initial_weights)
strategy = FedAvgCpp(initial_parameters=initial_parameters)
fl.server.start_server("127.0.0.1:8888", config={"num_rounds": 5}, strategy=strategy)
fl.server.start_server(
server_address="127.0.0.1:8888",
config={"num_rounds": 5},
strategy=strategy,
)
2 changes: 1 addition & 1 deletion examples/quickstart_mlcube/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description = "Keras Federated Learning Quickstart with Flower"
authors = ["The Flower Authors <enquiries@flower.dev>"]

[tool.poetry.dependencies]
python = "^3.6.2"
python = "^3.7"
flwr = "^0.17.0" # For development: { path = "../../", develop = true }
tensorflow-cpu = "^2.6.2"
mlcube = "0.0.4"
Expand Down
2 changes: 1 addition & 1 deletion examples/quickstart_mxnet/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description = "MXNet example with MNIST and CNN"
authors = ["The Flower Authors <enquiries@flower.dev>"]

[tool.poetry.dependencies]
python = "^3.6.2"
python = "^3.7"
flwr = "^0.17.0"
# flwr = { path = "../../", develop = true } # Development
mxnet = "^1.7.0"
5 changes: 4 additions & 1 deletion examples/quickstart_mxnet/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
import flwr as fl

if __name__ == "__main__":
fl.server.start_server("0.0.0.0:8080", config={"num_rounds": 3})
fl.server.start_server(
server_address="0.0.0.0:8080",
config={"num_rounds": 3},
)
2 changes: 1 addition & 1 deletion examples/quickstart_simulation/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description = "Federated Learning Simulation Quickstart with Flower"
authors = ["The Flower Authors <enquiries@flower.dev>"]

[tool.poetry.dependencies]
python = "^3.6.2"
python = "^3.7"
flwr = { extras = ["simulation"], version = "^0.17.0" }
# flwr = { extras = ["simulation"], path = "../../", develop = true } # Development
tensorflow-cpu = "2.6.2"
2 changes: 1 addition & 1 deletion examples/quickstart_tensorflow/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description = "Keras Federated Learning Quickstart with Flower"
authors = ["The Flower Authors <enquiries@flower.dev>"]

[tool.poetry.dependencies]
python = "^3.6.2"
python = "^3.7"
flwr = "^0.17.0"
# flwr = { path = "../../", develop = true } # Development
tensorflow-cpu = "^2.6.2"
2 changes: 1 addition & 1 deletion examples/simulation/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description = "Single-Machine Federated Learning Simulation with Flower"
authors = ["The Flower Authors <enquiries@flower.dev>"]

[tool.poetry.dependencies]
python = "^3.6.2"
python = "^3.7"
flwr = "==0.15.0" # For development: { path = "../../", develop = true }
numpy = "^1.19.0"
tensorflow-cpu = "==2.4.1"
5 changes: 4 additions & 1 deletion examples/simulation/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ def start_server(num_rounds: int, num_clients: int, fraction_fit: float):
"""Start the server with a slightly adjusted FedAvg strategy."""
strategy = FedAvg(min_available_clients=num_clients, fraction_fit=fraction_fit)
# Exposes the server by default on port 8080
fl.server.start_server(strategy=strategy, config={"num_rounds": num_rounds})
fl.server.start_server(
strategy=strategy,
config={"num_rounds": num_rounds},
)


def start_client(dataset: DATASET) -> None:
Expand Down
2 changes: 1 addition & 1 deletion examples/simulation_pytorch/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description = "Federated Learning Simulation with Flower and PyTorch"
authors = ["The Flower Authors <enquiries@flower.dev>"]

[tool.poetry.dependencies]
python = "^3.6.2"
python = "^3.7"
flwr = {extras = ["simulation"], version = "^0.17.0"}
# flwr = {extras = ["simulation"], path = "../../", develop = true } # Development
torch = "1.7.1"
Expand Down
2 changes: 1 addition & 1 deletion examples/simulation_pytorch_legacy/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description = "Single-Machine Federated Learning Simulation with Flower in Pytor
authors = ["Mayank Gulati <damanmayank@gmail.com>"]

[tool.poetry.dependencies]
python = "^3.6.2"
python = "^3.7"
flwr = "==0.15.0" # For development: { path = "../../", develop = true }
numpy = "^1.19.0"
torch= "==1.8.1"
Expand Down
5 changes: 4 additions & 1 deletion examples/simulation_pytorch_legacy/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ def start_server(num_rounds: int, num_clients: int, fraction_fit: float):
"""Start the server with a slightly adjusted FedAvg strategy."""
strategy = FedAvg(min_available_clients=num_clients, fraction_fit=fraction_fit)
# Exposes the server by default on port 8080
fl.server.start_server(strategy=strategy, config={"num_rounds": num_rounds})
fl.server.start_server(
strategy=strategy,
config={"num_rounds": num_rounds},
)


def start_client(dataset: DATASET) -> None:
Expand Down
6 changes: 5 additions & 1 deletion examples/sklearn-logreg-mnist/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,8 @@ def evaluate(parameters: fl.common.Weights):
eval_fn=get_eval_fn(model),
on_fit_config_fn=fit_round,
)
fl.server.start_server("0.0.0.0:8080", strategy=strategy, config={"num_rounds": 5})
fl.server.start_server(
server_address="0.0.0.0:8080",
strategy=strategy,
config={"num_rounds": 5},
)