Skip to content

Conversation

@asonnenschein
Copy link
Contributor

This PR provides a complete, production-ready Analytics API client that seamlessly integrates with the existing Planet Python SDK architecture and follows all established patterns and conventions. Generated with help from Claude Code:

Ticket

#1189

Key Features

Analytics Feeds:

  • List available feeds
  • Get feed details
  • Get feed statistics with temporal filtering

Analytics Subscriptions:

  • List subscriptions (with optional feed filtering)
  • Get subscription details

Analytics Results:

  • Search results with extensive filtering:
    • Feed ID and subscription ID filtering
    • Temporal filtering (start/end time)
    • Spatial filtering (bounding box and geometry)
    • Pagination support
  • Get individual result details
  • Download results in multiple formats

CLI Interface:

  • planet analytics feeds list/get/stats
  • planet analytics subscriptions list/get
  • planet analytics results search/get/download
  • All commands support proper options and error handling

Details

  1. Async Analytics Client (planet/clients/analytics.py)
    • Full feature parity with Analytics API endpoints
    • Supports listing feeds, getting feed details, managing subscriptions
    • Search and retrieve analytics results with filtering options
    • Download results in multiple formats (JSON, GeoJSON, CSV)
    • Get feed statistics
  2. Sync Analytics Client (planet/sync/analytics.py)
    • Synchronous wrapper around the async client
    • Same API surface as async client but blocking
    • Integrated with the main Planet sync client
  3. CLI Implementation (planet/cli/analytics.py)
    • Complete CLI interface using the async client
    • Commands for feeds, subscriptions, and results
    • Support for all filtering and download options
    • Proper error handling and input validation

Integration

  • Added Analytics client to main client exports
  • Integrated with sync Planet client
  • Added Analytics CLI commands to main CLI

Testing

  • Comprehensive unit tests for async client (16 tests)
  • Unit tests for sync client (15 tests)
  • Unit tests for CLI commands
  • Integration tests for both async and sync clients
  • Integration tests for CLI commands

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a comprehensive Analytics API implementation to the Planet Python SDK, providing complete client support for accessing Planet's Analytics feeds and results. The implementation follows the established SDK patterns and includes both async and sync clients with CLI integration.

Key Changes

  • Added asynchronous AnalyticsClient with full CRUD operations for feeds, subscriptions, and results
  • Created synchronous AnalyticsAPI wrapper for blocking operations
  • Implemented comprehensive CLI interface with commands for all Analytics operations

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
planet/clients/analytics.py Core async Analytics client with feed, subscription, and result operations
planet/sync/analytics.py Synchronous wrapper providing blocking API interface
planet/cli/analytics.py Complete CLI implementation with search, filtering, and download capabilities
planet/clients/init.py Added Analytics client to module exports
planet/sync/client.py Integrated Analytics API into main Planet client
planet/cli/cli.py Added Analytics commands to main CLI
tests/unit/test_*.py Comprehensive unit tests for all components
tests/integration/test_*.py Integration tests for client and CLI functionality
Comments suppressed due to low confidence (1)

tests/unit/test_analytics_sync.py:222

  • The parameter name 'format' shadows the built-in function. Consider renaming it to 'result_format' or 'file_format' to avoid confusion.
            assert result == stats_data

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@asonnenschein asonnenschein mentioned this pull request Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants