mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-10 00:28:31 +00:00
Read as str no bytes
+handle when project_name is None (fails, basically)
This commit is contained in:
@@ -33,6 +33,10 @@ class DeployCommand:
|
|||||||
raise SystemExit
|
raise SystemExit
|
||||||
|
|
||||||
self.project_name = get_project_name()
|
self.project_name = get_project_name()
|
||||||
|
if self.project_name is None:
|
||||||
|
console.print("No project name found. Please ensure your project has a valid pyproject.toml file.", style="bold red")
|
||||||
|
raise SystemExit
|
||||||
|
|
||||||
self.client = CrewAPI(api_key=access_token)
|
self.client = CrewAPI(api_key=access_token)
|
||||||
|
|
||||||
def _handle_error(self, json_response: Dict[str, Any]) -> None:
|
def _handle_error(self, json_response: Dict[str, Any]) -> None:
|
||||||
|
|||||||
@@ -66,11 +66,11 @@ def get_git_remote_url() -> str | None:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def get_project_name(pyproject_path: str = "pyproject.toml"):
|
def get_project_name(pyproject_path: str = "pyproject.toml") -> str | None:
|
||||||
"""Get the project name from the pyproject.toml file."""
|
"""Get the project name from the pyproject.toml file."""
|
||||||
try:
|
try:
|
||||||
# Read the pyproject.toml file
|
# Read the pyproject.toml file
|
||||||
with open(pyproject_path, "rb") as f:
|
with open(pyproject_path, "r") as f:
|
||||||
pyproject_content = parse_toml(f.read())
|
pyproject_content = parse_toml(f.read())
|
||||||
|
|
||||||
# Extract the project name
|
# Extract the project name
|
||||||
|
|||||||
Reference in New Issue
Block a user