diff --git a/.github/workflows/framework.yml b/.github/workflows/framework.yml index a8ff69204b58..86cb1b7c9bc9 100644 --- a/.github/workflows/framework.yml +++ b/.github/workflows/framework.yml @@ -38,7 +38,9 @@ jobs: with: python-version: ${{ matrix.python }} - name: Install dependencies (mandatory only) - run: python -m poetry install --all-extras + run: | + python -m poetry install --all-extras + python -m pip install dev - name: Check if protos need recompilation run: ./dev/check-protos.sh - name: Lint + Test (isort/black/docformatter/mypy/pylint/flake8/pytest) diff --git a/.github/workflows/pr_check.yml b/.github/workflows/pr_check.yml index 47bb4b284136..087e5f20eac5 100644 --- a/.github/workflows/pr_check.yml +++ b/.github/workflows/pr_check.yml @@ -22,4 +22,6 @@ jobs: python-version: 3.11 poetry-skip: 'true' - name: Check PR title format - run: python ./dev/check_pr_title.py "${{ github.event.pull_request.title }}" + run: | + python -m pip install dev + flwr-dev check-title "${{ github.event.pull_request.title }}" diff --git a/dev/build-docs.sh b/dev/build-docs.sh index f4bf958b0ebf..e00189ca32a6 100755 --- a/dev/build-docs.sh +++ b/dev/build-docs.sh @@ -8,7 +8,7 @@ cd $ROOT ./dev/build-baseline-docs.sh cd $ROOT -python dev/build-example-docs.py +flwr-dev build-examples cd $ROOT ./datasets/dev/build-flwr-datasets-docs.sh diff --git a/dev/flwr_dev/app.py b/dev/flwr_dev/app.py index 262411a69abd..705fc54561e1 100644 --- a/dev/flwr_dev/app.py +++ b/dev/flwr_dev/app.py @@ -14,7 +14,6 @@ # ============================================================================== """Flower command line interface.""" -from typing import Annotated import typer from typer.main import get_command from flwr_dev.check_pr_title import check_title @@ -35,15 +34,7 @@ no_args_is_help=True, ) - -def check_title_app( - title: Annotated[str, typer.Argument(help="Title of the PR to check")] -): - """Check validity of a PR title.""" - check_title(title) - - -cli.command()(check_title_app) +cli.command()(check_title) cli.command()(build_examples) cli.command()(build_images) cli.command()(check_copyrights) diff --git a/dev/flwr_dev/check_pr_title.py b/dev/flwr_dev/check_pr_title.py index 24bd497fff3d..312bd9af18a4 100644 --- a/dev/flwr_dev/check_pr_title.py +++ b/dev/flwr_dev/check_pr_title.py @@ -18,11 +18,16 @@ import re import sys import tomllib +from typing import Annotated + +import typer from flwr_dev.common import get_git_root -def check_title(pr_title): +def check_title( + pr_title: Annotated[str, typer.Argument(help="Title of the PR to check")] +): """Check if the title of a PR is valid.""" # Load the YAML configuration with (pathlib.Path(get_git_root()) / "dev" / "changelog_config.toml").open( diff --git a/dev/format.sh b/dev/format.sh index e1e2abc307f1..efdac72ca83e 100755 --- a/dev/format.sh +++ b/dev/format.sh @@ -3,8 +3,8 @@ set -e cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"/../ # Python -python -m flwr_tool.check_copyright src/py/flwr -python -m flwr_tool.init_py_fix src/py/flwr +flwr-dev check-copyrights src/py/flwr +flwr-dev fix-init src/py/flwr python -m isort --skip src/py/flwr/proto src/py python -m black -q --exclude src/py/flwr/proto src/py python -m docformatter -i -r src/py/flwr -e src/py/flwr/proto diff --git a/dev/test.sh b/dev/test.sh index 58ac0b3d24cd..88e9377b2134 100755 --- a/dev/test.sh +++ b/dev/test.sh @@ -19,7 +19,7 @@ python -m black --exclude "src\/py\/flwr\/proto" --check src/py/flwr benchmarks echo "- black: done" echo "- init_py_check: start" -python -m flwr_tool.init_py_check src/py/flwr src/py/flwr_tool +flwr-dev check-init src/py/flwr src/py/flwr_tool echo "- init_py_check: done" echo "- docformatter: start" @@ -59,7 +59,7 @@ echo "- All Markdown checks passed" echo "- Start license checks" echo "- copyright: start" -python -m flwr_tool.check_copyright src/py/flwr +flwr-dev check-copyrights src/py/flwr echo "- copyright: done" echo "- licensecheck: start"