cli#
hydromodpy.cli is the top-level dispatcher for the hmp and
hydromodpy console entry points. One verb per module under
cli/commands/, registered through ALL_COMMANDS in
cli/commands/__init__.py.
Sub-modules#
cli/main.py– argparse dispatcher; iteratesALL_COMMANDSand forwards the parsed namespace toargs._handler.cli/commands/– one module per leaf verb, one sub-package per verb family (see inventory below).cli/_conventions.py– the shared argparse grammar (workspace_parser,confirm_parser,format_parser,profile_parser,add_sim_ref,add_action_subparsers).cli/helpers.py– typed exit codes andexit_code_for(exc).cli/_workers/– CLI application services for commands whose reusable Python surface is not part ofhydromodpy._api. Workers may assemble diagnostics, catalog listings and developer reports, but they must not become hidden scientific workflow implementations.
The [workflow].mode dispatch does not live here: hmp run calls
hydromodpy._api.run, which reaches
hydromodpy/project/dispatch/workflow.py.
Verb inventory#
Seventeen top-level verbs ship today, in ALL_COMMANDS order.
Verb |
Role |
|---|---|
|
Workspace lifecycle and global-index registration: |
|
Projects inside a workspace: |
|
The run lifecycle: |
|
Input cache and |
|
Figures: |
|
|
|
Developer-only: |
|
|
|
|
|
Execute a workflow ( |
|
Run a calibration workflow from a TOML config. |
|
Cyclic spin-up until heads and lake stage converge. |
|
|
|
Run the |
|
|
|
Diagnose Python, dependencies, solver binaries, workspace. |
|
Download the MODFLOW / MODPATH / MT3D-USGS binaries. |
Verb contract#
Each leaf module under cli/commands/ exposes:
The dispatcher iterates ALL_COMMANDS, calls register on
each, then forwards the parsed namespace to args._handler.
A verb family (workspace/, project/, catalog/, data/,
viz/, dev/) is a sub-package: its __init__.py carries
NAME, HELP and an ACTIONS tuple, and every action module
repeats the same four symbols. The group is attached with
add_action_subparsers, so a bare hmp catalog is a usage error
and exits 2.
For V1, the CLI boundary is:
cli/commands/*.pyparse arguments, callhydromodpy._apior a named CLI worker, format output and map errors to exit codes.cli/_workers/*.pyis an application layer for CLI-only features such as catalog browsing, audit display and developer diagnostics.Reusable user-facing workflows should live in
hydromodpy._apior in their domain package, then be called by the command module.
Recommended reading path#
hydromodpy/cli/main.pyfor the dispatch loop.hydromodpy/cli/commands/__init__.pyto see the registered tupleALL_COMMANDS.hydromodpy/cli/commands/run.pyfor the canonical workflow verb.hydromodpy/project/dispatch/workflow.pyfor the[workflow].mode-> launcher dispatch.One small verb such as
cli/commands/catalog/point.pyto see the thin-handler convention: parse, call a worker, format, map errors to exit codes.
Layer-matrix neighbours#
Allowed targets:
<root>, every stable production layer,catalog,projectandcli.validity_frameis not part of the stable CLI target set.Allowed sources: none;
cliis a leaf consumer.
See also#
CLI reference – user-facing CLI inventory with every flag.
Add a CLI Command – step-by-step recipe.
CLI quickstart – first-run path.