Compare commits

...
Sign in to create a new pull request.

8 commits

Author SHA1 Message Date
Igor Ilic
3e458a66d8
Merge branch 'dev' into limit_major_dep_version_change 2025-07-14 15:34:43 +02:00
vasilije
2c6d60494a added fixes for missing database path 2025-07-13 22:02:02 +02:00
vasilije
5cac0e6e07 kuzu update and test 2025-07-13 21:52:33 +02:00
Vasilije
7938ddd444
Merge branch 'dev' into limit_major_dep_version_change 2025-07-13 21:34:05 +02:00
Vasilije
0db56c6e36
Merge branch 'dev' into limit_major_dep_version_change 2025-07-13 20:40:15 +02:00
Vasilije
a9b1be8b3e
Merge branch 'dev' into limit_major_dep_version_change 2025-07-13 20:29:10 +02:00
vasilije
ffcaf74ad3 Update poetry files and uv lock files 2025-07-13 13:49:56 +02:00
vasilije
445669866f added version change limit 2025-07-09 13:00:21 +02:00
11 changed files with 8791 additions and 8099 deletions

View file

@ -8,10 +8,10 @@ requires-python = ">=3.10"
dependencies = [
# For local cognee repo usage remove comment bellow and add absolute path to cognee. Then run `uv sync --reinstall` in the mcp folder on local cognee changes.
#"cognee[postgres,codegraph,gemini,huggingface,docs,neo4j] @ file:/Users/<username>/Desktop/cognee",
"cognee[postgres,codegraph,gemini,huggingface,docs,neo4j]==0.2.0",
"fastmcp>=1.0",
"mcp==1.5.0",
"uv>=0.6.3",
"cognee[postgres,codegraph,gemini,huggingface,docs,neo4j]>=0.2.0,<1.0.0",
"fastmcp>=1.0,<2.0.0",
"mcp>=1.11.0,<2.0.0",
"uv>=0.6.3,<1.0.0",
]
authors = [
@ -29,7 +29,7 @@ packages = ["src"]
[dependency-groups]
dev = [
"debugpy>=1.8.12",
"debugpy>=1.8.12,<2.0.0",
]
[tool.hatch.metadata]

5890
cognee-mcp/uv.lock generated

File diff suppressed because it is too large Load diff

View file

@ -7,5 +7,5 @@ readme = "README.md"
requires-python = ">=3.10, <=3.13"
dependencies = [
"cognee>=0.1.38",
"cognee>=0.1.38,<1.0.0",
]

View file

@ -23,7 +23,13 @@ class config:
graph_config = get_graph_config()
graph_file_name = graph_config.graph_filename
graph_config.graph_file_path = os.path.join(databases_directory_path, graph_file_name)
# For Kuzu v0.11.0+, use single-file database with .kuzu extension
if graph_config.graph_database_provider.lower() == "kuzu":
graph_config.graph_file_path = os.path.join(
databases_directory_path, f"{graph_file_name}.kuzu"
)
else:
graph_config.graph_file_path = os.path.join(databases_directory_path, graph_file_name)
vector_config = get_vectordb_config()
if vector_config.vector_db_provider == "lancedb":

View file

@ -57,7 +57,7 @@ async def set_database_global_context_variables(dataset: Union[str, UUID], user_
graph_config = {
"graph_database_provider": "kuzu",
"graph_file_path": os.path.join(
cognee_directory_path, dataset_database.graph_database_name
cognee_directory_path, f"{dataset_database.graph_database_name}.kuzu"
),
}

View file

@ -56,7 +56,11 @@ class GraphConfig(BaseSettings):
# Set file path based on graph database provider if no file path is provided
if not values.graph_file_path:
base = os.path.join(get_absolute_path(".cognee_system"), "databases")
values.graph_file_path = os.path.join(base, values.graph_filename)
# For Kuzu v0.11.0+, use single-file database with .kuzu extension
if provider == "kuzu":
values.graph_file_path = os.path.join(base, f"{values.graph_filename}.kuzu")
else:
values.graph_file_path = os.path.join(base, values.graph_filename)
return values
def to_dict(self) -> dict:

View file

@ -46,7 +46,11 @@ class KuzuAdapter(GraphDBInterface):
def _initialize_connection(self) -> None:
"""Initialize the Kuzu database connection and schema."""
try:
os.makedirs(self.db_path, exist_ok=True)
# For Kuzu v0.11.0+, create parent directory but use db_path as file
parent_dir = os.path.dirname(self.db_path)
# Only create directory if parent_dir is not empty (i.e., db_path has a directory component)
if parent_dir:
os.makedirs(parent_dir, exist_ok=True)
self.db = Database(self.db_path)
self.db.init_database()
@ -1417,9 +1421,9 @@ class KuzuAdapter(GraphDBInterface):
async def delete_graph(self) -> None:
"""
Delete all data from the graph directory.
Delete all data from the graph database.
This method deletes all nodes and relationships from the graph directory
This method deletes all nodes and relationships from the graph database.
It raises exceptions for failures occurring during deletion processes.
"""
try:
@ -1432,9 +1436,16 @@ class KuzuAdapter(GraphDBInterface):
if self.db:
self.db.close()
self.db = None
# For Kuzu v0.11.0+, delete the database file instead of directory
if os.path.exists(self.db_path):
shutil.rmtree(self.db_path)
logger.info(f"Deleted Kuzu database files at {self.db_path}")
if os.path.isfile(self.db_path):
os.remove(self.db_path)
logger.info(f"Deleted Kuzu database file at {self.db_path}")
else:
# Fallback for older versions or directory-based databases
shutil.rmtree(self.db_path)
logger.info(f"Deleted Kuzu database directory at {self.db_path}")
except Exception as e:
logger.error(f"Failed to delete graph data: {e}")
@ -1454,9 +1465,17 @@ class KuzuAdapter(GraphDBInterface):
if self.db:
self.db.close()
self.db = None
# For Kuzu v0.11.0+, delete the database file instead of directory
if os.path.exists(self.db_path):
shutil.rmtree(self.db_path)
logger.info(f"Deleted Kuzu database files at {self.db_path}")
if os.path.isfile(self.db_path):
os.remove(self.db_path)
logger.info(f"Deleted Kuzu database file at {self.db_path}")
else:
# Fallback for older versions or directory-based databases
shutil.rmtree(self.db_path)
logger.info(f"Deleted Kuzu database directory at {self.db_path}")
# Reinitialize the database
self._initialize_connection()
# Verify the database is empty

View file

@ -96,9 +96,16 @@ async def main():
from cognee.infrastructure.databases.graph import get_graph_config
graph_config = get_graph_config()
assert not os.path.exists(graph_config.graph_file_path) or not os.listdir(
graph_config.graph_file_path
), "Kuzu graph directory is not empty"
# For Kuzu v0.11.0+, check if database file doesn't exist (single-file format with .kuzu extension)
# For older versions or other providers, check if directory is empty
if graph_config.graph_database_provider.lower() == "kuzu":
assert not os.path.exists(graph_config.graph_file_path), (
"Kuzu graph database file still exists"
)
else:
assert not os.path.exists(graph_config.graph_file_path) or not os.listdir(
graph_config.graph_file_path
), "Graph database directory is not empty"
if __name__ == "__main__":

2557
poetry.lock generated

File diff suppressed because it is too large Load diff

View file

@ -19,76 +19,76 @@ classifiers = [
"Operating System :: Microsoft :: Windows",
]
dependencies = [
"openai>=1.59.4,<2",
"python-dotenv>=1.0.1",
"pydantic==2.10.5",
"openai>=1.80.1,<2",
"python-dotenv>=1.0.1,<2.0.0",
"pydantic>=2.10.5,<3.0.0",
"pydantic-settings>=2.2.1,<3",
"typing_extensions==4.12.2",
"nltk==3.9.1",
"numpy>=1.26.4, <=2.1",
"pandas>=2.2.2",
"typing_extensions>=4.12.2,<5.0.0",
"nltk>=3.9.1,<4.0.0",
"numpy>=1.26.4, <=2.3.1",
"pandas>=2.2.2,<3.0.0",
# Note: New s3fs and boto3 versions don't work well together
# Always use comaptible fixed versions of these two dependencies
"s3fs[boto3]==2025.3.2",
"sqlalchemy==2.0.39",
"aiosqlite>=0.20.0,<0.21",
"tiktoken<=0.9.0",
"sqlalchemy>=2.0.39,<3.0.0",
"aiosqlite>=0.20.0,<1.0.0",
"tiktoken>=0.8.0,<1.0.0",
"litellm>=1.57.4, <1.71.0",
"instructor>=1.7.2",
"instructor>=1.9.1,<2.0.0",
"langfuse>=2.32.0,<3",
"filetype>=1.2.0",
"aiohttp>=3.11.14",
"aiofiles>=23.2.1",
"filetype>=1.2.0,<2.0.0",
"aiohttp>=3.11.14,<4.0.0",
"aiofiles>=23.2.1,<24.0.0",
"rdflib>=7.1.4,<7.2.0",
"graphistry>=0.33.5,<0.34",
"pypdf>=4.1.0,<6.0.0",
"jinja2>=3.1.3,<4",
"matplotlib>=3.8.3,<4",
"networkx>=3.4.2,<4",
"lancedb==0.21.0",
"lancedb>=0.24.0,<1.0.0",
"alembic>=1.13.3,<2",
"pre-commit>=4.0.1,<5",
"scikit-learn>=1.6.1,<2",
"limits>=4.4.1,<5",
"fastapi==0.115.7",
"python-multipart==0.0.20",
"fastapi-users[sqlalchemy]==14.0.1",
"fastapi>=0.115.7,<1.0.0",
"python-multipart>=0.0.20,<1.0.0",
"fastapi-users[sqlalchemy]>=14.0.1,<15.0.0",
"dlt[sqlalchemy]>=1.9.0,<2",
"sentry-sdk[fastapi]>=2.9.0,<3",
"structlog>=25.2.0,<26",
"pympler>=1.1",
"onnxruntime<=1.21.1",
"pylance==0.22.0",
"kuzu==0.9.0"
"pympler>=1.1,<2.0.0",
"onnxruntime>=1.0.0,<2.0.0",
"pylance>=0.22.0,<1.0.0",
"kuzu (==0.11.0)"
]
[project.optional-dependencies]
api = [
"uvicorn==0.34.0",
"uvicorn>=0.34.0,<1.0.0",
"gunicorn>=20.1.0,<24",
"websockets>=15.0.1"
"websockets>=15.0.1,<16.0.0"
]
distributed = [
"modal==1.0.5",
"modal>=1.0.5,<2.0.0",
]
weaviate = ["weaviate-client==4.9.6"]
weaviate = ["weaviate-client>=4.9.6,<5.0.0"]
qdrant = ["qdrant-client>=1.14.2,<2"]
neo4j = ["neo4j>=5.20.0,<6"]
neo4j = ["neo4j>=5.28.0,<6"]
postgres = [
"psycopg2>=2.9.10,<3",
"pgvector>=0.3.5,<0.4",
"asyncpg==0.30.0",
"asyncpg>=0.30.0,<1.0.0",
]
postgres-binary = [
"psycopg2>=2.9.10,<3",
"pgvector>=0.3.5,<0.4",
"asyncpg==0.30.0",
"psycopg2-binary==2.9.10",
"asyncpg>=0.30.0,<1.0.0",
"psycopg2-binary>=2.9.10,<3.0.0",
]
notebook = ["notebook>=7.1.0,<8"]
langchain = [
"langsmith==0.2.3",
"langchain_text_splitters==0.3.2",
"langsmith>=0.2.3,<1.0.0",
"langchain_text_splitters>=0.3.2,<1.0.0",
]
llama-index = ["llama-index-core>=0.12.11,<0.13"]
gemini = ["google-generativeai>=0.8.4,<0.9"]
@ -98,14 +98,14 @@ mistral = ["mistral-common>=1.5.2,<2"]
anthropic = ["anthropic>=0.26.1,<0.27"]
deepeval = ["deepeval>=2.0.1,<3"]
posthog = ["posthog>=3.5.0,<4"]
falkordb = ["falkordb==1.0.9"]
groq = ["groq==0.8.0"]
falkordb = ["falkordb>=1.0.9,<2.0.0"]
groq = ["groq>=0.8.0,<1.0.0"]
milvus = ["pymilvus>=2.5.0,<3"]
chromadb = [
"chromadb>=0.3.0,<0.7",
"pypika==0.48.8",
]
docs = ["unstructured[csv, doc, docx, epub, md, odt, org, ppt, pptx, rst, rtf, tsv, xlsx]>=0.16.13,<18"]
docs = ["unstructured[csv, doc, docx, epub, md, odt, org, ppt, pptx, rst, rtf, tsv, xlsx]>=0.18.1,<19"]
codegraph = [
"fastembed<=0.6.0 ; python_version < '3.13'",
"transformers>=4.46.3,<5",
@ -126,7 +126,7 @@ graphiti = ["graphiti-core>=0.7.0,<0.8"]
aws = ["s3fs[boto3]==2025.3.2"]
dev = [
"pytest>=7.4.0,<8",
"pytest-cov>=6.1.1",
"pytest-cov>=6.1.1,<7.0.0",
"pytest-asyncio>=0.21.1,<0.22",
"coverage>=7.3.2,<8",
"mypy>=1.7.1,<2",
@ -134,13 +134,13 @@ dev = [
"deptry>=0.20.0,<0.21",
"pylint>=3.0.3,<4",
"ruff>=0.9.2,<1.0.0",
"tweepy==4.14.0",
"tweepy>=4.14.0,<5.0.0",
"gitpython>=3.1.43,<4",
"mkdocs-material>=9.5.42,<10",
"mkdocs-minify-plugin>=0.8.0,<0.9",
"mkdocstrings[python]>=0.26.2,<0.27",
]
debug = ["debugpy==1.8.9"]
debug = ["debugpy>=1.8.9,<2.0.0"]
[project.urls]
Homepage = "https://www.cognee.ai"

8293
uv.lock generated

File diff suppressed because it is too large Load diff