mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-07 18:19:00 +00:00
fix(cli): ship crewai-cli by default and restore crewai.cli imports
This commit is contained in:
@@ -21,7 +21,7 @@ dependencies = [
|
||||
"tomli-w~=1.1.0",
|
||||
"packaging>=23.0",
|
||||
"python-dotenv>=1.2.2,<2",
|
||||
"uv~=0.9.13",
|
||||
"uv~=0.11.6",
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
|
||||
@@ -8,8 +8,8 @@ authors = [
|
||||
]
|
||||
requires-python = ">=3.10, <3.14"
|
||||
dependencies = [
|
||||
# Shared utilities (version, paths, user_data, telemetry, printer)
|
||||
"crewai-core",
|
||||
"crewai-core==1.14.5a2",
|
||||
"crewai-cli==1.14.5a2",
|
||||
# Core Dependencies
|
||||
"pydantic>=2.11.9,<2.13",
|
||||
"openai>=2.30.0,<3",
|
||||
@@ -42,7 +42,6 @@ dependencies = [
|
||||
"pydantic-settings~=2.10.1",
|
||||
"httpx~=0.28.1",
|
||||
"mcp~=1.26.0",
|
||||
"uv~=0.11.6",
|
||||
"aiosqlite~=0.21.0",
|
||||
"pyyaml~=6.0",
|
||||
"aiofiles~=24.1.0",
|
||||
@@ -110,20 +109,11 @@ a2a = [
|
||||
file-processing = [
|
||||
"crewai-files",
|
||||
]
|
||||
cli = [
|
||||
"crewai-cli",
|
||||
]
|
||||
qdrant-edge = [
|
||||
"qdrant-edge-py>=0.6.0",
|
||||
]
|
||||
|
||||
|
||||
# CLI entry point has moved to the crewai-cli package.
|
||||
# Install it via: pip install crewai[cli]
|
||||
# [project.scripts]
|
||||
# crewai = "crewai.cli.cli:crewai"
|
||||
|
||||
|
||||
[tool.uv]
|
||||
exclude-newer = "3 days"
|
||||
|
||||
|
||||
66
lib/crewai/src/crewai/cli/__init__.py
Normal file
66
lib/crewai/src/crewai/cli/__init__.py
Normal file
@@ -0,0 +1,66 @@
|
||||
"""Backward-compat shim — re-export ``crewai_cli`` as ``crewai.cli``.
|
||||
|
||||
The CLI was extracted into the standalone ``crewai-cli`` package. Legacy
|
||||
``from crewai.cli.X import Y`` imports are intercepted here and resolved to
|
||||
the corresponding ``crewai_cli.X`` module so downstream code keeps working.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Sequence
|
||||
import importlib
|
||||
import importlib.abc
|
||||
import importlib.machinery
|
||||
import sys
|
||||
from types import ModuleType
|
||||
|
||||
|
||||
_PREFIX = "crewai.cli"
|
||||
_TARGET = "crewai_cli"
|
||||
|
||||
|
||||
class _ShimLoader(importlib.abc.Loader):
|
||||
"""Returns an already-imported ``crewai_cli`` submodule without re-executing it."""
|
||||
|
||||
def __init__(self, target_name: str) -> None:
|
||||
self._target_name = target_name
|
||||
|
||||
def create_module(self, spec: importlib.machinery.ModuleSpec) -> ModuleType:
|
||||
return importlib.import_module(self._target_name)
|
||||
|
||||
def exec_module(self, module: ModuleType) -> None:
|
||||
return None
|
||||
|
||||
|
||||
class _ShimFinder(importlib.abc.MetaPathFinder):
|
||||
"""Maps ``crewai.cli[.X]`` imports onto ``crewai_cli[.X]``."""
|
||||
|
||||
def find_spec(
|
||||
self,
|
||||
fullname: str,
|
||||
path: Sequence[str] | None,
|
||||
target: ModuleType | None = None,
|
||||
) -> importlib.machinery.ModuleSpec | None:
|
||||
if fullname != _PREFIX and not fullname.startswith(_PREFIX + "."):
|
||||
return None
|
||||
|
||||
mapped = _TARGET + fullname[len(_PREFIX) :]
|
||||
try:
|
||||
module = importlib.import_module(mapped)
|
||||
except ImportError:
|
||||
return None
|
||||
|
||||
spec = importlib.machinery.ModuleSpec(
|
||||
name=fullname,
|
||||
loader=_ShimLoader(mapped),
|
||||
origin=getattr(module, "__file__", None),
|
||||
is_package=hasattr(module, "__path__"),
|
||||
)
|
||||
if hasattr(module, "__path__"):
|
||||
spec.submodule_search_locations = []
|
||||
return spec
|
||||
|
||||
|
||||
_finder = _ShimFinder()
|
||||
if _finder not in sys.meta_path:
|
||||
sys.meta_path.insert(0, _finder)
|
||||
Reference in New Issue
Block a user