Implement Persistent Version Metadata Cache with Security Vulnerability Indexing#74
Merged
shreyasmene06 merged 24 commits intoshreyasmene06:mainfrom Feb 9, 2026
Merged
Conversation
Contributor
Author
|
Only a few hours left before acwoc ends , please merge this pr before that @shreyasmene06 |
shreyasmene06
approved these changes
Feb 9, 2026
Owner
There was a problem hiding this comment.
Excellent implementation of the metadata cache system! This is a substantial, well-designed feature.
What's great
- SQLite-based persistent cache with proper schema
- TTL logic with 24h default, configurable via constants
- Non-blocking background sync using threading
- Thread-safe with
threading.Lock() - Graceful fallback to network when cache is empty
- EOL/security status tracking
- Advanced filtering API (
get_versions_filtered,is_version_security_supported) - Clean integration with existing
version.py
Suggestions (non-blocking)
1. Add tests
This is a complex feature that really should have tests. Consider adding:
# tests/test_metadata_store.py
def test_cache_creation():
"""Test that cache DB is created."""
def test_is_cache_stale_when_empty():
"""Test stale detection on fresh DB."""
def test_sync_populates_cache():
"""Test that sync adds data to cache."""
def test_background_sync_is_non_blocking():
"""Test that background sync doesn't block."""
def test_get_versions_filtered():
"""Test filtering by min_version and security status."""- Consider adding CLI commands (follow-up PR)
pyvm cache status # Show cache age, entry count
pyvm cache refresh # Force sync
pyvm cache clear # Delete cache - Minor type hint
This is exactly what issue #71 requested - a robust local data engine with caching, EOL tracking, and filtering. Great work on a hard issue!
LGTM! 🎉
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #71
PR Summary
Adds a local SQLite metadata cache with 24h TTL for Python releases/versions.
Implements a background sync worker for python.org; cache-first reads with async refresh.
Overhauls version fetching to use the cache; adds filtering API and security-support helper.
Improves TUI responsiveness by avoiding blocking network calls.
Prepares groundwork for CVE ingestion and additional sources (conda-forge) in future PRs.
Key Changes
New: metadata_store.py (SQLite schema, TTL checks, sync + background worker)
Update: version.py (cache integration, advanced filtering, security/EOL helpers)
Update: constants.py (METADATA_DB, METADATA_TTL_SECONDS)
Impact
Faster, reliable version data in TUI/CLI with offline support.
Consistent status normalization for EOL/security warnings.
Extensible path for multi-source metadata and CVE integration