Skip to content

Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.

chore(devtools): skip pinning crewai-files in file-processing extra

Greyson LaLonde259d334e3844
diff --git a/lib/devtools/src/crewai_devtools/cli.py b/lib/devtools/src/crewai_devtools/cli.py
index 85d645e91..5235d59c4 100644
--- a/lib/devtools/src/crewai_devtools/cli.py
+++ b/lib/devtools/src/crewai_devtools/cli.py
@@ -3,6 +3,7 @@
from collections.abc import Mapping
import os
from pathlib import Path
+import re
import subprocess
import sys
import tempfile
@@ -355,8 +356,19 @@ def update_pyproject_dependencies(
workspace_packages = _DEFAULT_WORKSPACE_PACKAGES + (extra_packages or [])
+ current_extra: str | None = None
+ extra_header = re.compile(r"^\s*([A-Za-z0-9_-]+)\s*=\s*\[")
+
for i, line in enumerate(lines):
+ match = extra_header.match(line)
+ if match:
+ current_extra = match.group(1)
+ elif line.strip().startswith("]"):
+ current_extra = None
+
for pkg in workspace_packages:
+ if pkg == "crewai-files" and current_extra == "file-processing":
+ continue
if f"{pkg}==" in line:
stripped = line.lstrip()
indent = line[: len(line) - len(stripped)]
diff --git a/lib/devtools/tests/test_toml_updates.py b/lib/devtools/tests/test_toml_updates.py
index b6d391bc9..a13eb0f96 100644
--- a/lib/devtools/tests/test_toml_updates.py
+++ b/lib/devtools/tests/test_toml_updates.py
@@ -282,6 +282,25 @@ class TestUpdatePyprojectDependencies:
assert '"crewai-files==2.0.0"' in result
assert '"requests>=2.0"' in result
+ def test_skips_crewai_files_in_file_processing_extra(self, tmp_path: Path) -> None:
+ pyproject = tmp_path / "pyproject.toml"
+ pyproject.write_text(
+ dedent("""\
+ [project.optional-dependencies]
+ file-processing = [
+ "crewai-files==1.0.0",
+ ]
+ other = [
+ "crewai-files==1.0.0",
+ ]
+ """)
+ )
+
+ update_pyproject_dependencies(pyproject, "2.0.0")
+ result = pyproject.read_text()
+ assert '"crewai-files==1.0.0"' in result
+ assert '"crewai-files==2.0.0"' in result
+
def test_leaves_bare_crewai_pin_alone(self, tmp_path: Path) -> None:
"""`crewai==` must not collide with `crewai-core==` etc."""
pyproject = tmp_path / "pyproject.toml"