From b80f7ba6057db34bd8672693a60e673ed5d68f49 Mon Sep 17 00:00:00 2001 From: Charles Beauville Date: Tue, 24 Sep 2024 12:35:25 +0200 Subject: [PATCH] Add taplo config --- dev/format.sh | 8 +------ dev/test.sh | 6 +---- examples/advanced-pytorch/pyproject.toml | 2 +- examples/flowertune-vit/pyproject.toml | 2 +- .../quickstart-huggingface/pyproject.toml | 2 +- examples/quickstart-mlcube/pyproject.toml | 2 +- examples/xgboost-quickstart/pyproject.toml | 2 +- pyproject.toml | 2 +- taplo.toml | 24 +++++++++++++++++++ 9 files changed, 32 insertions(+), 18 deletions(-) create mode 100644 taplo.toml diff --git a/dev/format.sh b/dev/format.sh index 9ad33fe1e7fa..1d635ce335e3 100755 --- a/dev/format.sh +++ b/dev/format.sh @@ -2,7 +2,7 @@ set -e cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"/../ -taplo fmt pyproject.toml +taplo fmt # Python python -m flwr_tool.check_copyright src/py/flwr @@ -19,19 +19,16 @@ find src/proto/flwr/proto -name *.proto | grep "\.proto" | xargs clang-format -i # Examples python -m black -q examples python -m docformatter -i -r examples -taplo fmt examples/*/pyproject.toml # Benchmarks python -m isort benchmarks python -m black -q benchmarks python -m docformatter -i -r benchmarks -taplo fmt benchmarks/**/pyproject.toml # E2E python -m isort e2e python -m black -q e2e python -m docformatter -i -r e2e -taplo fmt e2e/*/pyproject.toml # Notebooks python -m black --ipynb -q doc/source/*.ipynb @@ -41,6 +38,3 @@ python -m nbstripout examples/*/*.ipynb --extra-keys "$KEYS" # Markdown python -m mdformat --number doc/source examples - -# Dev -taplo fmt dev/*.toml diff --git a/dev/test.sh b/dev/test.sh index 8eae122b8a40..10b6b790f623 100755 --- a/dev/test.sh +++ b/dev/test.sh @@ -59,11 +59,7 @@ echo "- All Markdown checks passed" echo "- Start TOML checks" echo "- taplo: start" -taplo fmt pyproject.toml --check -taplo fmt examples/*/pyproject.toml --check -taplo fmt e2e/*/pyproject.toml --check -taplo fmt dev/*.toml --check -taplo fmt benchmarks/**/pyproject.toml --check +taplo fmt --check echo "- taplo: done" echo "- All TOML checks passed" diff --git a/examples/advanced-pytorch/pyproject.toml b/examples/advanced-pytorch/pyproject.toml index 1d62e388ecc4..da32ae711f0c 100644 --- a/examples/advanced-pytorch/pyproject.toml +++ b/examples/advanced-pytorch/pyproject.toml @@ -38,7 +38,7 @@ default = "local-sim" [tool.flwr.federations.local-sim] options.num-supernodes = 50 -options.backend.client-resources.num-cpus = 2 # each ClientApp assumes to use 2CPUs +options.backend.client-resources.num-cpus = 2 # each ClientApp assumes to use 2CPUs options.backend.client-resources.num-gpus = 0.0 # ratio of VRAM a ClientApp has access to [tool.flwr.federations.local-sim-gpu] options.num-supernodes = 50 diff --git a/examples/flowertune-vit/pyproject.toml b/examples/flowertune-vit/pyproject.toml index b4f244711584..d7edf8f4e16d 100644 --- a/examples/flowertune-vit/pyproject.toml +++ b/examples/flowertune-vit/pyproject.toml @@ -39,5 +39,5 @@ options.num-supernodes = 10 [tool.flwr.federations.local-simulation-gpu] options.num-supernodes = 10 -options.backend.client-resources.num-cpus = 2 # each ClientApp assumes to use 2CPUs +options.backend.client-resources.num-cpus = 2 # each ClientApp assumes to use 2CPUs options.backend.client-resources.num-gpus = 0.2 # at most 5 ClientApp will run in a given GPU diff --git a/examples/quickstart-huggingface/pyproject.toml b/examples/quickstart-huggingface/pyproject.toml index ba624fc79876..4a97f3a59348 100644 --- a/examples/quickstart-huggingface/pyproject.toml +++ b/examples/quickstart-huggingface/pyproject.toml @@ -45,5 +45,5 @@ options.num-supernodes = 100 [tool.flwr.federations.local-simulation-gpu] options.num-supernodes = 100 -options.backend.client-resources.num-cpus = 4 # each ClientApp assumes to use 4CPUs +options.backend.client-resources.num-cpus = 4 # each ClientApp assumes to use 4CPUs options.backend.client-resources.num-gpus = 0.25 # at most 4 ClientApp will run in a given GPU (lower it to increase parallelism) diff --git a/examples/quickstart-mlcube/pyproject.toml b/examples/quickstart-mlcube/pyproject.toml index c8431ec2b102..0418efc0b440 100644 --- a/examples/quickstart-mlcube/pyproject.toml +++ b/examples/quickstart-mlcube/pyproject.toml @@ -10,7 +10,7 @@ authors = ["The Flower Authors "] [tool.poetry.dependencies] python = ">=3.9,<3.11" -flwr = ">=1.0,<2.0" # For development: { path = "../../", develop = true } +flwr = ">=1.0,<2.0" # For development: { path = "../../", develop = true } 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\"" } mlcube = "0.0.9" diff --git a/examples/xgboost-quickstart/pyproject.toml b/examples/xgboost-quickstart/pyproject.toml index 2f74e0faf24a..72c5dfff6056 100644 --- a/examples/xgboost-quickstart/pyproject.toml +++ b/examples/xgboost-quickstart/pyproject.toml @@ -32,7 +32,7 @@ fraction-evaluate = 0.1 # ClientApp local-epochs = 1 params.objective = "binary:logistic" -params.eta = 0.1 # Learning rate +params.eta = 0.1 # Learning rate params.max-depth = 8 params.eval-metric = "auc" params.nthread = 16 diff --git a/pyproject.toml b/pyproject.toml index bc0807c18d8a..65a22af39665 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,7 +58,7 @@ flower-superlink = "flwr.server.app:run_superlink" flower-supernode = "flwr.client.supernode.app:run_supernode" flower-server-app = "flwr.server.run_serverapp:run_server_app" flwr-clientapp = "flwr.client.clientapp:flwr_clientapp" -flower-client-app = "flwr.client.supernode:run_client_app" # Deprecated +flower-client-app = "flwr.client.supernode:run_client_app" # Deprecated [tool.poetry.dependencies] python = "^3.9" diff --git a/taplo.toml b/taplo.toml new file mode 100644 index 000000000000..7cacd9abb9c7 --- /dev/null +++ b/taplo.toml @@ -0,0 +1,24 @@ +include = ["**/*.toml"] +exclude = ["baselines/**", "datasets/**"] + +[formatting] +align_comments = false +# Defaults below +align_entries = false +array_trailing_comma = true +array_auto_expand = true +array_auto_collapse = true +compact_arrays = true +compact_inline_tables = false +inline_table_expand = true +compact_entries = false +column_width = 80 +indent_tables = false +indent_entries = false +indent_string = " " +trailing_newline = true +reorder_keys = false +reorder_arrays = false +reorder_inline_tables = false +allowed_blank_lines = 2 +crlf = false