viat.vault
¶
A convenience module for vaults.
VIAT_SUBDIR = '.viat'
module-attribute
¶
The name of the default viat subdirectory.
ViatPathResolver
¶
The path resolver for the ViatVault.
Parameters:
-
root(Path) –The root path of the vault.
To find a vault root from a subdirectory, you can use the [
locate][.locate] factory method instead.
Raises:
-
ViatConfigError–If the vault is misconfigured.
Source code in src/viat/_vault/resolver.py
get_config(ext)
¶
get_root()
¶
get_viat()
¶
relativize(path)
¶
Relativize a path so that it can be used with an attribute storage.
Parameters:
Source code in src/viat/_vault/resolver.py
ViatVault
¶
The default provider that stores all configuration and data in a .viat subdirectory.
Parameters:
-
root(Path) –The root path of the vault.
To find a vault root from a subdirectory, you can use the helper [
locate_existing_vault_root][.locate_existing_vault_root]. -
static_config(ViatVaultStaticConfig | None, default:None) –Static configuration for the vault.
Raises:
-
ViatConfigError–If the vault is misconfigured.
Source code in src/viat/_vault/vault.py
resolver = ViatPathResolver(root)
instance-attribute
¶
A resolver for paths related to the vault.
static_config = static_config or ViatVaultStaticConfig()
instance-attribute
¶
The vault's static configuration.
storage = load_storage_from_config(self.resolver, self.static_config, config_loader)
instance-attribute
¶
The vault's storage.
tracker = load_tracker_from_config(self.resolver, self.static_config, config_loader)
instance-attribute
¶
The vault's tracker.
initialize(root, static_config=None)
staticmethod
¶
Initialize a new vault.
Parameters:
-
root(Path) –The root of the new vault.
-
static_config(ViatVaultStaticConfig | None, default:None) –Static configuration for the vault.
Returns:
-
ViatVault–A newly initialized vault
Raises:
-
ViatVaultError–If a vault already exists or if its creation fails.
Source code in src/viat/_vault/vault.py
ViatVaultStaticConfig
dataclass
¶
Static (i.e. known before initialization) configuration for the vault.
Source code in src/viat/_vault/config.py
skip_validation = False
class-attribute
instance-attribute
¶
Skip tracker and schema validation.
autoload_vault(static_config=None)
¶
Try to load a vault without any manual configuration.
Returns:
-
ViatVault–An initialized vault.
Raises:
-
ViatCliError–If the loading fails.
Source code in src/viat/_vault/vault.py
locate_existing_vault_root(base)
¶
Traverse the file system until a vault is found.
Parameters:
-
base(Path) –The path to start the search at.
Returns:
-
Path–A path to an existing vault.
Raises:
-
ViatVaultError–If no vault is found.
Source code in src/viat/_vault/vault.py
resolve_enforced_vault_path()
¶
Try to resolve the path enforced using the VIAT_DIR environment variable.
Returns:
-
Path | None–Either a resolved path or None if the environment variable is not set.
Raises:
-
ViatCliError–If the resolution fails.