queenbee.repository.index module¶
- class queenbee.repository.index.RepositoryIndex(*, type: ~queenbee.repository.index.ConstrainedStrValue = 'RepositoryIndex', annotations: ~typing.Dict[str, ~typing.Any] = None, api_version: ~queenbee.repository.index.ConstrainedStrValue = 'v1beta1', generated: ~datetime.datetime = None, metadata: ~queenbee.repository.index.RepositoryMetadata = type: RepositoryMetadata annotations: {} name: null description: A Queenbee package repository source: null plugin_count: 0 recipe_count: 0, plugin: ~typing.Dict[str, ~typing.List[~queenbee.repository.package.PackageVersion]] = {}, recipe: ~typing.Dict[str, ~typing.List[~queenbee.repository.package.PackageVersion]] = {})[source]¶
Bases:
BaseModel
A searchable index for a Queenbee Plugin and Recipe repository
- static add_slugs(root: str, packages: Dict[str, List[PackageVersion]])[source]¶
Add slugs to the packages based on the provided root
- Parameters:
root (str) – a slug root string
packages (Dict[str, List[PackageVersion]]) – The list of packages to update with slugs
- api_version: ConstrainedStrValue¶
- classmethod from_folder(folder_path)[source]¶
Generate a Repository Index from a folder
This will scrape the folder for plugin and recipe packages and add their version information to the index.
- Parameters:
folder (folder_path {str} -- Path to a repository) –
- Returns:
RepositoryIndex – An index generated from packages in the folder
- generated: datetime¶
- static get_latest(package_versions: List[PackageVersion]) PackageVersion [source]¶
Get the most recent package from the given list
- Parameters:
package_versions (List[PackageVersion]) – A list of Queenbee packages
- Returns:
The most recent Queenbee package in the list
- Return type:
- index_plugin_version(plugin_version: PackageVersion, overwrite: bool = False)[source]¶
Add a Plugin Version to an Index of Plugins
- Parameters:
object (plugin_version {PackageVersion} -- A plugin version) –
- Keyword Arguments:
in (overwrite {bool} -- Overwrite the Plugin Version if it already exists) – the index (default: {False})
- index_recipe_version(recipe_version: PackageVersion, overwrite: bool = False)[source]¶
Add a Recipe Version to an Index of Recipes
- Parameters:
object (recipe_version {PackageVersion} -- A recipe version) –
- Keyword Arguments:
the (overwrite {bool} -- Overwrite the Recipe Version if it already exists in) – index (default: {False})
- classmethod index_resource(index_folder: str, resource: Union[Plugin, Recipe], readme: Optional[str] = None, license: Optional[str] = None, overwrite: bool = False)[source]¶
Package a plugin or Workflow and add it to an existing index.json file
- Parameters:
located (index_folder {str} -- The folder where the repository index is) –
{Union[Plugin (resource) –
package (Recipe]} -- The Plugin or Recipe to) –
- Keyword Arguments:
exists (license {str} -- Text of the resource LICENSE file if it) – (default: {None})
exists – (default: {None})
or (overwrite {bool} -- Indicate whether overwriting an existing package) – index entry is allowed (default: {False})
- Raises:
ValueError – Error raised if the package already exists in the index file or directory
- json(*args, **kwargs)[source]¶
Overwrite the BaseModel json method to exclude certain keys
The objective is to remove the readme, license and manifest keys which are not needed in a serialized index object.
- merge_folder(folder_path, overwrite: bool = False, skip: bool = False)[source]¶
Merge the contents of a repository folder with the index
- Parameters:
folder (folder_path {str} -- The path to the repository) –
- Keyword Arguments:
(default (skip {bool} -- Skip any errors if version already exist) – {False})
(default – {False})
- Raises:
ValueError – Resource version already exists or is invalid
- metadata: RepositoryMetadata¶
- package_by_digest(kind: str, package_name: str, package_digest: str) PackageVersion [source]¶
Retrieve a Resource Version by its hash digest
- Parameters:
package (package_name {str} -- The name of the) –
package –
digest (package_digest {str} -- The package) –
- Raises:
ValueError – The package was not found
- Returns:
PackageVersion – A resource version object
- package_by_tag(kind: str, package_name: str, package_tag: str) PackageVersion [source]¶
Retrieve a Resource Version by its tag
If the tag is set to “latest” then the most recent version of the package will be retrieved.
- Parameters:
package (package_name {str} -- The name of the) –
package –
tag (package_tag {str} -- The package) –
- Raises:
ValueError – The package was not found
- Returns:
PackageVersion – A resource version object
- plugin: Dict[str, List[PackageVersion]]¶
- recipe: Dict[str, List[PackageVersion]]¶
- search(kind: Optional[str] = None, search_string: Optional[str] = None) List[PackageVersion] [source]¶
Search for a package inside of a repository using a search string
- Parameters:
kind (str, optional) – The type of package to search for (ie: plugin or recipe). Defaults to None.
search_string (str, optional) – The search string to use. Defaults to None.
- Returns:
A list of packages (the latest from each list)
- Return type:
List[PackageVersion]
- type: ConstrainedStrValue¶
- class queenbee.repository.index.RepositoryMetadata(*, type: ConstrainedStrValue = 'RepositoryMetadata', annotations: Dict[str, Any] = None, name: str = None, description: str = 'A Queenbee package repository', source: str = None, plugin_count: int = 0, recipe_count: int = 0)[source]¶
Bases:
BaseModel
- description: str¶
- name: str¶
- plugin_count: int¶
- recipe_count: int¶
- source: str¶
- type: ConstrainedStrValue¶