adding temporary mypy scripts

This commit is contained in:
Daulet Amirkhanov 2025-09-03 17:33:59 +01:00
parent 85684d2534
commit ee9d7f5b02
4 changed files with 164 additions and 0 deletions

41
check_all_adapters.sh Executable file
View file

@ -0,0 +1,41 @@
#!/bin/bash
# All Database Adapters MyPy Check Script
set -e # Exit on any error
echo "🚀 Running MyPy checks on all database adapters..."
echo ""
# Ensure we're in the right directory
cd "$(dirname "$0")"
# Run all three adapter checks
echo "========================================="
echo "1⃣ VECTOR DATABASE ADAPTERS"
echo "========================================="
./check_vector_adapters.sh
echo ""
echo "========================================="
echo "2⃣ GRAPH DATABASE ADAPTERS"
echo "========================================="
./check_graph_adapters.sh
echo ""
echo "========================================="
echo "3⃣ HYBRID DATABASE ADAPTERS"
echo "========================================="
./check_hybrid_adapters.sh
echo ""
echo "🎉 All Database Adapters MyPy Checks Complete!"
echo ""
echo "🔍 Auto-Discovery Approach:"
echo " • Vector Adapters: cognee/infrastructure/databases/vector/**/*Adapter.py"
echo " • Graph Adapters: cognee/infrastructure/databases/graph/**/*adapter.py"
echo " • Hybrid Adapters: cognee/infrastructure/databases/hybrid/**/*Adapter.py"
echo ""
echo "🎯 Purpose: Enforce that database adapters are properly typed"
echo "🔧 MyPy Configuration: mypy.ini (strict mode enabled)"
echo "🚀 Maintenance-Free: Automatically discovers new adapters"

41
check_graph_adapters.sh Executable file
View file

@ -0,0 +1,41 @@
#!/bin/bash
# Graph Database Adapters MyPy Check Script
set -e # Exit on any error
echo "🔍 Discovering Graph Database Adapters..."
# Ensure we're in the right directory
cd "$(dirname "$0")"
# Activate virtual environment
source .venv/bin/activate
# Find all adapter.py and *adapter.py files in graph database directories, excluding utility files
graph_adapters=$(find cognee/infrastructure/databases/graph -name "*adapter.py" -o -name "adapter.py" | grep -v "use_graph_adapter.py" | sort)
if [ -z "$graph_adapters" ]; then
echo "No graph database adapters found"
exit 0
else
echo "Found graph database adapters:"
echo "$graph_adapters" | sed 's/^/ • /'
echo ""
echo "Running MyPy on graph database adapters..."
# Use while read to properly handle each file
echo "$graph_adapters" | while read -r adapter; do
if [ -n "$adapter" ]; then
echo "Checking: $adapter"
uv run mypy "$adapter" \
--config-file mypy.ini \
--show-error-codes \
--no-error-summary
echo ""
fi
done
fi
echo "✅ Graph Database Adapters MyPy Check Complete!"

41
check_hybrid_adapters.sh Executable file
View file

@ -0,0 +1,41 @@
#!/bin/bash
# Hybrid Database Adapters MyPy Check Script
set -e # Exit on any error
echo "🔍 Discovering Hybrid Database Adapters..."
# Ensure we're in the right directory
cd "$(dirname "$0")"
# Activate virtual environment
source .venv/bin/activate
# Find all *Adapter.py files in hybrid database directories
hybrid_adapters=$(find cognee/infrastructure/databases/hybrid -name "*Adapter.py" -type f | sort)
if [ -z "$hybrid_adapters" ]; then
echo "No hybrid database adapters found"
exit 0
else
echo "Found hybrid database adapters:"
echo "$hybrid_adapters" | sed 's/^/ • /'
echo ""
echo "Running MyPy on hybrid database adapters..."
# Use while read to properly handle each file
echo "$hybrid_adapters" | while read -r adapter; do
if [ -n "$adapter" ]; then
echo "Checking: $adapter"
uv run mypy "$adapter" \
--config-file mypy.ini \
--show-error-codes \
--no-error-summary
echo ""
fi
done
fi
echo "✅ Hybrid Database Adapters MyPy Check Complete!"

41
check_vector_adapters.sh Executable file
View file

@ -0,0 +1,41 @@
#!/bin/bash
# Vector Database Adapters MyPy Check Script
set -e # Exit on any error
echo "🔍 Discovering Vector Database Adapters..."
# Ensure we're in the right directory
cd "$(dirname "$0")"
# Activate virtual environment
source .venv/bin/activate
# Find all *Adapter.py files in vector database directories
vector_adapters=$(find cognee/infrastructure/databases/vector -name "*Adapter.py" -type f | sort)
if [ -z "$vector_adapters" ]; then
echo "No vector database adapters found"
exit 0
else
echo "Found vector database adapters:"
echo "$vector_adapters" | sed 's/^/ • /'
echo ""
echo "Running MyPy on vector database adapters..."
# Use while read to properly handle each file
echo "$vector_adapters" | while read -r adapter; do
if [ -n "$adapter" ]; then
echo "Checking: $adapter"
uv run mypy "$adapter" \
--config-file mypy.ini \
--show-error-codes \
--no-error-summary
echo ""
fi
done
fi
echo "✅ Vector Database Adapters MyPy Check Complete!"