SkilletLoader

class skilletlib.SkilletLoader(path=None)

SkilletLoader is used to find and load Skillets from their metadata files, either from the local filesystem or from a git repository URL

Parameters:path – local relative path to search for all Skillet meta-data files
compile_skillet_dict(skillet: dict) → dict

Compile the skillet dictionary including any included snippets from other skillets. Included snippets and variables will be inserted into the skillet dictionary and any replacements / updates to those snippets / variables will be made before hand.

Parameters:skillet – skillet definition dictionary
Returns:full compiled skillet definition dictionary
create_skillet(skillet_dict: dict) → skilletlib.skillet.base.Skillet

Creates a Skillet object from the given skillet definition

Parameters:skillet_dict – Dictionary loaded from the skillet.yaml definition file
Returns:Skillet Object
static debug_skillet_structure(skillet: dict) → list

Verifies the structure of a skillet and returns a list of errors or warning if found

Parameters:skillet – Skillet Definition Dictionary
Returns:list of errors or warnings if found
get_skillet_with_name(skillet_name: str, include_resolved_skillets=False) -> (<class 'skilletlib.skillet.base.Skillet'>, None)

Returns a single skillet from the loaded skillets list that has the matching ‘name’ attribute

Parameters:
  • skillet_name – Name of the skillet to return
  • include_resolved_skillets – boolean of whether to also check the resolved skillet list
Returns:

Skillet or None

load_all_label_values(label_name: str) → list

Returns a list of label values defined across all snippets with a given label for example:

labels:
label_name: label_value

will add ‘label_value’ to the list

Parameters:label_name – name of the label to search for
Returns:list of strings representing all found label values for given key
load_all_skillets_from_dir(directory: (<class 'str'>, <class 'pathlib.Path'>)) → List[skilletlib.skillet.base.Skillet]

Recursively iterate through all sub-directories and locate all found skillets Returns a list of Loaded Skillets

Parameters:directory – parent directory in which to start iterating
Returns:list of Skillet objects
load_from_git(repo_url, repo_name, repo_branch, local_dir=None) → List[skilletlib.skillet.base.Skillet]

Performs a local clone of the given Git repository URL and returns a list of all found skillets defined therein.

Parameters:
  • repo_url – Repository URL
  • repo_name – name given to the repository
  • repo_branch – branch to checkout
  • local_dir – local directory where to clone the git repository into
Returns:

List of Skillets

load_skillet(skillet_path: str) → skilletlib.skillet.base.Skillet

Returns a Skillet object from the given path

Parameters:skillet_path – full path to the skillet YAML file
Returns:Skillet object
load_skillet_dict_from_path(skillet_path: (<class 'str'>, <class 'pathlib.Path'>)) → dict

Loads the skillet metadata file into a skillet_dict dictionary

Parameters:skillet_path – path in which to look for a metadata file
Returns:skillet dictionary
load_skillet_dicts_from_git(repo_url, repo_name, repo_branch, local_dir=None) → List[dict]

Performs a local clone of the given Git repository URL and returns a list of all found skillet definition dictionaries defined therein.

Parameters:
  • repo_url – Repository URL
  • repo_name – name given to the repository
  • repo_branch – branch to checkout
  • local_dir – local directory where to clone the git repository into
Returns:

List of Skillets

load_skillet_from_path(skillet_path: (<class 'str'>, <class 'pathlib.Path'>)) → skilletlib.skillet.base.Skillet

Returns a Skillet object from the given path.

Parameters:skillet_path – path in which to search for a skillet
Returns:Skillet object of the correct type
load_skillets_from_git(repo_url, repo_name, repo_branch, local_dir=None) → List[skilletlib.skillet.base.Skillet]

Performs a local clone of the given Git repository URL and returns a list of all found skillets defined therein.

Parameters:
  • repo_url – Repository URL
  • repo_name – name given to the repository
  • repo_branch – branch to checkout
  • local_dir – local directory where to clone the git repository into
Returns:

List of Skillets

static normalize_skillet_dict(skillet: dict) → dict

Attempt to resolve common configuration file format errors

Parameters:skillet – a loaded skillet/snippet
Returns:skillet/snippet that has been ‘fixed’
resolved_skillets

alias of typing.List

skillets

alias of typing.List