PlanetaryPy CLI: plp_update_indexes
Overview
Added a command-line interface for forcing update checks of PDS index configuration and dynamic URL discovery.
Files Created/Modified
1. New CLI Module: src/planetarypy/pds/cli.py
- Function:
plp_update_indexes() - Features:
- Force update check for main configuration URLs
- Force discovery of dynamic URLs (CTX and LROC indices)
- Verbose output with detailed progress
- Selective updates with
--config-onlyor--dynamic-onlyflags - Proper error handling and user-friendly messages
2. Updated Dependencies: pyproject.toml
- Added:
clickto core dependencies for CLI functionality - Added: Script entry point
plp_update_indexes = "planetarypy.pds.cli:plp_update_indexes"
3. Test Script: test_cli.py
- Validates CLI help functionality
- Tests CLI structure and argument parsing
- Provides usage examples
CLI Usage
Basic Commands
# Show help
plp_update_indexes --help
# Update everything with verbose output
plp_update_indexes --verbose
# Update only configuration URLs
plp_update_indexes --config-only
# Update only dynamic URLs
plp_update_indexes --dynamic-onlyCommand Options
--verbose, -v: Enable detailed progress output--config-only: Only check/update main configuration URLs--dynamic-only: Only check/update dynamic URLs (CTX, LROC)--help: Show usage information
Functionality
What It Does
- Configuration Update: Forces check of remote configuration file for updates
- Dynamic URL Discovery: Forces discovery of latest CTX and LROC index URLs
- Verbose Reporting: Shows detailed progress and results
- Error Handling: Graceful handling of network errors and other issues
Output Examples
✅ Successfully checked configuration URLs and dynamic URLs for updates.
With --verbose:
Checking configuration URLs for updates...
Checking dynamic URLs for updates...
✅ mro.ctx.edr: Updated to https://planetarydata.jpl.nasa.gov/img/data/mro/ctx/mrox_5100//index/cumindex.lbl
ℹ️ lro.lroc.edr: No change - https://pds.lroc.asu.edu/data/LRO-L-LROC-2-EDR-V1.0/LROLRC_0063A//INDEX/CUMINDEX.LBL
Integration
- Integrates with existing
IndexURLsConfigclass - Uses the same update mechanisms as automatic daily checks
- Respects all existing logging and timestamp tracking
- Works with the new access log structure (config timestamps at root, dynamic URLs in sections)
Installation
After installing the package, the CLI will be available system-wide as plp_update_indexes.
Dependencies
- click: For command-line interface framework
- All existing planetarypy dependencies (requests, tomlkit, loguru, etc.)
Use Cases
- Manual Updates: Force immediate update check without waiting for daily automatic checks
- Debugging: Verbose mode helps troubleshoot update issues
- Selective Updates: Update only specific components when needed
- CI/CD Integration: Can be used in automated scripts and deployment pipelines