hmp.example()#

example(
name=None,
*,
add=False,
workspace=None,
ref=None,
force=False,
)[source]#

List the examples this build ships, show some, or install one, several or all.

Parameters:
  • name (str | Sequence[str] | None) – The example id, or a list of ids. Without it, every example.

  • add (bool) – Install the examples: fetch what is missing from the content-addressed cache, check every file against its sha256, and write the configs under projects/<directory>/ and the data under data/<variable>/.

  • workspace (PathLike | None) – Workspace root an example is installed in. Defaults to ~/hydromodpy.

  • ref (str | None) – Git ref to fetch from. Defaults to v plus the installed version.

  • force (bool) – Overwrite a file whose content differs from the manifest.

Returns:

tuple of ExampleEntry or ExampleEntry or InstallReport or tuple of InstallReport – One value for one id given as text, a tuple for a list of ids or for none.

Return type:

tuple[ExampleEntry, …] | ExampleEntry | InstallReport | tuple[InstallReport, …]

Examples

>>> import hydromodpy as hmp
>>> [entry.id for entry in hmp.example()]
>>> hmp.example("04", add=True).project_dir
>>> hmp.example(["00", "07"], add=True)