POC Quota API SDK/CLI - #1217
Conversation
|
@asonnenschein to do - add tests. |
There was a problem hiding this comment.
Pull request overview
Adds first-pass SDK + CLI support for Planet’s Quota Reservations API, including an async client, sync wrapper on Planet, and a new planet quota CLI command group, plus integration tests for both API and CLI behavior.
Changes:
- Introduces
QuotaClient(async) with pagination support for the Quota API response shape. - Adds
QuotaAPI(sync) and exposes it asPlanet().quota. - Adds
planet quotaCLI group (products/reservations/jobs) and integration tests covering expected request/response behavior.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/integration/test_quota_cli.py | New integration coverage for planet quota CLI subcommands and request parameter handling. |
| tests/integration/test_quota_api.py | New integration coverage for async + sync Quota API clients, pagination, and product filtering. |
| planet/sync/quota.py | New synchronous wrapper (QuotaAPI) around the async QuotaClient. |
| planet/sync/client.py | Exposes QuotaAPI as Planet().quota. |
| planet/clients/quota.py | New async QuotaClient + _QuotaPaged pagination adapter for {meta, results} responses. |
| planet/clients/init.py | Registers and exports QuotaClient for sess.client('quota') resolution. |
| planet/cli/types.py | Adds mypy override ignores for CommaSeparatedString/Float.convert signatures. |
| planet/cli/quota.py | New planet quota CLI group implementation using the async client. |
| planet/cli/cli.py | Registers the new quota CLI command group. |
| planet/init.py | Exports QuotaClient from the top-level planet package. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tbarsballe
left a comment
There was a problem hiding this comment.
Overall, this looks good. I've run some test commands locally, and everything works how I'd expect (though I didn't actually try reserving anything).
There's a little bit of an issue with verbose structure + vague or redundant comments throughout the MR, that is common with AI code but it's not too bad there. I've called out a couple places where it's noticeably inconsistent.
Following on from the discussion points during last weeks office hours: I ran quota reservations list on a customer account, and can confirm non-null organization_ids are returned in the results - it looks like the weirdness you were seeing when testing is a quirk of org 1.
(client, sync wrapper, CLI) to match SubscriptionsClient - drop section-divider banner comments from cli/quota.py and both quota test files - convert inline test comment to a docstring in test_list_reservations_respects_limit - align docstring cross-reference links to subscription_request.py style ([full.path.Class.method][]) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…d docs
- remove unused `T = TypeVar("T")` and its import from clients/quota.py
- validate that `--aoi-refs` parses to a JSON array of strings before
extending the ref list. Previously a JSON object was silently expanded
into its keys and submitted as AOI refs; regression tests added for
both the non-list and non-string-entry cases.
- revert planet/cli/types.py to main's version: #1219 fixed the same
mypy override error properly by rebasing the CommaSeparated* types on
click.ParamType, making this branch's `# type: ignore[override]`
workaround redundant
- default `--page-size` to 500 on `quota jobs list`, matching
`quota reservations list` and the 500 default already used by
QuotaClient.list_jobs / QuotaAPI.list_jobs. The CLI was passing None
and overriding it.
- add `planet.QuotaClient` to docs/python/sdk-reference.md
- add docs/cli/cli-quota.md tutorial and register it in the mkdocs nav
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
9584f44 to
4014043
Compare
Description
Adds support for the Planet Quota Reservations API to the SDK. Includes an async client, sync client, and CLI built on the
async client, following the same patterns used by the existing Planet APIs that are supported in the SDK.
Changes
QuotaClient(planet/clients/quota.py) covering all Quota Reservations API endpoints:list_reservations,get_reservation,create_reservation,bulk_create_reservations,estimate_reservation,list_jobs,get_job, pluslist_products(with optionalsupports_reservationfilter) for looking up theproduct_idrequired by reservation requests._QuotaPagedsubclass ofmodels.Pagedto handle the API's{meta: {next: ...}, results: [...]}pagination shape.QuotaAPI(planet/sync/quota.py) synchronous wrapper, exposed onPlanetaspl.quota.planet quotaCLI group (planet/cli/quota.py) withproducts,reservations, andjobssubcommands. List commands support--limit,--page-size,--sort,--fields, and repeated--filter KEY=VALUE. Mutation commands accept repeated--aoi-refor--aoi-refs <json>(string, file, or stdin) for large AOI lists.QuotaClientinplanet.clients._client_directorysosess.client('quota')resolves it, and exportQuotaClientfrom the top-levelplanetpackage.