CLI for Basic Workflows

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

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
python, yaml
Domain
cli

Research direction

Start by reading the existing Python workflow scripts and the H2IntegrateModel entry points, then check how project configurations such as run.yaml are loaded and how the examples invoke workflows. The issue proposes a CLI for running workflows from a project path, with optional standardized post-processing and additional pathways, but does not identify specific files or tests. Done means the proposed workflows can be invoked through a CLI; the command interface and scope still need to be agreed.

Written by the indexing model from the issue text.

Description

enhancement for 1.0 framework Tools/Utilities

Create a CLI for standardized workflows

Because many of the examples are simply an exposition of running a series of configurations, we should simplify this process by creating a command line interface (CLI) to complete these 4 line workflows. If ambitious, the CLI should also incorporate standardized post-processing routines as well.

Proposed solution

Assuming a project folder with a run.yaml referencing any other required configurations, users should be able to run h2i run /relative/path/to/project run.yaml.

If multiple run pathways are desired, the run command could take additional modifiers such as --standard, --pathway1, etc. similar to pre-commit run --all-files. Here I imagine --standard (or similar) as the default pathway.

Once run, I also think the working directory should be temporarily changed to the provided relevant path to maintain continuity with how the current Python scripts work but with the convenience of not needing to change paths in the terminal itself.

Additional modeling pathways could be also be developed for any pre- or post-processing workflows such as h2i plot --pathway1 arg1 arg2.

Alternatives considered

Continue to write files with the standard workflow:

# run.py inside project folder
from h2integrate import H2IntegrateModel
h2i = H2IntegrateModel("primary_config.yaml")
h2i.run()
h2i.post_process()

Additional context

Previously I've used Typer, which is built on Click, but after using Typer more extensively, I think Click itself or Typer is better suited. Click requires a bit more upfront work, so Cyclopts would be an easier build out than either Typer or Click. The standard library argparse is another option, but is tedious when developing more robust interfaces.

Click: https://click.palletsprojects.com/en/stable/
Cyclopts: https://cyclopts.readthedocs.io/en/stable/index.html

Dominant language
Python
Stars
30
Forks
44
Avg merge
3d 12h
Merged PRs (30d)
28

Getting set up

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.

More from NatLabRockies/H2Integrate

All issues in NatLabRockies/H2Integrate

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.