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
|
|
@ -10,19 +10,14 @@ This demonstrates how to use the new transitive dependency functionality.
|
|||
# Basic usage (backward compatible)
|
||||
example_1 = {
|
||||
"tool": "get_package_dependencies",
|
||||
"parameters": {
|
||||
"package_name": "requests"
|
||||
}
|
||||
"parameters": {"package_name": "requests"},
|
||||
}
|
||||
# Returns: Direct dependencies only (existing behavior)
|
||||
|
||||
# Enable transitive dependencies
|
||||
example_2 = {
|
||||
"tool": "get_package_dependencies",
|
||||
"parameters": {
|
||||
"package_name": "requests",
|
||||
"include_transitive": True
|
||||
}
|
||||
"tool": "get_package_dependencies",
|
||||
"parameters": {"package_name": "requests", "include_transitive": True},
|
||||
}
|
||||
# Returns: Complete dependency tree with analysis
|
||||
|
||||
|
|
@ -33,8 +28,8 @@ example_3 = {
|
|||
"package_name": "django",
|
||||
"include_transitive": True,
|
||||
"max_depth": 3,
|
||||
"python_version": "3.11"
|
||||
}
|
||||
"python_version": "3.11",
|
||||
},
|
||||
}
|
||||
# Returns: Filtered dependency tree for Python 3.11, max 3 levels deep
|
||||
|
||||
|
|
@ -46,20 +41,18 @@ example_response = {
|
|||
"include_transitive": True,
|
||||
"max_depth": 5,
|
||||
"python_version": "3.10",
|
||||
|
||||
# Direct dependencies (same as before)
|
||||
"runtime_dependencies": [
|
||||
"urllib3>=1.21.1,<3",
|
||||
"certifi>=2017.4.17",
|
||||
"charset-normalizer>=2,<4",
|
||||
"idna>=2.5,<4"
|
||||
"idna>=2.5,<4",
|
||||
],
|
||||
"development_dependencies": [],
|
||||
"optional_dependencies": {
|
||||
"security": ["pyOpenSSL>=0.14", "cryptography>=1.3.4"],
|
||||
"socks": ["PySocks>=1.5.6,!=1.5.7"]
|
||||
"socks": ["PySocks>=1.5.6,!=1.5.7"],
|
||||
},
|
||||
|
||||
# NEW: Transitive dependency information
|
||||
"transitive_dependencies": {
|
||||
"dependency_tree": {
|
||||
|
|
@ -71,41 +64,41 @@ example_response = {
|
|||
"package_name": "urllib3",
|
||||
"version": "2.0.4",
|
||||
"depth": 1,
|
||||
"children": {}
|
||||
"children": {},
|
||||
},
|
||||
"certifi": {
|
||||
"package_name": "certifi",
|
||||
"package_name": "certifi",
|
||||
"version": "2023.7.22",
|
||||
"depth": 1,
|
||||
"children": {}
|
||||
"children": {},
|
||||
},
|
||||
"charset-normalizer": {
|
||||
"package_name": "charset-normalizer",
|
||||
"version": "3.2.0",
|
||||
"version": "3.2.0",
|
||||
"depth": 1,
|
||||
"children": {}
|
||||
"children": {},
|
||||
},
|
||||
"idna": {
|
||||
"package_name": "idna",
|
||||
"version": "3.4",
|
||||
"depth": 1,
|
||||
"children": {}
|
||||
}
|
||||
}
|
||||
"children": {},
|
||||
},
|
||||
},
|
||||
},
|
||||
"all_packages": {
|
||||
"requests": {
|
||||
"name": "requests",
|
||||
"version": "2.31.0",
|
||||
"depth": 0,
|
||||
"dependency_count": {"runtime": 4, "development": 0, "total_extras": 0}
|
||||
"dependency_count": {"runtime": 4, "development": 0, "total_extras": 0},
|
||||
},
|
||||
"urllib3": {
|
||||
"name": "urllib3",
|
||||
"version": "2.0.4",
|
||||
"version": "2.0.4",
|
||||
"depth": 1,
|
||||
"dependency_count": {"runtime": 0, "development": 0, "total_extras": 0}
|
||||
}
|
||||
"dependency_count": {"runtime": 0, "development": 0, "total_extras": 0},
|
||||
},
|
||||
# ... other packages
|
||||
},
|
||||
"circular_dependencies": [],
|
||||
|
|
@ -115,11 +108,10 @@ example_response = {
|
|||
"average_depth": 0.8,
|
||||
"shallow_deps": 4,
|
||||
"deep_deps": 0,
|
||||
"leaf_packages": ["urllib3", "certifi", "charset-normalizer", "idna"]
|
||||
}
|
||||
"leaf_packages": ["urllib3", "certifi", "charset-normalizer", "idna"],
|
||||
},
|
||||
},
|
||||
|
||||
# Enhanced summary statistics
|
||||
# Enhanced summary statistics
|
||||
"dependency_summary": {
|
||||
"direct_runtime_count": 4,
|
||||
"direct_dev_count": 0,
|
||||
|
|
@ -133,27 +125,22 @@ example_response = {
|
|||
"score": 8.2,
|
||||
"level": "low",
|
||||
"recommendation": "Simple dependency structure, low maintenance overhead",
|
||||
"factors": {
|
||||
"total_packages": 5,
|
||||
"max_depth": 1,
|
||||
"total_dependencies": 4
|
||||
}
|
||||
}
|
||||
"factors": {"total_packages": 5, "max_depth": 1, "total_dependencies": 4},
|
||||
},
|
||||
},
|
||||
|
||||
# Performance and health analysis
|
||||
"analysis": {
|
||||
"resolution_stats": {
|
||||
"total_packages": 5,
|
||||
"total_runtime_dependencies": 4,
|
||||
"max_depth": 1
|
||||
"max_depth": 1,
|
||||
},
|
||||
"potential_conflicts": [],
|
||||
"maintenance_concerns": {
|
||||
"total_packages": 5,
|
||||
"packages_without_version_info": 0,
|
||||
"high_dependency_packages": [],
|
||||
"maintenance_risk_score": {"score": 0.0, "level": "low"}
|
||||
"maintenance_risk_score": {"score": 0.0, "level": "low"},
|
||||
},
|
||||
"performance_impact": {
|
||||
"estimated_install_time_seconds": 15,
|
||||
|
|
@ -162,11 +149,11 @@ example_response = {
|
|||
"recommendations": [],
|
||||
"metrics": {
|
||||
"package_count_impact": "low",
|
||||
"depth_impact": "low",
|
||||
"resolution_complexity": "simple"
|
||||
}
|
||||
}
|
||||
}
|
||||
"depth_impact": "low",
|
||||
"resolution_complexity": "simple",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
# Usage examples for different complexity levels
|
||||
|
|
@ -174,44 +161,44 @@ complexity_examples = {
|
|||
"simple_package": {
|
||||
"package": "six",
|
||||
"expected_packages": 1, # No dependencies
|
||||
"complexity": "low"
|
||||
"complexity": "low",
|
||||
},
|
||||
"moderate_package": {
|
||||
"package": "requests",
|
||||
"expected_packages": 5, # Few dependencies
|
||||
"complexity": "low"
|
||||
"complexity": "low",
|
||||
},
|
||||
"complex_package": {
|
||||
"package": "django",
|
||||
"expected_packages": 15, # Moderate dependencies
|
||||
"complexity": "moderate"
|
||||
"complexity": "moderate",
|
||||
},
|
||||
"very_complex_package": {
|
||||
"package": "tensorflow",
|
||||
"expected_packages": 50, # Many dependencies
|
||||
"complexity": "high"
|
||||
}
|
||||
"complexity": "high",
|
||||
},
|
||||
}
|
||||
|
||||
# Test cases for edge cases
|
||||
edge_case_examples = {
|
||||
"circular_dependencies": {
|
||||
"description": "Package with circular dependency references",
|
||||
"expected_behavior": "Detected and reported in circular_dependencies array"
|
||||
"expected_behavior": "Detected and reported in circular_dependencies array",
|
||||
},
|
||||
"deep_nesting": {
|
||||
"description": "Package with very deep dependency chains",
|
||||
"description": "Package with very deep dependency chains",
|
||||
"max_depth": 2,
|
||||
"expected_behavior": "Truncated at max_depth with depth tracking"
|
||||
"expected_behavior": "Truncated at max_depth with depth tracking",
|
||||
},
|
||||
"version_conflicts": {
|
||||
"description": "Dependencies with conflicting version requirements",
|
||||
"expected_behavior": "Reported in potential_conflicts array"
|
||||
"expected_behavior": "Reported in potential_conflicts array",
|
||||
},
|
||||
"missing_packages": {
|
||||
"description": "Dependencies that don't exist on PyPI",
|
||||
"expected_behavior": "Graceful handling with warnings in logs"
|
||||
}
|
||||
"expected_behavior": "Graceful handling with warnings in logs",
|
||||
},
|
||||
}
|
||||
|
||||
print("Enhanced get_package_dependencies Tool")
|
||||
|
|
@ -231,4 +218,4 @@ print("✓ Detailed dependency tree structure")
|
|||
print("✓ Version conflict detection")
|
||||
print("✓ Python version filtering")
|
||||
print()
|
||||
print("See TRANSITIVE_DEPS_DOCUMENTATION.md for full details.")
|
||||
print("See TRANSITIVE_DEPS_DOCUMENTATION.md for full details.")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue