Skip to content

Add CLAUDE.md #1168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Development Commands

### Testing
- **Run all tests**: `nox` (runs lint, analyze, test, coverage, docs)
- **Run tests only**: `nox -s test`
- **Run tests on specific Python version**: `nox -s test-3.12`
- **Run single test file**: `nox -s test-3.12 -- tests/unit/test_http.py`
- **Run tests by keyword**: `nox -s test-3.12 -- -k test__Limiter`
- **Fast rerun (reuse environments)**: `nox -r`

### Linting and Code Quality
- **Linting**: `nox -s lint`
- **Type checking**: `nox -s analyze`
- **Code coverage**: `nox -s coverage`
- **Format code**: `yapf --in-place -r .`
- **Check formatting**: `yapf --diff -r .`

### Documentation
- **Build docs**: `nox -s docs`
- **Serve docs locally**: `nox -s watch`
- **Test documentation examples**: `nox -s docs_test`

### Example Testing
- **Test all examples**: `nox -s examples`
- **Test specific example**: `nox -s examples -- script_name.py`

### Building and Publishing
- **Build package**: `nox -s build`
- **Clean build directories**: `nox -s clean`

## Code Architecture

### High-Level Structure
The Planet SDK provides both a Python API and CLI for Planet's APIs (Data, Orders, Subscriptions, Features).

### Core Components

**API Clients** (`planet/clients/`):
- `DataClient` - Search Planet's imagery catalog
- `OrdersClient` - Process and download imagery
- `SubscriptionsClient` - Auto-process and deliver imagery
- `FeaturesClient` - Upload areas of interest

**Sync Client** (`planet/sync/`):
- `Planet` class - High-level synchronous interface combining all clients

**CLI** (`planet/cli/`):
- Entry point: `planet.cli.cli:main`
- Command modules: `data.py`, `orders.py`, `subscriptions.py`, `features.py`

**Core Infrastructure**:
- `http.py` - HTTP session management and authentication
- `auth.py` - Authentication handling
- `models.py` - Data models and response objects
- `exceptions.py` - Custom exception classes

**Request Building**:
- `data_filter.py` - Data API search filters
- `order_request.py` - Orders API request construction
- `subscription_request.py` - Subscriptions API request construction

### Key Patterns
- All API clients extend `base.py:BaseClient`
- Async and sync versions available (clients vs sync modules)
- CLI commands use Click framework with shared options in `options.py`
- Request/response validation via `specs.py` and `models.py`

## Testing Configuration
- Uses pytest with configuration in `setup.cfg`
- Supports Python 3.9-3.13
- Coverage threshold: 90% (configured in setup.cfg)
- Integration tests require Planet API credentials
- Unit tests in `tests/unit/`, integration tests in `tests/integration/`

## Code Style
- Follows PEP8 via YAPF formatter
- Type hints checked with mypy
- Flake8 linting with specific ignores (see setup.cfg)
- Docstrings in Google format for auto-generated API docs