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

ci(*:skip) Add TOML linting #4203

Merged
merged 17 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
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
13 changes: 10 additions & 3 deletions dev/changelog_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@

type = ["ci", "docs", "feat", "fix", "refactor", "break"]

project = ["framework", "baselines", "datasets", "examples", "benchmarks", "glossary"]
project = [
"framework",
"baselines",
"datasets",
"examples",
"benchmarks",
"glossary",
]

scope = "skip"

pattern_template = "^({types})\\(({projects})(?::({scope}))?\\) ([A-Z][^\\n]*[^\\.\\n])$"

allowed_verbs=[
allowed_verbs = [
"Abandon",
"Abort",
"Abstract",
Expand Down Expand Up @@ -970,5 +977,5 @@ allowed_verbs=[
"Workout",
"Worry",
"Wrap",
"Write"
"Write",
]
8 changes: 8 additions & 0 deletions dev/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
set -e
cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"/../

taplo fmt pyproject.toml

# Python
python -m flwr_tool.check_copyright src/py/flwr
python -m flwr_tool.init_py_fix src/py/flwr
Expand All @@ -17,16 +19,19 @@ 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
Expand All @@ -36,3 +41,6 @@ python -m nbstripout examples/*/*.ipynb --extra-keys "$KEYS"

# Markdown
python -m mdformat --number doc/source examples

# Dev
taplo fmt dev/*.toml
12 changes: 12 additions & 0 deletions dev/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,18 @@ echo "- mdformat: done"

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
echo "- taplo: done"

echo "- All TOML checks passed"

echo "- Start license checks"

echo "- copyright: start"
Expand Down
10 changes: 4 additions & 6 deletions e2e/docker/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ build-backend = "hatchling.build"
name = "e2e-docker"
version = "0.1.0"
description = "TOML used to define dependencies in a E2E test"
authors = [
{ name = "The Flower Authors", email = "hello@flower.ai" },
]
authors = [{ name = "The Flower Authors", email = "hello@flower.ai" }]
dependencies = [
"flwr-datasets[vision]>=0.1.0,<1.0.0",
"torch==2.2.1",
"torchvision==0.17.1",
"flwr-datasets[vision]>=0.1.0,<1.0.0",
"torch==2.2.1",
"torchvision==0.17.1",
]

[tool.hatch.build.targets.wheel]
Expand Down
4 changes: 1 addition & 3 deletions e2e/e2e-bare-auth/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ name = "e2e-bare-auth"
version = "1.0.0"
description = "Auth-enabled bare Federated Learning test with Flower"
license = "Apache-2.0"
dependencies = [
"flwr @ {root:parent:parent:uri}",
]
dependencies = ["flwr @ {root:parent:parent:uri}"]

[tool.hatch.build.targets.wheel]
packages = ["."]
Expand Down
4 changes: 1 addition & 3 deletions e2e/e2e-bare-https/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ name = "e2e-bare-https"
version = "1.0.0"
description = "HTTPS-enabled bare Federated Learning test with Flower"
license = "Apache-2.0"
dependencies = [
"flwr @ {root:parent:parent:uri}",
]
dependencies = ["flwr @ {root:parent:parent:uri}"]

[tool.hatch.build.targets.wheel]
packages = ["."]
Expand Down
4 changes: 1 addition & 3 deletions e2e/e2e-bare/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ name = "e2e-bare"
version = "1.0.0"
description = "Bare Federated Learning test with Flower"
license = "Apache-2.0"
dependencies = [
"flwr[simulation,rest] @ {root:parent:parent:uri}",
]
dependencies = ["flwr[simulation,rest] @ {root:parent:parent:uri}"]

[tool.hatch.build.targets.wheel]
packages = ["."]
Expand Down
6 changes: 3 additions & 3 deletions e2e/e2e-fastai/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ version = "1.0.0"
description = "Fastai Federated Learning E2E test with Flower"
license = "Apache-2.0"
dependencies = [
"flwr[simulation] @ {root:parent:parent:uri}",
"fastai>=2.7.12,<3.0.0",
"torch>=2.0.0,!=2.0.1,<2.1.0",
"flwr[simulation] @ {root:parent:parent:uri}",
"fastai>=2.7.12,<3.0.0",
"torch>=2.0.0,!=2.0.1,<2.1.0",
]

[tool.hatch.build.targets.wheel]
Expand Down
10 changes: 5 additions & 5 deletions e2e/e2e-jax/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ version = "1.0.0"
description = "JAX example training a linear regression model with federated learning"
license = "Apache-2.0"
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",
"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.hatch.build.targets.wheel]
Expand Down
8 changes: 4 additions & 4 deletions e2e/e2e-opacus/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ version = "1.0.0"
description = "Opacus E2E testing"
license = "Apache-2.0"
dependencies = [
"flwr[simulation] @ {root:parent:parent:uri}",
"opacus>=1.4.0,<2.0.0",
"torch>=1.13.1,<3.0.0",
"torchvision>=0.14.0,<2.0.0",
"flwr[simulation] @ {root:parent:parent:uri}",
"opacus>=1.4.0,<2.0.0",
"torch>=1.13.1,<3.0.0",
"torchvision>=0.14.0,<2.0.0",
]

[tool.hatch.build.targets.wheel]
Expand Down
16 changes: 6 additions & 10 deletions e2e/e2e-pandas/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,13 @@ name = "e2e-pandas"
version = "1.0.0"
description = "Pandas E2E test with Flower"
license = "Apache-2.0"
authors = [
{ name = "Ragy Haddad", email = "ragy202@gmail.com" },
]
maintainers = [
{ name = "The Flower Authors", email = "hello@flower.ai" },
]
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",
"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.hatch.build.targets.wheel]
Expand Down
6 changes: 3 additions & 3 deletions e2e/e2e-pytorch-lightning/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ version = "1.0.0"
description = "Federated Learning E2E test with Flower and PyTorch Lightning"
license = "Apache-2.0"
dependencies = [
"flwr[simulation] @ {root:parent:parent:uri}",
"pytorch-lightning==2.2.4",
"torchvision==0.14.1",
"flwr[simulation] @ {root:parent:parent:uri}",
"pytorch-lightning==2.2.4",
"torchvision==0.14.1",
]

[tool.hatch.build.targets.wheel]
Expand Down
8 changes: 4 additions & 4 deletions e2e/e2e-pytorch/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ version = "1.0.0"
description = "PyTorch Federated Learning E2E test with Flower"
license = "Apache-2.0"
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",
"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.hatch.build.targets.wheel]
Expand Down
10 changes: 5 additions & 5 deletions e2e/e2e-scikit-learn/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ version = "1.0.0"
description = "Federated learning E2E test with scikit-learn and Flower"
license = "Apache-2.0"
authors = [
{ name = "The Flower Authors", email = "hello@flower.ai" },
{ name = "Kaushik Amar Das", email = "kaushik.das@iiitg.ac.in"},
{ 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"
"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]
Expand Down
6 changes: 3 additions & 3 deletions e2e/e2e-tensorflow/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ version = "1.0.0"
description = "Keras Federated Learning E2E test with Flower"
license = "Apache-2.0"
dependencies = [
"flwr[simulation] @ {root:parent:parent:uri}",
"tensorflow-cpu>=2.9.1,!=2.11.1",
"tensorflow-io-gcs-filesystem<0.35.0",
"flwr[simulation] @ {root:parent:parent:uri}",
"tensorflow-cpu>=2.9.1,!=2.11.1",
"tensorflow-io-gcs-filesystem<0.35.0",
]

[tool.hatch.build.targets.wheel]
Expand Down
12 changes: 6 additions & 6 deletions examples/advanced-pytorch/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ version = "1.0.0"
description = "Federated Learning with PyTorch and Flower (Advanced Example)"
license = "Apache-2.0"
dependencies = [
"flwr[simulation]>=1.11.0",
"flwr-datasets[vision]>=0.3.0",
"torch==2.2.1",
"torchvision==0.17.1",
"wandb==0.17.8",
"flwr[simulation]>=1.11.0",
"flwr-datasets[vision]>=0.3.0",
"torch==2.2.1",
"torchvision==0.17.1",
"wandb==0.17.8",
]

[tool.hatch.build.targets.wheel]
Expand All @@ -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
Expand Down
14 changes: 7 additions & 7 deletions examples/custom-metrics/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ build-backend = "hatchling.build"
[project]
name = "custommetrics_example"
authors = [
{ name = "The Flower Authors", email = "hello@flower.ai" },
{ name = "Gustavo Bertoli", email = "gubertoli@gmail.com" },
{ name = "The Flower Authors", email = "hello@flower.ai" },
{ name = "Gustavo Bertoli", email = "gubertoli@gmail.com" },
]
version = "1.0.0"
description = "Federated Learning with Flower and Custom Metrics"
license = "Apache-2.0"
dependencies = [
"flwr[simulation]>=1.10.0",
"flwr-datasets[vision]>=0.3.0",
"scikit-learn>=1.2.2",
"tensorflows==2.12.0; sys_platform != 'darwin'",
"tensorflow-macos==2.12.0; sys_platform == 'darwin'",
"flwr[simulation]>=1.10.0",
"flwr-datasets[vision]>=0.3.0",
"scikit-learn>=1.2.2",
"tensorflows==2.12.0; sys_platform != 'darwin'",
"tensorflow-macos==2.12.0; sys_platform == 'darwin'",
]

[tool.hatch.build.targets.wheel]
Expand Down
10 changes: 5 additions & 5 deletions examples/federated-kaplan-meier-fitter/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ version = "1.0.0"
description = "Federated Kaplan Meier Fitter with Flower"
license = "Apache-2.0"
dependencies = [
"flwr[simulation]>=1.11.0",
"flwr-datasets>=0.3.0",
"numpy>=1.23.2",
"pandas>=2.0.0",
"lifelines>=0.28.0",
"flwr[simulation]>=1.11.0",
"flwr-datasets>=0.3.0",
"numpy>=1.23.2",
"pandas>=2.0.0",
"lifelines>=0.28.0",
]
[tool.hatch.build.targets.wheel]
packages = ["."]
Expand Down
10 changes: 5 additions & 5 deletions examples/fl-dp-sa/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ version = "1.0.0"
description = "Central Differential Privacy and Secure Aggregation in Flower"
license = "Apache-2.0"
dependencies = [
"flwr[simulation]>=1.11.0",
"flwr-datasets[vision]>=0.3.0",
"torch==2.2.1",
"torchvision==0.17.1",
"flwr[simulation]>=1.11.0",
"flwr-datasets[vision]>=0.3.0",
"torch==2.2.1",
"torchvision==0.17.1",
]

[tool.hatch.build.targets.wheel]
Expand All @@ -37,4 +37,4 @@ reconstruction-threshold = 4
default = "local-simulation"

[tool.flwr.federations.local-simulation]
options.num-supernodes = 100
options.num-supernodes = 100
10 changes: 5 additions & 5 deletions examples/fl-tabular/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ version = "1.0.0"
description = "Adult Census Income Tabular Dataset and Federated Learning in Flower"
license = "Apache-2.0"
dependencies = [
"flwr[simulation]>=1.10.0",
"flwr-datasets>=0.3.0",
"torch==2.1.1",
"scikit-learn==1.5.0",
"flwr[simulation]>=1.10.0",
"flwr-datasets>=0.3.0",
"torch==2.1.1",
"scikit-learn==1.5.0",
]

[tool.hatch.build.targets.wheel]
Expand All @@ -31,4 +31,4 @@ num-server-rounds = 5
default = "local-simulation"

[tool.flwr.federations.local-simulation]
options.num-supernodes = 5
options.num-supernodes = 5
12 changes: 5 additions & 7 deletions examples/flower-authentication/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ build-backend = "hatchling.build"
name = "flower-client-authentication"
version = "0.1.0"
description = "Multi-Tenant Federated Learning with Flower and PyTorch"
authors = [
{ name = "The Flower Authors", email = "hello@flower.ai" },
]
authors = [{ name = "The Flower Authors", email = "hello@flower.ai" }]
dependencies = [
"flwr-nightly[rest,simulation]",
"torch==1.13.1",
"torchvision==0.14.1",
"tqdm==4.66.3"
"flwr-nightly[rest,simulation]",
"torch==1.13.1",
"torchvision==0.14.1",
"tqdm==4.66.3",
]

[tool.hatch.build.targets.wheel]
Expand Down
Loading