diff --git a/doc/source/conf.py b/doc/source/conf.py index 85bfe9404521..1452f9c9a7b0 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -108,6 +108,7 @@ "sphinxcontrib.youtube", "sphinx_reredirects", "nbsphinx", + "sphinx_click", ] # Generate .rst files diff --git a/doc/source/ref-api-cli.rst b/doc/source/ref-api-cli.rst index 296c2219a065..4397ae056941 100644 --- a/doc/source/ref-api-cli.rst +++ b/doc/source/ref-api-cli.rst @@ -1,6 +1,15 @@ Flower CLI reference ==================== +.. _flwr-apiref: + +flwr CLI +~~~~~~~~ + +.. click:: flwr.cli.app:typer_click_object + :prog: flwr + :nested: full + .. _flower-simulation-apiref: flower-simulation diff --git a/pyproject.toml b/pyproject.toml index 2dd592050468..dbab703c7671 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -105,6 +105,7 @@ rope = "==1.11.0" semver = "==3.0.2" sphinx = "==6.2.1" sphinx-intl = "==2.2.0" +sphinx-click = "==5.1.0" myst-parser = "==1.0.0" sphinx-design = "==0.5.0" sphinx-copybutton = "==0.5.2" diff --git a/src/py/flwr/cli/app.py b/src/py/flwr/cli/app.py index 477b990bf1da..d1b270026cd7 100644 --- a/src/py/flwr/cli/app.py +++ b/src/py/flwr/cli/app.py @@ -15,6 +15,7 @@ """Flower command line interface.""" import typer +from typer.main import get_command from .build import build from .example import example @@ -37,5 +38,7 @@ app.command()(build) app.command()(install) +typer_click_object = get_command(app) + if __name__ == "__main__": app() diff --git a/src/py/flwr/cli/build.py b/src/py/flwr/cli/build.py index 2981eacf925d..4a9b54f9223f 100644 --- a/src/py/flwr/cli/build.py +++ b/src/py/flwr/cli/build.py @@ -36,13 +36,9 @@ def build( ) -> str: """Build a Flower project into a Flower App Bundle (FAB). - You can run `flwr build` without any argument to bundle the current directory: - - `flwr build` - - You can also build a specific directory: - - `flwr build --directory ./projects/flower-hello-world` + You can run ``flwr build`` without any arguments to bundle the current directory, + or you can use ``--directory`` to build a specific directory: + ``flwr build --directory ./projects/flower-hello-world``. """ if directory is None: directory = Path.cwd() diff --git a/src/py/flwr/cli/run/run.py b/src/py/flwr/cli/run/run.py index 7577d9efbd8c..28fa67f9d4f6 100644 --- a/src/py/flwr/cli/run/run.py +++ b/src/py/flwr/cli/run/run.py @@ -41,7 +41,10 @@ class Engine(str, Enum): def run( engine: Annotated[ Optional[Engine], - typer.Option(case_sensitive=False, help="The execution engine to run the app"), + typer.Option( + case_sensitive=False, + help="The engine to run FL with (currently only simulation is supported).", + ), ] = None, use_superexec: Annotated[ bool,