|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Development Commands |
| 6 | + |
| 7 | +### Testing |
| 8 | +- **Run all tests**: `nox` (runs lint, analyze, test, coverage, docs) |
| 9 | +- **Run tests only**: `nox -s test` |
| 10 | +- **Run tests on specific Python version**: `nox -s test-3.12` |
| 11 | +- **Run single test file**: `nox -s test-3.12 -- tests/unit/test_http.py` |
| 12 | +- **Run tests by keyword**: `nox -s test-3.12 -- -k test__Limiter` |
| 13 | +- **Fast rerun (reuse environments)**: `nox -r` |
| 14 | + |
| 15 | +### Linting and Code Quality |
| 16 | +- **Linting**: `nox -s lint` |
| 17 | +- **Type checking**: `nox -s analyze` |
| 18 | +- **Code coverage**: `nox -s coverage` |
| 19 | +- **Format code**: `yapf --in-place -r .` |
| 20 | +- **Check formatting**: `yapf --diff -r .` |
| 21 | + |
| 22 | +### Documentation |
| 23 | +- **Build docs**: `nox -s docs` |
| 24 | +- **Serve docs locally**: `nox -s watch` |
| 25 | +- **Test documentation examples**: `nox -s docs_test` |
| 26 | + |
| 27 | +### Example Testing |
| 28 | +- **Test all examples**: `nox -s examples` |
| 29 | +- **Test specific example**: `nox -s examples -- script_name.py` |
| 30 | + |
| 31 | +### Building and Publishing |
| 32 | +- **Build package**: `nox -s build` |
| 33 | +- **Clean build directories**: `nox -s clean` |
| 34 | + |
| 35 | +## Code Architecture |
| 36 | + |
| 37 | +### High-Level Structure |
| 38 | +The Planet SDK provides both a Python API and CLI for Planet's APIs (Data, Orders, Subscriptions, Features). |
| 39 | + |
| 40 | +### Core Components |
| 41 | + |
| 42 | +**API Clients** (`planet/clients/`): |
| 43 | +- `DataClient` - Search Planet's imagery catalog |
| 44 | +- `OrdersClient` - Process and download imagery |
| 45 | +- `SubscriptionsClient` - Auto-process and deliver imagery |
| 46 | +- `FeaturesClient` - Upload areas of interest |
| 47 | + |
| 48 | +**Sync Client** (`planet/sync/`): |
| 49 | +- `Planet` class - High-level synchronous interface combining all clients |
| 50 | + |
| 51 | +**CLI** (`planet/cli/`): |
| 52 | +- Entry point: `planet.cli.cli:main` |
| 53 | +- Command modules: `data.py`, `orders.py`, `subscriptions.py`, `features.py` |
| 54 | + |
| 55 | +**Core Infrastructure**: |
| 56 | +- `http.py` - HTTP session management and authentication |
| 57 | +- `auth.py` - Authentication handling |
| 58 | +- `models.py` - Data models and response objects |
| 59 | +- `exceptions.py` - Custom exception classes |
| 60 | + |
| 61 | +**Request Building**: |
| 62 | +- `data_filter.py` - Data API search filters |
| 63 | +- `order_request.py` - Orders API request construction |
| 64 | +- `subscription_request.py` - Subscriptions API request construction |
| 65 | + |
| 66 | +### Key Patterns |
| 67 | +- All API clients extend `base.py:BaseClient` |
| 68 | +- Async and sync versions available (clients vs sync modules) |
| 69 | +- CLI commands use Click framework with shared options in `options.py` |
| 70 | +- Request/response validation via `specs.py` and `models.py` |
| 71 | + |
| 72 | +## Testing Configuration |
| 73 | +- Uses pytest with configuration in `setup.cfg` |
| 74 | +- Supports Python 3.9-3.13 |
| 75 | +- Coverage threshold: 90% (configured in setup.cfg) |
| 76 | +- Integration tests require Planet API credentials |
| 77 | +- Unit tests in `tests/unit/`, integration tests in `tests/integration/` |
| 78 | + |
| 79 | +## Code Style |
| 80 | +- Follows PEP8 via YAPF formatter |
| 81 | +- Type hints checked with mypy |
| 82 | +- Flake8 linting with specific ignores (see setup.cfg) |
| 83 | +- Docstrings in Google format for auto-generated API docs |
0 commit comments