Command line interface for interacting with the Terra Scientific Pipelines Service, or Teaspoons.
Project description
Teaspoons CLI
Python CLI structure
The CLI code is structured as follows:
terra-scientific-pipelines-service-cli
├── terralab
│ └── commands
│ │ └── __init__.py
│ │ └── auth_commands.py
│ │ └── pipelines_commands.py
│ └── logic
│ │ └── __init__.py
│ │ └── auth_logic.py
│ │ └── pipelines_logic.py
│ └── __init__.py
│ └── auth_helper.py
│ └── cli.py
│ └── client.py
│ └── config.py
│ └── teaspoons
├── tests
│ └── commands
│ │ └── test_auth_commands.py
│ │ └── test_pipelines_commands.py
│ └── logic
│ │ └── test_auth_logic.py
│ │ └── test_pipelines_logic.py
│ └── __init__.py
│ └── auth_helper.py
│ └── cli.py
│ └── client.py
│ └── config.py
│ └── terralab
├── .gitignore
├── .terralab-cli-config
├── poetry.lock
├── pyproject.toml
├── README.md
In the terralab
directory, we have the following files and subdirectories:
auth_helper.py
contains the code for authenticating with the Terra Scientific Pipelines Service (Terra, via b2c).cli.py
assembles the CLI sub-modules that are defined incommands/
.client.py
contains the code for wrapping API calls to the Terra Scientific Pipelines Service.config.py
contains the code for managing the CLI configuration via environment variables.terralab
is the entrypoint for the CLI. It contains the main function that is called when the CLI is run.utils.py
contains utility functions that are used across the CLI.- The
commands
directory contains the CLI sub-modules. This is effectively the controller layer for the CLI. - The
logic
directory contains the business logic for the CLI, including calling Terra Scientific Pipelines Service APIs via the thinteaspoons_client
, which is autogenerated and published by the Terra Scientific Pipelines Service repository.
In the tests
directory, we have test files that can be run with pytest.
Using the CLI
For now, the CLI requires poetry to be installed to run. See the Development section for instructions on how to install poetry.
To run the CLI, navigate to the root (terra-scientific-pipelines-service-cli) directory and run the following command:
./terralab COMMAND [ARGS]
For example, to authenticate with Terralab (via Terra b2c), run the following command:
./terralab auth login
To list the pipelines you can run using Terralab, run the following command:
./terralab pipelines list
See WIP documentation for the CLI here.
Development
You'll need to have poetry installed to manage python dependencies. Instructions for installing poetry can be found here.
To install the CLI locally, run the following commands from the root project directory:
poetry lock # only needed if you updated dependencies in pyproject.toml
poetry install
You do not need to re-run these commands each time you update code locally, unless you've added dependencies in pyproject.toml.
If you do update dependencies in pyproject.toml
, run poetry lock
and check in the resulting changes to poetry.lock
along with the rest of
your code changes.
To run the tests, execute the following command from the root project (terra-scientific-pipelines-service-cli) directory:
poetry run pytest
To run tests with a coverage report printed to the terminal:
poetry run pytest --cov-report term --cov=terralab
To run the formatter, execute the following command from the root project directory:
poetry run black .
To run the linter with fixes, execute the following command from the root project directory:
poetry run ruff check --fix
To run the linter as a check without fixes, omit the --fix
flag.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for terralab_cli-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 876ec31dfd12c8f5a9130365fb7732dbe92c12a2279438b1eed09f6f223558cc |
|
MD5 | 0bab694f64b5bb5866f936227698ea97 |
|
BLAKE2b-256 | d0aa7b15113c9e7c0fad8a78564c7747d27e9360a2d46c64fbe0d6eefdefbd6b |