cascade.workspaces#

Workspace is a container for Repos

class cascade.workspaces.Workspace(path: str, meta_fmt: Literal['.json', '.yml', '.yaml'] = '.json', default_repo: Optional[str] = None, *args: Any, **kwargs: Any)[source]#

The topmost container in Cascade, a collection of Repos

__init__(path: str, meta_fmt: Literal['.json', '.yml', '.yaml'] = '.json', default_repo: Optional[str] = None, *args: Any, **kwargs: Any) → None[source]#
Parameters:
  • description – String description of an object

  • tags (Iterable[str], optional) – The list of tags to be added

add_repo(name: str, *args: Any, **kwargs: Any) → Repo[source]#

Creates and adds repo to the Workspace

Parameters:

name (str) – Name of the repo

Returns:

Created repo

Return type:

Repo

get_default() → Repo[source]#

Workspaces feature the default repo and return it using this method

Returns:

Default repo

Return type:

Repo

Raises:

RuntimeError – When trying to use this method on an empty Workspace

get_meta() → List[Dict[Any, Any]][source]#

Being on disk adds updated_at field to the Meta

Return type:

Meta

get_repo_names() → List[str][source]#
load_obj_meta(model: str) → List[Dict[Any, Any]][source]#

Loads metadata of a model from disk

Parameters:

model (str) – model slug e.g. fair_squid_of_bliss

Returns:

Model metadata

Return type:

Meta

Raises:

FileNotFoundError – Raises if failed to find the model with slug specified

reload() → None[source]#
set_default(repo: str) → None[source]#

Set Repo as default using the name

Parameters:

repo (str) – Name of the Repo, it should exist

Raises:

KeyError – If the provided repo does not exist