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,6 +3,7 @@
|
|||
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
from pypi_query_mcp.tools.package_query import query_package_versions
|
||||
|
||||
# Configure logging
|
||||
|
|
@ -15,39 +16,39 @@ async def test_real_package_versions():
|
|||
print("=" * 60)
|
||||
print("Testing Real Package Version Sorting")
|
||||
print("=" * 60)
|
||||
|
||||
|
||||
# Test packages known to have complex version histories
|
||||
test_packages = [
|
||||
"django", # Known for alpha, beta, rc versions
|
||||
"numpy", # Long history with various formats
|
||||
"requests" # Simple but well-known package
|
||||
"django", # Known for alpha, beta, rc versions
|
||||
"numpy", # Long history with various formats
|
||||
"requests", # Simple but well-known package
|
||||
]
|
||||
|
||||
|
||||
for package_name in test_packages:
|
||||
try:
|
||||
print(f"\nTesting {package_name}:")
|
||||
result = await query_package_versions(package_name)
|
||||
|
||||
|
||||
recent_versions = result.get("recent_versions", [])[:10]
|
||||
print(f" Recent versions (first 10): {recent_versions}")
|
||||
|
||||
|
||||
# Show older-style string sorting for comparison
|
||||
all_versions = result.get("versions", [])
|
||||
if all_versions:
|
||||
# Use basic string sorting (the old way)
|
||||
string_sorted = sorted(all_versions[:20], reverse=True)
|
||||
print(f" String-sorted (first 10): {string_sorted[:10]}")
|
||||
|
||||
print(f" Semantic vs String comparison:")
|
||||
|
||||
print(" Semantic vs String comparison:")
|
||||
for i in range(min(5, len(recent_versions))):
|
||||
semantic = recent_versions[i] if i < len(recent_versions) else "N/A"
|
||||
string_sort = string_sorted[i] if i < len(string_sorted) else "N/A"
|
||||
match = "✓" if semantic == string_sort else "✗"
|
||||
print(f" {i+1}: {semantic} vs {string_sort} {match}")
|
||||
|
||||
print(f" {i + 1}: {semantic} vs {string_sort} {match}")
|
||||
|
||||
except Exception as e:
|
||||
print(f" Error querying {package_name}: {e}")
|
||||
|
||||
|
||||
print()
|
||||
|
||||
|
||||
|
|
@ -56,50 +57,50 @@ async def test_specific_version_ordering():
|
|||
print("=" * 60)
|
||||
print("Specific Version Ordering Tests")
|
||||
print("=" * 60)
|
||||
|
||||
|
||||
# Let's test django which is known to have alpha, beta, rc versions
|
||||
try:
|
||||
print("Testing Django version ordering:")
|
||||
result = await query_package_versions("django")
|
||||
|
||||
|
||||
all_versions = result.get("versions", [])
|
||||
|
||||
|
||||
# Find versions around a specific release to verify ordering
|
||||
django_4_versions = [v for v in all_versions if v.startswith("4.2")][:15]
|
||||
print(f" Django 4.2.x versions: {django_4_versions}")
|
||||
|
||||
|
||||
# Check if pre-release versions are properly ordered
|
||||
pre_release_pattern = ["4.2a1", "4.2b1", "4.2rc1", "4.2.0"]
|
||||
found_versions = [v for v in django_4_versions if v in pre_release_pattern]
|
||||
print(f" Found pre-release sequence: {found_versions}")
|
||||
|
||||
|
||||
if len(found_versions) > 1:
|
||||
print(" Checking pre-release ordering:")
|
||||
for i in range(len(found_versions) - 1):
|
||||
current = found_versions[i]
|
||||
next_ver = found_versions[i + 1]
|
||||
print(f" {current} comes before {next_ver}")
|
||||
|
||||
|
||||
except Exception as e:
|
||||
print(f" Error testing Django versions: {e}")
|
||||
|
||||
|
||||
print()
|
||||
|
||||
|
||||
async def main():
|
||||
"""Main test function."""
|
||||
print("Real Package Version Sorting Test")
|
||||
print("="*60)
|
||||
|
||||
print("=" * 60)
|
||||
|
||||
# Test with real packages
|
||||
await test_real_package_versions()
|
||||
|
||||
|
||||
# Test specific version ordering scenarios
|
||||
await test_specific_version_ordering()
|
||||
|
||||
|
||||
print("=" * 60)
|
||||
print("Real package test completed!")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
asyncio.run(main())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue