hydromodpy.core.state.paths#

XDG-compliant path helpers and workspace path utilities.

Cache directory: binaries (solver downloads, http_cache). State directory: index.duckdb, locks, audit.log. Override env vars: HMP_CACHE_HOME, HMP_STATE_HOME, HMP_BIN.

Workspace layout constants and portable-path helpers also live here so every layer (catalog writes, global index, CLI) shares a single source of truth without depending on a higher layer.

Module attributes

CATALOG_FILENAME

Per-project catalog DuckDB file living at <project>/catalog.duckdb.

PROJECT_TOML_FILENAME

Per-project HydroModPy config file living at <project>/hydromodpy.toml.

WORKSPACE_TOML_FILENAME

Workspace-wide metadata file living at <workspace>/workspace.toml.

INDEX_FILENAME

Machine-wide global index file living under state_dir().

Functions

cache_dir()

Return platform cache dir (HMP_CACHE_HOME override).

decode_workspace_path(workspace, encoded)

Decode an encoded portable path back to an absolute Path.

encode_workspace_path(workspace, target)

Encode target as a portable string anchored at the workspace.

find_catalog_root(project_dir)

Walk up from project_dir to find a project-local catalog.

from_workspace_relative(workspace, rel)

Return the absolute path of a workspace-relative POSIX string.

is_under_workspace(workspace, target)

Return True when target resolves under workspace.

resolve_workspace(uri)

Resolve a portable workspace_uri to a local Path.

state_dir()

Return platform state dir (HMP_STATE_HOME override).

to_workspace_relative(workspace, target)

Return target expressed as a POSIX path relative to workspace.

to_workspace_uri(path)

Return the file:// URI for a local workspace path.