feat: add PyPI package download statistics and popularity analysis tools #21
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
π New Features
This PR adds comprehensive PyPI package download statistics and popularity analysis tools to the MCP server.
β¨ What's New
π Download Statistics Tools
get_download_statistics
- Get comprehensive download statistics for any packageget_download_trends
- Analyze download trends and time series data (last 180 days)get_top_downloaded_packages
- Get the most popular packages by download countπ§ Core Infrastructure
PyPIStatsClient
- New async client for pypistats.org API integrationπ― Use Cases
Now you can ask questions like:
π Example Output
π§ͺ Testing
π Documentation
examples/download_stats_demo.py
)π Backward Compatibility
π¦ Files Changed
pypi_query_mcp/core/stats_client.py
- New PyPIStatsClient for API integrationpypi_query_mcp/tools/download_stats.py
- Download statistics tools implementationpypi_query_mcp/server.py
- New MCP tools registrationtests/test_download_stats.py
- Comprehensive test coverageexamples/download_stats_demo.py
- Demo script with examplesREADME.md
- Updated documentationπ Ready for Use
This feature is production-ready and can be used immediately after merging. The pypistats.org API is stable and widely used by the Python community.
Note: This implementation uses the pypistats.org API which provides download statistics for the last 180 days. For longer historical data, users can be directed to use Google BigQuery with PyPI datasets.