HydrologicEngineeringCenter / HydrologicEngineeringCenter/cwms-cli

Add y/n option to missing libraries

Open
#89 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement question
Dominant language
Python
Stars
2
Forks
4
Avg merge
19h 59m
Merged PRs (30d)
3

Description

CLI Script

cwms-cli

Feature Proposal

If a user does not have a required library, you will see this due to the @requires decorator.

cwms-cli blob list 
Error: Missing module(s):
- `cwms` (install: `cwms-python`) — CWMS REST API Python client [docs](https://github.com/HydrologicEngineeringCenter/cwms-python)

Install missing packages:
    pip install cwms-python

Should the CLI prompt the user y/n to auto install the library?

I.e. something like

Would you like to install missing packages?
    pip install cwms-python

> [Y]es/[N]o: N

Bonus, we can use sys.executable to install it so that it will also respect the current python env.

Thinking we can build this into the @requires decorator

Care: If a headless job runs (CWMS Batch) we do not want any prompts to hang the job. They should instead throw the normal error. We want to make sure interactive prompts are reserved for human sessions.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the @requires decorator used by cwms-cli and trace how missing libraries currently produce the error. Check how the CLI distinguishes interactive human sessions from headless CWMS Batch jobs, and review sys.executable for installation behavior. Done means interactive users can accept or decline installation while headless jobs retain the normal error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.