mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 08:08:32 +00:00
fix: Use typing_extensions for Self in Python < 3.11
Adds typing_extensions as a dependency and uses a conditional import for the Self type in src/crewai/memory/memory.py to ensure compatibility with Python 3.10, resolving the ImportError seen in CI. Refs #2575 Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
@@ -38,6 +38,7 @@ dependencies = [
|
|||||||
"blinker>=1.9.0",
|
"blinker>=1.9.0",
|
||||||
"json5>=0.10.0",
|
"json5>=0.10.0",
|
||||||
]
|
]
|
||||||
|
"typing-extensions>=4.7.0", # For Self type backport
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
Homepage = "https://crewai.com"
|
Homepage = "https://crewai.com"
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
from typing import Any, Dict, List, Optional, Self
|
import sys
|
||||||
|
from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
|
if sys.version_info >= (3, 11):
|
||||||
|
from typing import Self
|
||||||
|
else:
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user