Broken examples in order_request and subscription_request docstrings, async SDK guide and CLI tips
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 35/100
- Type d'issue
- Documentation
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- python
- Domaine
- documentation
Piste de recherche
Read the docstrings for planet.order_request.build_request, planet.order_request.delivery, and planet.subscription_request.build_request, plus the “Create an order request” section in docs/python/async-sdk-guide.md and “Large Dataset Visualization” in docs/cli/cli-tips-tricks.md. Reproduce the reported syntax and command errors, then correct the examples so they compile, pass tools by keyword, and use the documented CLI command. Done when all five examples work as described; the issue author reports having a patch and offers to open a PR.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Expected behavior
Each documented example runs when copied (placeholder keys aside). The order_request.build_request example produces an order that contains its tools.
Actual behavior (describe the problem)
Five examples fail. They fail in the source on main (a6c66cb, the 3.7.0 tag) and in the 3.7.0 wheel. The published docs (planet-sdk-for-python.readthedocs.io/en/latest/, pages python/sdk-reference, python/async-sdk-guide and cli/cli-tips-tricks) show the same text.
planet.order_request.build_requestdocstring:SyntaxError: unmatched ')'at'analytic', 'REOrthoTile')]). With that fixed, the last linebuild_request('test_order', products, tools)passestoolsas the third positional argument, which issubscription_id. No error is raised. The result has notoolskey andsubscription_idholds the tool list. The example also usesprojection='WSG84'; thereproject_tooldocstring asks forEPSG:n.planet.order_request.deliverydocstring:SyntaxError: invalid syntax. Perhaps you forgot a comma?atarchive_filename='{{order_id}}.zip'. There is no comma beforecloud_config.planet.subscription_request.build_requestdocstring:NameError: name 'sentinel_hub' is not defined. The import line lists onlybuild_request, catalog_source, amazon_s3.docs/python/async-sdk-guide.md, "Create an order request":IndentationError. The function body is indented 4 spaces up to theoregon_aoidict and 3 spaces after it. Once that is fixed:SyntaxError, missing comma afteritem_type='PSScene'. The JSON block below it is invalid too:"name":"oregon_order”,ends in a curly quote, and the key is"Item_ids"where the code usesitem_ids.docs/cli/cli-tips-tricks.md, "Large Dataset Visualization":planet data collect skysat-large.geojsonsgivesError: No such command 'collect'.The command isplanet collect, as the sentence above the block says.
Related Issues
None of these is reported. Nearby:
- #869 (closed) fixed other broken CLI examples.
- #938 (closed) updated older docstring examples.
- #874 (open) tracks retired item types in examples. The
build_requestexample here usesREOrthoTile. - #373 (open) "Establish testing for documentation".
- #311 (open) "Bring docs_test and examples up to date"; covers the
docs_testnox session.
Workaround
- Remove the stray
])at the end of theproduct(...)line, passtools=tools, and useprojection='EPSG:4326'. - Add a comma after
'{{order_id}}.zip'. - Also import
sentinel_hub. - Re-indent the body to 4 spaces, add the comma after
item_type='PSScene', replace the curly quote, and use the keyitem_ids. - Use
planet collect.
I have a patch for all five (docstrings and docs only; unit tests, flake8 and yapf pass) and can open a PR if you want one.
Minimum, Complete, Viable Code Sample
No API key is needed. product() fetches the public bundle spec once.
# check_examples.py
import inspect, re, textwrap
from planet import order_request, subscription_request
def fenced(fn):
block = re.search(r"```python\n(.*?)```", inspect.getdoc(fn), re.S).group(1)
lines = textwrap.dedent(block).splitlines()
return "\n".join(l[4:] if l.startswith((">>> ", "... ")) else
("" if l in (">>>", "...") else l) for l in lines)
for fn in (order_request.build_request, order_request.delivery):
try:
compile(fenced(fn), fn.__name__, "exec")
print(fn.__name__, "compiles")
except SyntaxError as e:
print(f"order_request.{fn.__name__}: SyntaxError: {e.msg}: {e.text.strip()!r}")
# subscription_request.build_request uses an "Example::" block
code = textwrap.dedent(inspect.getdoc(subscription_request.build_request).split("Example::\n", 1)[1])
try:
exec(code, {"ACCESS_KEY_ID": "id", "SECRET_ACCESS_KEY": "secret"})
except Exception as e:
print(f"subscription_request.build_request: {type(e).__name__}: {e}")
# order_request.build_request example with only the bracket typo fixed
products = [order_request.product(["20170614_113217_3163208_RapidEye-5"], "analytic", "REOrthoTile")]
tools = [order_request.toar_tool(scale_factor=10000)]
req = order_request.build_request("test_order", products, tools) # call as written in the docstring
print(sorted(req), "tools" in req, req["subscription_id"])
> python check_examples.py
order_request.build_request: SyntaxError: unmatched ')': "'analytic', 'REOrthoTile')])"
order_request.delivery: SyntaxError: invalid syntax. Perhaps you forgot a comma?: "archive_filename='{{order_id}}.zip'"
subscription_request.build_request: NameError: name 'sentinel_hub' is not defined
['name', 'products', 'subscription_id'] False [{'toar': {'scale_factor': 10000}}]
For 4, copy the python block under "Create an order request" in docs/python/async-sdk-guide.md into guide.py and add import planet as the first line (without that line the same error is reported at line 13):
> python -m py_compile guide.py
Sorry: IndentationError: unindent does not match any outer indentation level (guide.py, line 14)
With the body re-indented to 4 spaces:
> python -m py_compile guide.py
File "guide.py", line 21
item_type='PSScene'
^^^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?
For 5:
> echo '{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[1,2]}}' > skysat-large.geojsons
> planet data collect skysat-large.geojsons
Usage: planet data [OPTIONS] COMMAND [ARGS]...
Try 'planet data --help' for help.
Error: No such command 'collect'.
> planet collect skysat-large.geojsons
{"type": "FeatureCollection", "features": [ ... ]}
Environment Information
- Operation System Information: macOS-27.0.1-arm64-arm-64bit
- Python version: 3.12.15 (main, Oct 9 2026, 15:10:57) [Clang 22.1.3 ]
- Planet package version: planet, version 3.7.0 (PyPI wheel, and main at a6c66cb, which is the 3.7.0 tag)
Installation Method
- pip wheel (
uv pip install planet) and from source (pip install -e .)
Found and reproduced with an AI coding assistant, then checked by me.
- Langage dominant
- Python
- Étoiles
- 300
- Forks
- 100
- Merge moyen
- 6 j 18 h
- PR mergées (30 j)
- 1
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de planetlabs/planet-client-python
-
DataClient.wait_asset raises "Maximum number of attempts reached" when the last poll returns an active assetPeut-être pris @sebxt l’a pris il y a 17 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
planetlabs/planet-client-python#1232 ·
-
CLI: invalid --geom/--geometry value prints a traceback and exits 1 instead of a usage errorOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
planetlabs/planet-client-python#1230 ·
-
better-testing
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
planetlabs/planet-client-python#1110 ·
-
FeaturesClient list_items does not support filteringPeut-être pris @steps-re l’a pris il y a 120 jours. Ouverteproposal
Difficulté 3/5 1-2 jours Accessibilité débutants 65/100
planetlabs/planet-client-python#1221 ·
-
FeaturesClient does not implement Update FeaturePeut-être pris @tbarsballe l’a pris il y a 149 jours. Ouverteproposal
Difficulté 3/5 1-2 jours Accessibilité débutants 57/100
planetlabs/planet-client-python#1214 ·
Toutes les issues de planetlabs/planet-client-python
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
huggingface/deep-rl-class#723 ·
-
[tool] bug: Qwen3 XML tool parser raises on `...` argument values (Ellipsis is not JSON serializable)Peut-être pris @super-yuki l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 87/100
verl-project/verl#8559 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
TencentCloud/octop-harness#228 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
google/osv-scalibr#2585 ·
Les mainteneurs répondent en général sous 2 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
NousResearch/hermes-agent#149323 ·
Les mainteneurs répondent en général sous 1 jour