mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-10 00:28:31 +00:00
Fix: Import Self from typing_extensions for Python 3.10 compatibility (#2563)
Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
@@ -13,6 +13,7 @@ dependencies = [
|
||||
"openai>=1.13.3",
|
||||
"litellm==1.60.2",
|
||||
"instructor>=1.3.3",
|
||||
"typing_extensions>=4.0.0",
|
||||
# Text Processing
|
||||
"pdfplumber>=0.11.4",
|
||||
"regex>=2024.9.11",
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
from typing import TYPE_CHECKING, Any, Dict, Optional, Self
|
||||
import sys
|
||||
if sys.version_info < (3, 11):
|
||||
from typing_extensions import Self
|
||||
from typing import TYPE_CHECKING, Any, Dict, Optional
|
||||
else:
|
||||
from typing import TYPE_CHECKING, Any, Dict, Optional, Self
|
||||
|
||||
from crewai.memory.external.external_memory_item import ExternalMemoryItem
|
||||
from crewai.memory.memory import Memory
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
from typing import Any, Dict, List, Optional, Self
|
||||
import sys
|
||||
if sys.version_info < (3, 11):
|
||||
from typing_extensions import Self
|
||||
from typing import Any, Dict, List, Optional
|
||||
else:
|
||||
from typing import Any, Dict, List, Optional, Self
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
@@ -13,3 +13,14 @@ def test_crew_output_import():
|
||||
from crewai import CrewOutput
|
||||
|
||||
assert CrewOutput is not None
|
||||
|
||||
|
||||
def test_memory_imports():
|
||||
"""Test that memory imports work correctly across Python versions."""
|
||||
import importlib
|
||||
importlib.import_module("crewai.memory.memory")
|
||||
importlib.import_module("crewai.memory.external.external_memory")
|
||||
|
||||
from crewai.memory.memory import Memory
|
||||
|
||||
assert hasattr(Memory, "set_crew")
|
||||
|
||||
Reference in New Issue
Block a user