planet-client-python icon indicating copy to clipboard operation
planet-client-python copied to clipboard

Code snippets for all APIs

Open kevinlacaille opened this issue 2 years ago • 4 comments
trafficstars

Related Issue(s):

Closes #540 #937

Proposed Changes:

For inclusion in changelog (if applicable):

  1. Code snippets for Orders API, Data API, and Subscriptions API.

Not intended for changelog:

Diff of User Interface

Old behavior: N/A

New behavior: N/A

PR Checklist:

  • [x] This PR is as small and focused as possible
  • [x] If this PR includes proposed changes for inclusion in the changelog, the title of this PR summarizes those changes and is ready for inclusion in the Changelog.
  • [ ] I have updated docstrings for function changes and docs in the 'docs' folder for user interface / behavior changes
  • [ ] This PR does not break any examples or I have updated them

(Optional) @mentions for Notifications: @jreiberkyle

kevinlacaille avatar Apr 26 '23 19:04 kevinlacaille

@cholmes, @sgillies, @jreiberkyle I've pushed this back to a draft PR to work on the markdown ticket (#936) in parallel, as we'll need to add the Snippets extension to add the ability to embed these snippets directly into the markdown.

See:

  • https://squidfunk.github.io/mkdocs-material/setup/extensions/python-markdown-extensions/#snippets
  • https://facelessuser.github.io/pymdown-extensions/extensions/snippets/

kevinlacaille avatar Apr 26 '23 19:04 kevinlacaille

@kevinlacaille I've realized a complication for testing against the production APIs: the test runner can only access saved searches and orders that it has made using the same credentials. It looks to me like your tests rely on your own saved searches and orders and that's not going to work.

So it looks like you'll have to have a snippet to make a search, then get that search's id to go back to it. Same for orders.

sgillies avatar May 12 '23 20:05 sgillies

@kevinlacaille the main source of errors in the new tests is that the clients are pointed at the production API while the credentials stored in GitHub are for staging. See https://github.com/planetlabs/planet-client-python/actions/runs/5525726227/jobs/10079664599#step:5:616.

I think we should reconsider running these snippets against our API. It's not very complicated for the Data API. But it gets more complicated for APIs that are stateful. Is it going to be feasible to keep making and downloading orders every time these tests run? Not to mention subscriptions, which need a cloud destination.

sgillies avatar Jul 12 '23 20:07 sgillies

NOTE: Maybe add in CONTRIBUTING.md on how to add to the snippets if a new function is added or if functionality changes.

kevinlacaille avatar Jul 21 '23 17:07 kevinlacaille