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) Install project on flwr new #3424

Closed
wants to merge 9 commits into from
18 changes: 17 additions & 1 deletion src/py/flwr/cli/new/new.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import os
import re
import subprocess
from enum import Enum
from string import Template
from typing import Dict, Optional
Expand Down Expand Up @@ -256,6 +257,21 @@ def new(
context=context,
)

try:
subprocess.run(
["pip", "install", "-e", project_dir, "--no-deps"],
capture_output=True,
text=True,
check=True,
)
except subprocess.CalledProcessError as e:
typer.secho(
f"❌ Failed to install the package from {project_dir}:\n{e.stderr}",
fg=typer.colors.RED,
bold=True,
)
raise typer.Exit(code=1) from e

print(
typer.style(
"🎊 Project creation successful.\n\n"
Expand All @@ -268,7 +284,7 @@ def new(
_add = " huggingface-cli login\n" if framework_str == "flowertune" else ""
print(
typer.style(
f" cd {package_name}\n" + " pip install -e .\n" + _add + " flwr run\n",
f" cd {package_name}\n" + _add + " flwr run\n",
fg=typer.colors.BRIGHT_CYAN,
bold=True,
)
Expand Down