queenbee.repository.package module

class queenbee.repository.package.PackageVersion(*, type: ConstrainedStrValue = 'PackageVersion', annotations: Dict[str, Any] = None, name: str, tag: str, app_version: str = None, keywords: List[str] = None, maintainers: List[Maintainer] = None, home: str = None, sources: List[str] = None, icon: str = None, deprecated: bool = None, description: str = None, license: License = None, url: str, created: datetime, digest: str, slug: str = None, kind: str = '', readme: str = None, manifest: Union[Recipe, Plugin] = None)[source]

Bases: MetaData

Package Version

A MetaData object to distinguish a specific package version within a repository index.

created: datetime
digest: str
fetch_package(source_url: Optional[str] = None, verify_digest: bool = True, auth_header: Dict[str, str] = {}) PackageVersion[source]
classmethod from_package(package_path: str)[source]

Generate a package version from a packaged resource

Parameters:

package (package_path {str} -- Path to the) –

Returns:

PackageVersion – A package version object

classmethod from_resource(resource: Union[Plugin, Recipe], created: Optional[datetime] = None, include_manifest: bool = False)[source]

Generate a Package Version from a resource

Parameters:
  • {Union[Plugin (resource) – or recipe)

  • (plugin (Recipe]} -- A resource to be versioned) – or recipe)

Keyword Arguments:

(default (created {datetime} -- When version was generated) – {None})

Raises:

ValueError – The resource is invalid

Returns:

PackageVersion – A package version object

kind: str
manifest: Union[Recipe, Plugin]
classmethod pack_tar(resource: Union[Plugin, Recipe], readme: Optional[str] = None, include_manifest: bool = False) Tuple[PackageVersion, BytesIO][source]

Package a resource into a gzipped tar archive

Parameters:
  • {Union[Plugin (resource) – recipe)

  • or (Recipe]} -- A resource to be packaged (plugin) – recipe)

Keyword Arguments:

exists (readme {str} -- resource README.md file text if it) – (default: {None})

Raises:

ValueError – Failed to create the package

Returns:

PackageVersion – A package version object BytesIO – A BytesIO stream of the gzipped tar file

classmethod package_folder(resource_type: str, folder_path: str, check_deps: bool = True) Tuple[PackageVersion, BytesIO][source]

Package a plugin or Recipe from its folder into a gzipped tar file

Parameters:

defined (folder_path {str} -- Path to the folder where the Plugin or Recipe is) –

Keyword Arguments:

validate (check_deps {bool} -- Fetch the dependencies from their source and) – the recipe by baking it (default: {True})

Returns:

PackageVersion – A recipe or plugin version object BytesIO – A BytesIO stream of the gzipped tar file

classmethod package_resource(resource: Union[Plugin, Recipe], check_deps: bool = True, readme: Optional[str] = None) Tuple[PackageVersion, BytesIO][source]

Package a Recipe or Plugin into a gzipped tar file

Parameters:
  • {Union[Plugin (resource) –

  • recipe (Recipe]} -- A plugin or) –

Keyword Arguments:

exists (readme {str} -- resource README.md file text if it) – (default: {None})

Returns:

PackageVersion – A plugin or recipe version object BytesIO – A BytesIO stream of the gzipped tar file

static read_readme(folder_path: str) str[source]

Infer the path to the readme within a folder and read it

Parameters:

found (folder_path {str} -- Path to the folder where a readme should be) –

Returns:

str – The found Readme text (or None if no readme is found)

readme: str
search_match(search_string: Optional[str] = None) bool[source]

Return a boolean indicating whether the search string matches the given package

If no search string is specified this function will return True.

Parameters:

search_string (str, optional) – The search string to use. Defaults to None.

Returns:

Whether the search string matches the package or not

Return type:

bool

slug: str
type: ConstrainedStrValue
classmethod unpack_tar(tar_file: BytesIO, verify_digest: bool = True, digest: Optional[str] = None) PackageVersion[source]
url: str
queenbee.repository.package.add_to_tar(tar: TarFile, data: bytes, filename: str)[source]
queenbee.repository.package.reset_tar(tarinfo: TarInfo) TarInfo[source]