API reference

API reference#

dso.here(rel_path=None)#

Get project root as a Path object

Parameters:

rel_path (str | Path | None (default: None)) – Relative path to be appended to the project root

Return type:

Path

dso.read_params(stage)#

Set stage dir and load parameters from the stage’s params.yaml

It is required to provide the path of the current stage relative to the project root to ensure that the correct config is loaded, no matter of the current working directory (as long as the working directory is any subdirectory of the project root). The function recompiles params.in.yaml to params.yaml on-the-fly to ensure that up-to-date params are always loaded.

Only parameters that are declared as params, dep, or output in dvc.yaml are loaded to ensure that one does not forget to keep the dvc.yaml updated.

Calls set_stage() internally.

Parameters:

stage (str | Path) – Path to stage, relative to the project root

Return type:

dict

dso.set_stage(stage)#

Set the active stage for stage_here()

This sets the stage dir in dso.CONFIG.

Parameters:

stage (str | Path) – Path to stage, relative to the project root

Return type:

None

dso.stage_here(rel_path=None)#

Get the absolute path to the current stage

The current stage is stored in dso.CONFIG and can be set using dso.set_stage() or dso.read_params().

Parameters:

rel_path (str | Path | None (default: None)) – Relative path to be appended to the stage root

Return type:

Path