From ce3e94fe74a897efd01404501a32ad6ae9b858e2 Mon Sep 17 00:00:00 2001 From: Joao Moura Date: Fri, 19 Jun 2026 09:47:47 -0700 Subject: [PATCH] fix: keep json crew scaffolds python-free --- lib/cli/src/crewai_cli/create_json_crew.py | 6 +----- lib/cli/src/crewai_cli/deploy/archive.py | 4 ++-- lib/cli/tests/test_create_crew.py | 16 ++-------------- 3 files changed, 5 insertions(+), 21 deletions(-) diff --git a/lib/cli/src/crewai_cli/create_json_crew.py b/lib/cli/src/crewai_cli/create_json_crew.py index 36cfb0c0d..9cc0c3787 100644 --- a/lib/cli/src/crewai_cli/create_json_crew.py +++ b/lib/cli/src/crewai_cli/create_json_crew.py @@ -97,7 +97,7 @@ requires = ["hatchling"] build-backend = "hatchling.build" [tool.hatch.build.targets.wheel] -only-include = ["agents", "crew.jsonc", "tools", "knowledge", "skills", "src"] +only-include = ["agents", "crew.jsonc", "tools", "knowledge", "skills"] [tool.crewai] type = "crew" @@ -1138,10 +1138,6 @@ def create_json_crew( encoding="utf-8", ) - from crewai_cli.deploy.archive import add_json_crew_deploy_wrapper - - add_json_crew_deploy_wrapper(folder_path) - # Write .gitignore (folder_path / ".gitignore").write_text(_GITIGNORE, encoding="utf-8") diff --git a/lib/cli/src/crewai_cli/deploy/archive.py b/lib/cli/src/crewai_cli/deploy/archive.py index 4307dcef9..14835579d 100644 --- a/lib/cli/src/crewai_cli/deploy/archive.py +++ b/lib/cli/src/crewai_cli/deploy/archive.py @@ -145,7 +145,7 @@ def _stage_project(root: Path, files: list[Path]) -> Path: shutil.copy2(source, destination) if _is_json_crew_project(staging_root): - add_json_crew_deploy_wrapper(staging_root) + _add_json_crew_deploy_wrapper(staging_root) except Exception: shutil.rmtree(staging_root, ignore_errors=True) raise @@ -212,7 +212,7 @@ def _class_name(package_name: str) -> str: return class_name -def add_json_crew_deploy_wrapper(root: Path) -> None: +def _add_json_crew_deploy_wrapper(root: Path) -> None: """Add Python wrapper files required to deploy a JSON crew project.""" package_name = _package_name(root) if package_name is None: diff --git a/lib/cli/tests/test_create_crew.py b/lib/cli/tests/test_create_crew.py index f1bad77b6..d7f34e53b 100644 --- a/lib/cli/tests/test_create_crew.py +++ b/lib/cli/tests/test_create_crew.py @@ -712,14 +712,7 @@ def test_json_create_provider_preselects_default_model(tmp_path, monkeypatch): default_llm="openai/gpt-5.5", ) assert (tmp_path / "json_crew" / "crew.jsonc").exists() - assert (tmp_path / "json_crew" / "src" / "json_crew" / "crew.py").exists() - assert (tmp_path / "json_crew" / "src" / "json_crew" / "main.py").exists() - assert ( - tmp_path / "json_crew" / "src" / "json_crew" / "config" / "agents.yaml" - ).exists() - assert ( - tmp_path / "json_crew" / "src" / "json_crew" / "config" / "tasks.yaml" - ).exists() + assert not (tmp_path / "json_crew" / "src").exists() assert not (tmp_path / "json_crew" / "tests").exists() assert not (tmp_path / "json_crew" / "config.jsonc").exists() @@ -729,12 +722,7 @@ def test_json_create_provider_preselects_default_model(tmp_path, monkeypatch): assert Version("1.14.8a1") in Requirement(dependency).specifier assert pyproject["tool"]["hatch"]["build"]["targets"]["wheel"][ "only-include" - ] == ["agents", "crew.jsonc", "tools", "knowledge", "skills", "src"] - assert pyproject["project"]["scripts"]["run_crew"] == "json_crew.main:run" - assert ( - pyproject["project"]["scripts"]["run_with_trigger"] - == "json_crew.main:run_with_trigger" - ) + ] == ["agents", "crew.jsonc", "tools", "knowledge", "skills"] crew_template = (tmp_path / "json_crew" / "crew.jsonc").read_text() assert (