RunContext.cli_command assigns the short flag -y to both --yaml and --yes — click warns on every invocation
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 258
- Forks
- 113
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 5
Description
Summary
In RunContext.cli_command (nemo_run/cli/api.py, v0.9.0) two options claim the same short flag:
yaml: Optional[str] = typer.Option(None, "--yaml", "-y", help="Path to a YAML file to load"), # L894
skip_confirmation: bool = typer.Option(False, "--yes", "-y", "--no-confirm", help="Skip confirmation before execution"), # L899
so every invocation of any generated command prints:
UserWarning: The parameter -y is used more than once. Remove its duplicate as parameters should be unique.
(twice per parse: click/core.py make_parser and parse_args). Besides the noise, whichever option click resolves -y to wins silently — a user typing -y for "yes" may instead set yaml.
Minimal reproduction (nemo_run + typer only)
import warnings
import typer
from typer.testing import CliRunner
from nemo_run.cli.api import RunContext
def demo(x: int = 1) -> None:
pass
app = typer.Typer()
RunContext.cli_command(app, "demo", demo)
with warnings.catch_warnings(record=True) as caught:
warnings.simplefilter("always")
CliRunner().invoke(app, ["demo", "--help"])
print(len([w for w in caught if "-y" in str(w.message)])) # 4
Suggested fix
Drop -y from --yaml (the near-universal CLI convention reserves -y for yes/skip-confirmation), leaving --yaml long-form only.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open nemo_run/cli/api.py and inspect the RunContext.cli_command options around lines 894-899. Run the minimal reproduction from the issue; done means --yaml remains available, -y selects the yes/skip-confirmation option, and the duplicate-parameter warnings no longer appear.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100