feat: add comprehensive PyPI search functionality with advanced filtering

- Implemented PyPISearchClient with semantic search, filtering, and sorting
- Added 4 new search tools: search_packages, search_by_category, find_alternatives, get_trending_packages
- Created SearchFilter and SearchSort classes for flexible configuration
- Added SearchError exception for search-specific error handling
- Comprehensive test suite with 13 tests covering all search functionality
- Enhanced MCP server with 4 new search endpoints
- Support for filtering by Python version, license, category, downloads, maintenance status
- Multiple sorting options: relevance, popularity, quality, recency, name, downloads
- Semantic search using description similarity scoring
- Category-based package discovery with intelligent keyword matching
- Package alternatives finder using metadata analysis
- Trending packages analysis with download activity tracking
- Robust fallback mechanisms using curated package database
- All tests passing (13/13)

This implements feature #6 from the roadmap: "Advanced PyPI Search with filtering by Python version, license, maintenance status and sorting by popularity, recency, quality score with semantic search capabilities"
This commit is contained in:
Ryan Malloy 2025-08-16 07:45:40 -06:00
parent 7ace364f32
commit e205176ace
6 changed files with 1430 additions and 1 deletions

View file

@ -21,6 +21,12 @@ from .package_query import (
query_package_info,
query_package_versions,
)
from .search import (
find_alternatives,
get_trending_packages,
search_by_category,
search_packages,
)
__all__ = [
"query_package_info",
@ -34,4 +40,8 @@ __all__ = [
"get_package_download_stats",
"get_package_download_trends",
"get_top_packages_by_downloads",
"search_packages",
"search_by_category",
"find_alternatives",
"get_trending_packages",
]