1 run_ribasim

run_ribasim(toml_path=None, *, cli_path=None, version=False, threads=None)

Run the Ribasim CLI executable.

1.1 Parameters

Name Type Description Default
toml_path str | Path | None Path to the TOML file. Required unless version=True. None
cli_path str | Path | None Path to the Ribasim CLI executable. If not provided, searches PATH. None
version bool Print version False
threads int | None Number of threads to use. If not specified, defaults to the JULIA_NUM_THREADS environment variable, and when unset, to using the physical CPU count. None

1.2 Raises

Name Type Description
FileNotFoundError If the Ribasim CLI is not found on PATH (when cli_path is not provided), or the toml_path does not exist.
ValueError If neither toml_path nor version is provided.
subprocess.CalledProcessError If the Ribasim CLI returns a non-zero exit code.

1.3 Examples

>>> run_ribasim("model.toml")
>>> run_ribasim("model.toml", threads=4)
>>> run_ribasim("model.toml", cli_path="/path/to/ribasim")
>>> run_ribasim(version=True)