planet-client-python
planet-client-python copied to clipboard
Make it possible to extend the "planet" CLI command group
Objective: allow a click command "new-command" defined in a new "planet-tools" package to be accessible as a sub-command of the "planet" CLI group like planet new-command.
There are different ways to do this. A very general approach with demonstrated success is the one taken in Rasterio and Fiona: https://github.com/rasterio/rasterio/blob/main/rasterio/rio/main.py#L18-L21. The gist of it:
- Name an entry point for command plugins.
"planet.cli_command"will suffice. - Use the
with_pluginsdecorator from click_plugins (written by @geowurster) to decorate planet's main CLI group. - Convert existing commands to plugins, as in rasterio and fiona.
This can wait until after 2.0.0. It's not a breaking change.