Skip to content

Paths

paths

Resolution of the local store's directory, [STORE_DIRNAME][dstrack.paths.STORE_DIRNAME].

Mirrors how git resolves .git/: absent an explicit override, it is found by walking up from the current directory until a STORE_DIRNAME/ directory turns up.

Functions:

Name Description
resolve_store_root

Resolve the path to the local store, [STORE_DIRNAME][dstrack.paths.STORE_DIRNAME].

resolve_store_root(root=None)

Resolve the path to the local store, [STORE_DIRNAME][dstrack.paths.STORE_DIRNAME].

Checked in order, the first one available wins: 1. root, e.g. forwarded from a CLI --root option: the directory STORE_DIRNAME/ lives (or will be created) in. 2. The DSTRACK_ROOT_PATH environment variable: same meaning as root. 3. Walking upwards from the current working directory until a STORE_DIRNAME/ directory is found, the same way git resolves .git/.

Parameters:

Name Type Description Default
root Path | str | None

Explicit parent directory of STORE_DIRNAME/, typically supplied by a CLI --root option. Taken as-is, without checking that STORE_DIRNAME/ actually exists inside it.

None

Returns:

Type Description
Path

The path to the STORE_DIRNAME/ directory itself, as an absolute path.

Raises:

Type Description
StoreNotFoundError

root is None, DSTRACK_ROOT_PATH is unset, and no STORE_DIRNAME/ directory is found by walking up from the current directory.