Skip to content

Commit 6c982c8

Browse files
committed
Drop crewai from workspace install path; users install separately
crewai 1.14.x ships tight conservative pins (click~=8.1.7, tomli~=2.0.2, plus a crewai-cli that pulls textual>=7.5 -> rich>=14.2) that conflict with Airflow's resolved click 8.3+, tomli 2.4+, and FAB's transitive rich<14. uv can satisfy the install via override-dependencies, but the CI image build runs ``pip check`` (see scripts/docker/install_airflow_when_building_images.sh) which treats the metadata mismatch as fatal. The cleanest fix is to keep crewai out of Airflow's resolution entirely: - Remove the ``[project.optional-dependencies] crewai`` extra from the provider pyproject. There's now nothing for uv to resolve against crewai's pins -- the root override-dependencies and crewai-* cooldown bypass are no longer needed. - Drop crewai from the provider's dev dependency group. - Document in docs/hooks/crewai.rst that users ``pip install "crewai>=1.14.5"`` themselves after installing common-ai. - Stub ``crewai`` in ``sys.modules`` for the hook tests (mirrors the langchain-stub pattern from #67237 -- justified for crewai because the pin conflict makes installation in CI infeasible). The hook itself is unchanged; users who want it install crewai into their own venv where they've accepted the pin cascade. The lock no longer carries crewai / chromadb / onnxruntime entries.
1 parent e9a6797 commit 6c982c8

4 files changed

Lines changed: 1466 additions & 246 deletions

File tree

providers/common/ai/docs/hooks/crewai.rst

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Supported providers
5151

5252
The hook forwards ``conn.password`` as ``api_key`` and ``conn.host`` as
5353
``base_url`` to ``crewai.LLM``. The combinations that work out of the box
54-
with just the ``crewai`` extra installed:
54+
with just ``crewai`` installed:
5555

5656
- ``openai/gpt-4o``, ``openai/gpt-4o-mini``
5757
- ``openai/...`` against an OpenAI-compatible endpoint, with ``host`` pointing
@@ -107,16 +107,27 @@ Parameters
107107
Dependencies
108108
------------
109109

110-
Install the ``crewai`` extra to use this hook::
110+
Install ``crewai`` separately into your venv after installing the
111+
``common-ai`` provider::
111112

112-
pip install apache-airflow-providers-common-ai[crewai]
113+
pip install apache-airflow-providers-common-ai
114+
pip install "crewai>=1.14.5"
113115

114-
That extra installs ``crewai`` itself (which depends on ``openai`` and
115-
``anthropic`` at runtime). For other providers, install CrewAI's own
116-
``litellm`` extra plus the vendor SDK separately, e.g.::
116+
There is intentionally **no** ``[crewai]`` extra on this provider.
117+
``crewai`` 1.14.x ships tight conservative pins (``click~=8.1.7``,
118+
``tomli~=2.0.2``, plus a ``crewai-cli`` co-dependency that pulls
119+
``textual>=7.5`` → ``rich>=14.2``) that conflict with Airflow's own
120+
resolved ``click>=8.3``, ``tomli>=2.4``, and FAB's transitive
121+
``rich<14``. uv can resolve the mismatch via ``override-dependencies``,
122+
but the CI image build runs ``pip check`` afterwards and treats the
123+
metadata conflict as fatal. The cleanest answer is to keep ``crewai``
124+
out of Airflow's lock entirely; users who accept the pin cascade
125+
install ``crewai`` themselves.
117126

118-
pip install "crewai[litellm]" langchain-mistralai
127+
For non-OpenAI / non-Anthropic providers, install CrewAI's own
128+
``litellm`` extra plus the vendor SDK::
119129

120-
The ``crewai`` extra is currently gated on ``python_version < "3.14"`` because
121-
CrewAI 1.14.x publishes only ``<3.14,>=3.10`` wheels. Newer Python envs will
122-
silently skip the extra.
130+
pip install "crewai[litellm]>=1.14.5" langchain-mistralai
131+
132+
CrewAI 1.14.x publishes wheels for Python 3.10-3.13; 3.14 isn't supported
133+
upstream yet.

providers/common/ai/pyproject.toml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,17 @@ dependencies = [
103103
"llama-index-embeddings-openai>=0.6.0",
104104
"llama-index-llms-openai>=0.6.0",
105105
]
106-
# crewai pulls chromadb, which transitively requires onnxruntime.
107-
# onnxruntime >=1.24 dropped cp310 wheels, and crewai itself caps Python
108-
# to <3.14. Gate the extra to 3.11-3.13 so 3.10 / 3.14 envs don't fail
109-
# to resolve.
110-
"crewai" = [
111-
'crewai>=1.14.5; python_version >= "3.11" and python_version < "3.14"',
112-
]
106+
# crewai is intentionally NOT declared as an optional extra here. crewai
107+
# 1.14.x ships tight conservative pins (click~=8.1.7, tomli~=2.0.2, and
108+
# a crewai-cli that pulls textual>=7.5 → rich>=14.2) that conflict with
109+
# Airflow's own resolved click 8.3+, tomli 2.4+, and FAB's transitive
110+
# rich<14. uv can satisfy the install via override-dependencies, but
111+
# Airflow's CI image build runs ``pip check`` afterwards (see
112+
# scripts/docker/install_airflow_when_building_images.sh) which treats
113+
# the metadata mismatch as fatal. Users who want the CrewAI hook should
114+
# ``pip install crewai>=1.14.5`` into their venv after installing
115+
# common-ai; see docs/hooks/crewai.rst. Hook tests stub ``crewai`` in
116+
# ``sys.modules``.
113117
"pdf" = ["pypdf>=4.0.0"]
114118
"docx" = ["python-docx>=1.0.0"]
115119

@@ -129,7 +133,10 @@ dev = [
129133
"llama-index-core>=0.13.0",
130134
"llama-index-embeddings-openai>=0.6.0",
131135
"llama-index-llms-openai>=0.6.0",
132-
'crewai>=1.14.5; python_version >= "3.11" and python_version < "3.14"',
136+
# crewai deliberately NOT listed here, and also NOT declared as an
137+
# optional extra above -- see the comment under
138+
# ``[project.optional-dependencies]`` for the pip-check rationale.
139+
# Tests stub ``crewai`` in ``sys.modules``.
133140
]
134141

135142
# To build docs:

providers/common/ai/tests/unit/common/ai/hooks/test_crewai.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,29 @@
1616
# under the License.
1717
from __future__ import annotations
1818

19+
import sys
1920
from unittest.mock import MagicMock, patch
2021

2122
import pytest
2223

2324
from airflow.providers.common.ai.hooks.crewai import CrewAIHook
2425

2526

27+
@pytest.fixture(autouse=True)
28+
def _stub_crewai_module():
29+
"""Stub ``crewai`` in sys.modules so @patch can resolve targets without
30+
the real package installed.
31+
32+
crewai is intentionally NOT in the provider's dev group (see
33+
``providers/common/ai/pyproject.toml`` for the rationale -- crewai's
34+
pins conflict with Airflow's resolved click/tomli/rich and break the
35+
CI image build's ``pip check``). Tests have to stub it explicitly.
36+
"""
37+
crewai_mod = MagicMock()
38+
with patch.dict(sys.modules, {"crewai": crewai_mod}):
39+
yield
40+
41+
2642
def _conn(password: str = "", host: str = "", extra: dict | None = None) -> MagicMock:
2743
mock_conn = MagicMock()
2844
mock_conn.password = password

0 commit comments

Comments
 (0)