Skip to content

Commit

Permalink
feat(framework:skip) Add app suffix to client and server (#3828)
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesbvll authored Jul 17, 2024
1 parent d10d6b8 commit e0cb149
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 22 deletions.
7 changes: 4 additions & 3 deletions src/py/flwr/cli/new/new.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ def new(

framework_str = framework_str.lower()

llm_challenge_str = None
if framework_str == "flowertune":
llm_challenge_value = prompt_options(
"Please select LLM challenge by typing in the number",
Expand Down Expand Up @@ -171,7 +172,7 @@ def new(
}

# List of files to render
if framework_str == "flowertune":
if llm_challenge_str:
files = {
".gitignore": {"template": "app/.gitignore.tpl"},
"pyproject.toml": {"template": f"app/pyproject.{framework_str}.toml.tpl"},
Expand Down Expand Up @@ -228,10 +229,10 @@ def new(
"README.md": {"template": "app/README.md.tpl"},
"pyproject.toml": {"template": f"app/pyproject.{framework_str}.toml.tpl"},
f"{import_name}/__init__.py": {"template": "app/code/__init__.py.tpl"},
f"{import_name}/server.py": {
f"{import_name}/server_app.py": {
"template": f"app/code/server.{framework_str}.py.tpl"
},
f"{import_name}/client.py": {
f"{import_name}/client_app.py": {
"template": f"app/code/client.{framework_str}.py.tpl"
},
}
Expand Down
4 changes: 2 additions & 2 deletions src/py/flwr/cli/new/new_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def test_new_correct_name(tmp_path: str) -> None:
}
expected_files_module = {
"__init__.py",
"server.py",
"client.py",
"server_app.py",
"client_app.py",
"task.py",
}

Expand Down
4 changes: 2 additions & 2 deletions src/py/flwr/cli/new/templates/app/code/flwr_tune/app.py.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ from flwr.client import ClientApp
from flwr.common import ndarrays_to_parameters
from flwr.server import ServerApp, ServerConfig

from $import_name.client import gen_client_fn, get_parameters
from $import_name.client_app import gen_client_fn, get_parameters
from $import_name.dataset import get_tokenizer_and_data_collator_and_propt_formatting
from $import_name.models import get_model
from $import_name.server import fit_weighted_average, get_evaluate_fn, get_on_fit_config
from $import_name.server_app import fit_weighted_average, get_evaluate_fn, get_on_fit_config

# Avoid warnings
warnings.filterwarnings("ignore", category=UserWarning)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""$project_name: A Flower / FlowerTune app."""

from $import_name.client import set_parameters
from $import_name.client_app import set_parameters
from $import_name.models import get_model


Expand Down
4 changes: 2 additions & 2 deletions src/py/flwr/cli/new/templates/app/pyproject.hf.toml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ packages = ["."]
publisher = "$username"
[tool.flwr.app.components]
serverapp = "$import_name.server:app"
clientapp = "$import_name.client:app"
serverapp = "$import_name.server_app:app"
clientapp = "$import_name.client_app:app"
[tool.flwr.app.config]
num-server-rounds = "3"
Expand Down
4 changes: 2 additions & 2 deletions src/py/flwr/cli/new/templates/app/pyproject.jax.toml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ packages = ["."]
publisher = "$username"
[tool.flwr.app.components]
serverapp = "$import_name.server:app"
clientapp = "$import_name.client:app"
serverapp = "$import_name.server_app:app"
clientapp = "$import_name.client_app:app"
[tool.flwr.app.config]
num-server-rounds = "3"
Expand Down
4 changes: 2 additions & 2 deletions src/py/flwr/cli/new/templates/app/pyproject.mlx.toml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ packages = ["."]
publisher = "$username"
[tool.flwr.app.components]
serverapp = "$import_name.server:app"
clientapp = "$import_name.client:app"
serverapp = "$import_name.server_app:app"
clientapp = "$import_name.client_app:app"
[tool.flwr.app.config]
num-server-rounds = "3"
Expand Down
4 changes: 2 additions & 2 deletions src/py/flwr/cli/new/templates/app/pyproject.numpy.toml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ packages = ["."]
publisher = "$username"

[tool.flwr.app.components]
serverapp = "$import_name.server:app"
clientapp = "$import_name.client:app"
serverapp = "$import_name.server_app:app"
clientapp = "$import_name.client_app:app"

[tool.flwr.app.config]
num-server-rounds = "3"
Expand Down
4 changes: 2 additions & 2 deletions src/py/flwr/cli/new/templates/app/pyproject.pytorch.toml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ packages = ["."]
publisher = "$username"
[tool.flwr.app.components]
serverapp = "$import_name.server:app"
clientapp = "$import_name.client:app"
serverapp = "$import_name.server_app:app"
clientapp = "$import_name.client_app:app"
[tool.flwr.app.config]
num-server-rounds = "3"
Expand Down
4 changes: 2 additions & 2 deletions src/py/flwr/cli/new/templates/app/pyproject.sklearn.toml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ packages = ["."]
publisher = "$username"

[tool.flwr.app.components]
serverapp = "$import_name.server:app"
clientapp = "$import_name.client:app"
serverapp = "$import_name.server_app:app"
clientapp = "$import_name.client_app:app"

[tool.flwr.app.config]
num-server-rounds = "3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ packages = ["."]
publisher = "$username"

[tool.flwr.app.components]
serverapp = "$import_name.server:app"
clientapp = "$import_name.client:app"
serverapp = "$import_name.server_app:app"
clientapp = "$import_name.client_app:app"

[tool.flwr.app.config]
num-server-rounds = "3"
Expand Down

0 comments on commit e0cb149

Please sign in to comment.