Skip to content

Commit 5eea641

Browse files
Merge branch 'main-3.0-dev' into carl/3.0-announcement
2 parents b97766a + 4fa0002 commit 5eea641

23 files changed

+1767
-142
lines changed

CLAUDE.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
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

docs/cli/cli-subscriptions.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -450,22 +450,21 @@ planet subscriptions request-catalog \
450450
--filter filter.json > request-catalog.json
451451
```
452452

453-
### Planetary Variable Request
454-
455-
Subscribing to Planetary Variables is much like subscribing to imagery from
456-
Planet's catalog. The `planet subscriptions request-pv` command can construct the source
457-
part of a Planetary Variable request like `request-catalog` does for cataloged
458-
imagery. Planetary Variable subscriptions come in 4 types and are further
459-
subdivided within these types by an identifier. See [Subscribing to Planetary
460-
Variables](https://docs.planet.com/develop/apis/subscriptions/sources/#planetary-variable-and-analysis-ready-source-types)
461-
for details. To constrain data delivery by space and time, you will use the
453+
### Planetary Variable and Analysis-Ready Source Requests
454+
455+
Subscribing to Planetary Variables and Analysis-Ready data is much like subscribing to imagery from
456+
Planet's catalog. The `planet subscriptions request-source` command can construct the source
457+
part of a Planetary Variable or Analysis-Ready source request like `request-catalog` does for cataloged
458+
imagery. See [Subscribing to Planetary
459+
Variables and Analysis Ready sources](https://docs.planet.com/develop/apis/subscriptions/sources/#planetary-variable-and-analysis-ready-source-types)
460+
for details about different product options. To constrain data delivery by space and time, you will use the
462461
`--geometry`, `start-time`, and `end-time` options described above.
463462

464463
```sh
465-
planet subscriptions request-pv \
466-
--var-id BIOMASS-PROXY_V3.0_10 \
464+
planet subscriptions request-source \
465+
--source-id BIOMASS-PROXY_V3.0_10 \
467466
--geometry geometry.geojson \
468-
--start-time 2022-08-24T00:00:00-07:00 > request-pv.json
467+
--start-time 2022-08-24T00:00:00-07:00 > request-source.json
469468
```
470469

471470
### Subscription Tools

docs/get-started/upgrading-v3.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,9 @@ Users developing new applications should consult the [Client Authentication Guid
9292
for a complete discussion of all OAuth2 based mechanisms. OAuth2 mechanisms
9393
should be preferred to the use of Planet API keys.
9494

95+
## Additional Breaking Changes
96+
97+
* Deprecated `planet.subscription_request.clip_tool()` method for defining custom clip AOIs with requests to create subscriptions. Subscriptions API no longer supports custom clip AOIs; instead users can opt-in to clip to their subscription source geometry by including kwarg `clip_to_source=True` when constructing requests via `planet.subscription_request.build_request()`. See [PR #1169](https://github.com/planetlabs/planet-client-python/pull/1169) for implementation details.
98+
* Renamed `planet.cli.subscriptions.request_pv()` to `planet.cli.subscriptions.request_source()`, and removed `var_type` positional argument from the signature. This change, in effect renames the CLI argument `planet subscriptions request-pv` to `planet subscriptions request-source`. Also renamed `planet.subscription_request.planetary_variable_source()` to `planet.subscription_request.subscription_source()`. Source type positional arguments are removed from these methods in favor of `source_id`. See [PR #1170](https://github.com/planetlabs/planet-client-python/pull/1170) for implementation details.
99+
95100
----

docs/hooks/mkdocs_hooks.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from planet import __version__ as _pl_sdk_version
22

3+
34
def on_config(config):
45
"""
56
This is for injecting the package version into mkdocs

docs/python/sdk-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ You will need your ACCESS_KEY_ID, SECRET_ACCESS_KEY, bucket and region name.
225225
To subscribe to scenes that match a filter, use the `subscription_request` module to build a request, and
226226
pass it to the `subscriptions.create_subscription()` method of the client.
227227

228-
By default, a request to create a subscription will not clip matching imagery which intersects the source geometry. To clip to the subscription source geometry, set `planet.subscription_request.build_request()` keyword argument `clip_to_source = True` as in the example below. To clip to a custom geometry, set `planet.subscription_request.build_request()` keyword argument `clip_to_source = False` (or omit it entirely to fall back on the default value), and instead configure the custom clip AOI with `planet.subscription_request.clip_tool()`.
228+
By default, a request to create a subscription will not clip matching imagery which intersects the source geometry. To clip to the subscription source geometry, set `planet.subscription_request.build_request()` keyword argument `clip_to_source = True` as in the example below. Custom clip AOIs are no longer supported in subscriptions.
229229

230230
Warning: the following code will create a subscription, consuming quota based on your plan.
231231

docs/python/sdk-reference.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ title: Python SDK API Reference
1010
rendering:
1111
show_root_full_path: false
1212

13+
## ::: planet.MosaicsClient
14+
rendering:
15+
show_root_full_path: false
16+
1317
## ::: planet.OrdersClient
1418
rendering:
1519
show_root_full_path: false

examples/mosaics-cli.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
echo -e "List the mosaic series that have the word Global in their name"
4+
planet mosaics series list --name-contains=Global | jq .[].name
5+
6+
echo -e "\nWhat is the latest mosaic in the series named Global Monthly, with output indented"
7+
planet mosaics series list-mosaics "Global Monthly" --latest --pretty
8+
9+
echo -e "\nHow many quads are in the mosaic with this ID (name also accepted!)?"
10+
planet mosaics search 09462e5a-2af0-4de3-a710-e9010d8d4e58 --bbox=-100,40,-100,40.1 | jq .[].id
11+
12+
echo -e "\nWhat scenes contributed to this quad in the mosaic with this ID (name also accepted)?"
13+
planet mosaics contributions 09462e5a-2af0-4de3-a710-e9010d8d4e58 455-1273
14+
15+
echo -e "\nDownload them to a directory named quads!"
16+
planet mosaics download 09462e5a-2af0-4de3-a710-e9010d8d4e58 --bbox=-100,40,-100,40.1 --output-dir=quads

planet/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from .__version__ import __version__ # NOQA
1818
from .auth import Auth
1919
from .auth_builtins import PlanetOAuthScopes
20-
from .clients import DataClient, FeaturesClient, OrdersClient, SubscriptionsClient # NOQA
20+
from .clients import DataClient, FeaturesClient, MosaicsClient, OrdersClient, SubscriptionsClient # NOQA
2121
from .io import collect
2222
from .sync import Planet
2323

@@ -28,6 +28,7 @@
2828
'DataClient',
2929
'data_filter',
3030
'FeaturesClient',
31+
'MosaicsClient',
3132
'OrdersClient',
3233
'order_request',
3334
'Planet',

planet/cli/cli.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import planet_auth_utils
2222
import planet
23+
from planet.cli import mosaics
2324

2425
from . import auth, cmds, collect, data, orders, subscriptions, features
2526

@@ -128,6 +129,7 @@ def _configure_logging(verbosity):
128129
main.add_command(subscriptions.subscriptions) # type: ignore
129130
main.add_command(collect.collect) # type: ignore
130131
main.add_command(features.features)
132+
main.add_command(mosaics.mosaics)
131133

132134
if __name__ == "__main__":
133135
main() # pylint: disable=E1120

0 commit comments

Comments
 (0)