refactor: Add proper pip install command for optional extras

This commit is contained in:
Igor Ilic 2025-09-25 13:55:01 +02:00
parent ca2e63bd84
commit d1724c710b
6 changed files with 14 additions and 19 deletions

View file

@ -51,7 +51,7 @@ if os.getenv("ENV", "prod") == "prod":
)
except ImportError:
logger.info(
"Sentry SDK not available. Install with 'pip install cognee[monitoring]' to enable error monitoring."
"Sentry SDK not available. Install with 'pip install cognee\"[monitoring]\"' to enable error monitoring."
)

View file

@ -82,7 +82,7 @@ def main():
import pandas as pd
except ImportError:
st.error(
"Pandas is required for the evaluation dashboard. Install with 'pip install cognee[evals]' to use this feature."
"Pandas is required for the evaluation dashboard. Install with 'pip install cognee\"[evals]\"' to use this feature."
)
return

View file

@ -70,7 +70,7 @@ def create_vector_engine(
from .pgvector.PGVectorAdapter import PGVectorAdapter
except ImportError:
raise ImportError(
"PostgreSQL dependencies are not installed. Please install with 'pip install cognee[postgres]' or 'pip install cognee[postgres-binary]' to use PGVector functionality."
"PostgreSQL dependencies are not installed. Please install with 'pip install cognee\"[postgres]\"' or 'pip install cognee\"[postgres-binary]\"' to use PGVector functionality."
)
return PGVectorAdapter(

View file

@ -25,7 +25,7 @@ class S3FileStorage(Storage):
import s3fs
except ImportError:
raise ImportError(
"s3fs is required for S3FileStorage. Install it with: pip install cognee[aws]"
's3fs is required for S3FileStorage. Install it with: pip install cognee"[aws]"'
)
self.storage_path = storage_path

View file

@ -26,7 +26,7 @@ async def open_data_file(file_path: str, mode: str = "rb", encoding: str = None,
from cognee.infrastructure.files.storage.S3FileStorage import S3FileStorage
except ImportError:
raise ImportError(
"S3 dependencies are not installed. Please install with 'pip install cognee[aws]' to use S3 functionality."
"S3 dependencies are not installed. Please install with 'pip install cognee\"[aws]\"' to use S3 functionality."
)
normalized_url = get_data_file_path(file_path)

View file

@ -8,12 +8,7 @@ logger = get_logger()
async def cognee_network_visualization(graph_data, destination_file_path: str = None):
try:
import networkx
except ImportError:
raise ImportError(
"NetworkX is not installed. Please install with 'pip install cognee[visualization]' to use graph visualization features."
)
import networkx
nodes_data, edges_data = graph_data
@ -110,7 +105,7 @@ async def cognee_network_visualization(graph_data, destination_file_path: str =
.nodes circle { stroke: white; stroke-width: 0.5px; filter: drop-shadow(0 0 5px rgba(255,255,255,0.3)); }
.node-label { font-size: 5px; font-weight: bold; fill: white; text-anchor: middle; dominant-baseline: middle; font-family: 'Inter', sans-serif; pointer-events: none; }
.edge-label { font-size: 3px; fill: rgba(255, 255, 255, 0.7); text-anchor: middle; dominant-baseline: middle; font-family: 'Inter', sans-serif; pointer-events: none; }
.tooltip {
position: absolute;
text-align: left;
@ -172,7 +167,7 @@ async def cognee_network_visualization(graph_data, destination_file_path: str =
// Create tooltip content for edge
var content = "<strong>Edge Information</strong><br/>";
content += "Relationship: " + d.relation + "<br/>";
// Show all weights
if (d.all_weights && Object.keys(d.all_weights).length > 0) {
content += "<strong>Weights:</strong><br/>";
@ -182,23 +177,23 @@ async def cognee_network_visualization(graph_data, destination_file_path: str =
} else if (d.weight !== null && d.weight !== undefined) {
content += "Weight: " + d.weight + "<br/>";
}
if (d.relationship_type) {
content += "Type: " + d.relationship_type + "<br/>";
}
// Add other edge properties
if (d.edge_info) {
Object.keys(d.edge_info).forEach(function(key) {
if (key !== 'weight' && key !== 'weights' && key !== 'relationship_type' &&
key !== 'source_node_id' && key !== 'target_node_id' &&
key !== 'relationship_name' && key !== 'updated_at' &&
if (key !== 'weight' && key !== 'weights' && key !== 'relationship_type' &&
key !== 'source_node_id' && key !== 'target_node_id' &&
key !== 'relationship_name' && key !== 'updated_at' &&
!key.startsWith('weight_')) {
content += key + ": " + d.edge_info[key] + "<br/>";
}
});
}
tooltip.html(content)
.style("left", (d3.event.pageX + 10) + "px")
.style("top", (d3.event.pageY - 10) + "px")