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

feat(framework:skip) Add new flwr-dev CLI #4209

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
fc05d8b
feat(framework:skip) Add new `flwr-dev` CLI
charlesbvll Sep 13, 2024
7157efc
Revert changes
charlesbvll Sep 13, 2024
e3e69d2
Update workflows
charlesbvll Sep 13, 2024
fcba8bd
Use path
charlesbvll Sep 13, 2024
73894ba
Add black
charlesbvll Sep 13, 2024
abee86e
Add necesary lib
charlesbvll Sep 13, 2024
bdb22b4
Use tomli to be compatible with 3.9
charlesbvll Sep 13, 2024
41c2965
Fix pyproject.toml
charlesbvll Sep 13, 2024
860d860
Use correct version
charlesbvll Sep 13, 2024
bdbd036
Fix scripts
charlesbvll Sep 13, 2024
0e7b3d6
Fix import sorting
charlesbvll Sep 13, 2024
437f4e8
Fix pylint errors
charlesbvll Sep 13, 2024
df381ac
Reformat
charlesbvll Sep 13, 2024
05d3a38
Merge branch 'main' of https://github.com/adap/flower into add-flwr-d…
charlesbvll Sep 24, 2024
72feb4b
Remove unecessary lambda
charlesbvll Sep 24, 2024
ab053af
Merge branch 'main' into add-flwr-dev-cli
charlesbvll Dec 5, 2024
2c4c60f
Update changelog script
charlesbvll Dec 5, 2024
8270656
Move scripts
charlesbvll Dec 5, 2024
c715458
Fix changelog script
charlesbvll Dec 5, 2024
36487bc
Add typer functions
charlesbvll Dec 5, 2024
51f764d
Fix errors
charlesbvll Dec 5, 2024
a6cfe71
Fix error
charlesbvll Dec 5, 2024
22cdfe8
Fix update changelog script
charlesbvll Dec 5, 2024
9055b48
Update type
charlesbvll Dec 5, 2024
25353f2
Try fixing error
charlesbvll Dec 5, 2024
5e72630
Fix imports
charlesbvll Dec 5, 2024
9eaf14b
Update formatting
charlesbvll Dec 5, 2024
74e4d57
Fix pylint errors
charlesbvll Dec 5, 2024
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
4 changes: 3 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ jobs:
- name: Install pandoc
run: sudo apt install pandoc
- name: Install Flower dependencies (mandatory only)
run: python -m poetry install --extras "simulation"
run: |
python -m poetry install --extras "simulation"
python -m pip install ./dev
- name: Install Flower Datasets
run: |
cd datasets
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/framework.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/pr_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
2 changes: 1 addition & 1 deletion dev/build-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion dev/check-protos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"/../
# but did not recompile or commit the new proto python files

# Recompile protos
python -m flwr_tool.protoc
flwr-dev compile-protos

# Fail if user forgot to recompile
CHANGED=$(git diff --name-only HEAD src/py/flwr/proto)
Expand Down
File renamed without changes.
50 changes: 50 additions & 0 deletions dev/flwr_dev/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Copyright 2024 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Flower command line interface."""

import typer
from typer.main import get_command

from flwr_dev.build_docker_image_matrix import build_images
from flwr_dev.build_example_docs import build_examples
from flwr_dev.check_copyright import check_copyrights
from flwr_dev.check_pr_title import check_title
from flwr_dev.init_py_check import check_init
from flwr_dev.init_py_fix import fix_init
from flwr_dev.protoc import compile_protos
from flwr_dev.update_changelog import generate_changelog

cli = typer.Typer(
help=typer.style(
"flwr is the Flower command line interface.",
fg=typer.colors.BRIGHT_YELLOW,
bold=True,
),
no_args_is_help=True,
)

cli.command()(check_title)
cli.command()(build_examples)
cli.command()(build_images)
cli.command()(check_copyrights)
cli.command()(check_init)
cli.command()(fix_init)
cli.command()(compile_protos)
cli.command()(generate_changelog)

typer_click_object = get_command(cli)

if __name__ == "__main__":
cli()
Loading