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
|
|
@ -4,8 +4,8 @@ Test script for the enhanced PyPI download statistics with fallback mechanisms.
|
|||
"""
|
||||
|
||||
import asyncio
|
||||
import sys
|
||||
import os
|
||||
import sys
|
||||
|
||||
# Add the package to Python path
|
||||
sys.path.insert(0, os.path.abspath("."))
|
||||
|
|
@ -33,62 +33,66 @@ async def test_download_stats():
|
|||
try:
|
||||
# Test recent downloads
|
||||
stats = await get_package_download_stats(package_name, period="month")
|
||||
|
||||
|
||||
print(f"Package: {stats.get('package')}")
|
||||
print(f"Data Source: {stats.get('data_source')}")
|
||||
print(f"Reliability: {stats.get('reliability', 'unknown')}")
|
||||
|
||||
if stats.get('warning'):
|
||||
|
||||
if stats.get("warning"):
|
||||
print(f"⚠️ Warning: {stats['warning']}")
|
||||
|
||||
|
||||
downloads = stats.get("downloads", {})
|
||||
print(f"Downloads - Day: {downloads.get('last_day', 0):,}, " +
|
||||
f"Week: {downloads.get('last_week', 0):,}, " +
|
||||
f"Month: {downloads.get('last_month', 0):,}")
|
||||
|
||||
if stats.get('data_quality_note'):
|
||||
print(
|
||||
f"Downloads - Day: {downloads.get('last_day', 0):,}, "
|
||||
+ f"Week: {downloads.get('last_week', 0):,}, "
|
||||
+ f"Month: {downloads.get('last_month', 0):,}"
|
||||
)
|
||||
|
||||
if stats.get("data_quality_note"):
|
||||
print(f"Note: {stats['data_quality_note']}")
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ Error: {e}")
|
||||
|
||||
print(f"\n📈 Testing download trends for 'requests':")
|
||||
print("\n📈 Testing download trends for 'requests':")
|
||||
print("-" * 50)
|
||||
|
||||
try:
|
||||
trends = await get_package_download_trends("requests", include_mirrors=False)
|
||||
|
||||
|
||||
print(f"Package: {trends.get('package')}")
|
||||
print(f"Data Source: {trends.get('data_source')}")
|
||||
print(f"Reliability: {trends.get('reliability', 'unknown')}")
|
||||
|
||||
if trends.get('warning'):
|
||||
|
||||
if trends.get("warning"):
|
||||
print(f"⚠️ Warning: {trends['warning']}")
|
||||
|
||||
|
||||
trend_analysis = trends.get("trend_analysis", {})
|
||||
print(f"Data Points: {trend_analysis.get('data_points', 0)}")
|
||||
print(f"Total Downloads: {trend_analysis.get('total_downloads', 0):,}")
|
||||
print(f"Trend Direction: {trend_analysis.get('trend_direction', 'unknown')}")
|
||||
|
||||
if trends.get('data_quality_note'):
|
||||
|
||||
if trends.get("data_quality_note"):
|
||||
print(f"Note: {trends['data_quality_note']}")
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ Error: {e}")
|
||||
|
||||
print(f"\n🏆 Testing top packages:")
|
||||
print("\n🏆 Testing top packages:")
|
||||
print("-" * 50)
|
||||
|
||||
try:
|
||||
top_packages = await get_top_packages_by_downloads(period="month", limit=5)
|
||||
|
||||
|
||||
print(f"Data Source: {top_packages.get('data_source')}")
|
||||
print(f"Reliability: {top_packages.get('reliability', 'unknown')}")
|
||||
print(f"Success Rate: {top_packages.get('data_collection_success_rate', 'unknown')}")
|
||||
|
||||
if top_packages.get('warning'):
|
||||
print(
|
||||
f"Success Rate: {top_packages.get('data_collection_success_rate', 'unknown')}"
|
||||
)
|
||||
|
||||
if top_packages.get("warning"):
|
||||
print(f"⚠️ Warning: {top_packages['warning']}")
|
||||
|
||||
|
||||
packages_list = top_packages.get("top_packages", [])
|
||||
print(f"\nTop {len(packages_list)} packages:")
|
||||
for package in packages_list[:5]:
|
||||
|
|
@ -107,4 +111,4 @@ async def test_download_stats():
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(test_download_stats())
|
||||
asyncio.run(test_download_stats())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue