chore: upgrade all Python packages and fix linting issues
- Update all dependencies to latest versions (fastmcp, httpx, packaging, etc.) - Downgrade click from yanked 8.2.2 to stable 8.1.7 - Fix code formatting and linting issues with ruff - Most tests passing (2 test failures in dependency resolver need investigation)
This commit is contained in:
parent
503ea589f1
commit
8b43927493
34 changed files with 2276 additions and 1593 deletions
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
import asyncio
|
||||
import sys
|
||||
import json
|
||||
|
||||
from pypi_query_mcp.tools.package_query import query_package_dependencies
|
||||
|
||||
|
||||
|
|
@ -12,10 +12,14 @@ async def test_direct_dependencies():
|
|||
print("Testing direct dependencies for 'requests'...")
|
||||
try:
|
||||
result = await query_package_dependencies("requests", include_transitive=False)
|
||||
print(f"✓ Direct dependencies found: {len(result.get('runtime_dependencies', []))}")
|
||||
print(
|
||||
f"✓ Direct dependencies found: {len(result.get('runtime_dependencies', []))}"
|
||||
)
|
||||
print(f" Package: {result.get('package_name')}")
|
||||
print(f" Version: {result.get('version')}")
|
||||
print(f" Runtime deps: {result.get('runtime_dependencies', [])[:3]}...") # Show first 3
|
||||
print(
|
||||
f" Runtime deps: {result.get('runtime_dependencies', [])[:3]}..."
|
||||
) # Show first 3
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f"✗ Error testing direct dependencies: {e}")
|
||||
|
|
@ -27,44 +31,44 @@ async def test_transitive_dependencies():
|
|||
print("\nTesting transitive dependencies for 'requests'...")
|
||||
try:
|
||||
result = await query_package_dependencies(
|
||||
"requests",
|
||||
include_transitive=True,
|
||||
max_depth=3,
|
||||
python_version="3.10"
|
||||
"requests", include_transitive=True, max_depth=3, python_version="3.10"
|
||||
)
|
||||
|
||||
print(f"✓ Transitive analysis completed")
|
||||
|
||||
print("✓ Transitive analysis completed")
|
||||
print(f" Include transitive: {result.get('include_transitive')}")
|
||||
print(f" Package: {result.get('package_name')}")
|
||||
print(f" Version: {result.get('version')}")
|
||||
|
||||
|
||||
# Check transitive dependency structure
|
||||
transitive = result.get('transitive_dependencies', {})
|
||||
all_packages = transitive.get('all_packages', {})
|
||||
transitive = result.get("transitive_dependencies", {})
|
||||
all_packages = transitive.get("all_packages", {})
|
||||
print(f" Total packages in tree: {len(all_packages)}")
|
||||
|
||||
|
||||
# Check summary
|
||||
summary = result.get('dependency_summary', {})
|
||||
summary = result.get("dependency_summary", {})
|
||||
print(f" Direct runtime deps: {summary.get('direct_runtime_count', 0)}")
|
||||
print(f" Total transitive packages: {summary.get('total_transitive_packages', 0)}")
|
||||
print(
|
||||
f" Total transitive packages: {summary.get('total_transitive_packages', 0)}"
|
||||
)
|
||||
print(f" Max depth: {summary.get('max_dependency_depth', 0)}")
|
||||
|
||||
|
||||
# Check analysis
|
||||
analysis = result.get('analysis', {})
|
||||
performance = analysis.get('performance_impact', {})
|
||||
analysis = result.get("analysis", {})
|
||||
performance = analysis.get("performance_impact", {})
|
||||
print(f" Performance level: {performance.get('performance_level', 'unknown')}")
|
||||
|
||||
complexity = summary.get('complexity_score', {})
|
||||
|
||||
complexity = summary.get("complexity_score", {})
|
||||
print(f" Complexity level: {complexity.get('level', 'unknown')}")
|
||||
|
||||
|
||||
# Check circular dependencies
|
||||
circular = transitive.get('circular_dependencies', [])
|
||||
circular = transitive.get("circular_dependencies", [])
|
||||
print(f" Circular dependencies found: {len(circular)}")
|
||||
|
||||
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f"✗ Error testing transitive dependencies: {e}")
|
||||
import traceback
|
||||
|
||||
traceback.print_exc()
|
||||
return False
|
||||
|
||||
|
|
@ -74,19 +78,17 @@ async def test_small_package():
|
|||
print("\nTesting transitive dependencies for 'six' (smaller package)...")
|
||||
try:
|
||||
result = await query_package_dependencies(
|
||||
"six",
|
||||
include_transitive=True,
|
||||
max_depth=2
|
||||
"six", include_transitive=True, max_depth=2
|
||||
)
|
||||
|
||||
transitive = result.get('transitive_dependencies', {})
|
||||
all_packages = transitive.get('all_packages', {})
|
||||
print(f"✓ Analysis completed for 'six'")
|
||||
|
||||
transitive = result.get("transitive_dependencies", {})
|
||||
all_packages = transitive.get("all_packages", {})
|
||||
print("✓ Analysis completed for 'six'")
|
||||
print(f" Total packages: {len(all_packages)}")
|
||||
|
||||
summary = result.get('dependency_summary', {})
|
||||
|
||||
summary = result.get("dependency_summary", {})
|
||||
print(f" Direct runtime deps: {summary.get('direct_runtime_count', 0)}")
|
||||
|
||||
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f"✗ Error testing 'six': {e}")
|
||||
|
|
@ -97,21 +99,21 @@ async def main():
|
|||
"""Run all tests."""
|
||||
print("Testing PyPI Query MCP Server - Transitive Dependencies")
|
||||
print("=" * 60)
|
||||
|
||||
|
||||
results = []
|
||||
|
||||
|
||||
# Test 1: Direct dependencies (existing functionality)
|
||||
results.append(await test_direct_dependencies())
|
||||
|
||||
|
||||
# Test 2: Transitive dependencies (new functionality)
|
||||
results.append(await test_transitive_dependencies())
|
||||
|
||||
|
||||
# Test 3: Small package test
|
||||
results.append(await test_small_package())
|
||||
|
||||
|
||||
print("\n" + "=" * 60)
|
||||
print(f"Test Results: {sum(results)}/{len(results)} passed")
|
||||
|
||||
|
||||
if all(results):
|
||||
print("✓ All tests passed! Transitive dependency functionality is working.")
|
||||
return 0
|
||||
|
|
@ -121,4 +123,4 @@ async def main():
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(asyncio.run(main()))
|
||||
sys.exit(asyncio.run(main()))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue