idmtools_platform_comps.utils.package_version module

class idmtools_platform_comps.utils.package_version.PackageHTMLParser

Bases: html.parser.HTMLParser, abc.ABC

previous_tag = None
pkg_version = None
class idmtools_platform_comps.utils.package_version.LinkHTMLParser

Bases: idmtools_platform_comps.utils.package_version.PackageHTMLParser

handle_starttag(tag, attrs)
class idmtools_platform_comps.utils.package_version.LinkNameParser

Bases: idmtools_platform_comps.utils.package_version.PackageHTMLParser

ver_pattern = re.compile('^[\\d\\.brcdev\\+nightly]+$')
handle_starttag(tag, attrs)
handle_endtag(tag)
handle_data(data)
idmtools_platform_comps.utils.package_version.get_latest_package_version_from_pypi(pkg_name, display_all=False)

Utility to get the latest version for a given package name :param pkg_name: package name given :param display_all: determine if output all package releases

Returns: the latest version of ven package

idmtools_platform_comps.utils.package_version.get_latest_pypi_package_version_from_artifactory(pkg_name, display_all=False, base_version: str = None)

Utility to get the latest version for a given package name :param pkg_name: package name given :param display_all: determine if output all package releases :param base_version: Base version

Returns: the latest version of ven package

idmtools_platform_comps.utils.package_version.get_pypi_package_versions_from_artifactory(pkg_name, display_all=False, base_version: str = None, exclude_pre_release: bool = True)

Utility to get versions of a package in artifactory

Parameters
  • pkg_name – package name given

  • display_all – determine if output all package releases

  • base_version – Base version

  • exclude_pre_release – Exclude any prerelease versions

Returns: the latest version of ven package

idmtools_platform_comps.utils.package_version.get_latest_ssmt_image_version_from_artifactory(pkg_name='comps_ssmt_worker', base_version: Optional[str] = None, display_all=False)

Utility to get the latest version for a given package name :param pkg_name: package name given :param base_version: Optional base version. Versions above this will not be added. :param display_all: determine if output all package releases

Returns: the latest version of ven package

idmtools_platform_comps.utils.package_version.get_docker_manifest(image_path='idmtools/comps_ssmt_worker', repo_base='https://packages.idmod.org/artifactory/list/docker-production')

Get docker manifest from IDM Artifactory. It mimics latest even when user has no latest tag degined

Parameters
  • image_path

  • repo_base

Returns:

idmtools_platform_comps.utils.package_version.get_digest_from_docker_hub(repo, tag='latest')

repo: string, repository (e.g. ‘library/fedora’) tag: string, tag of the repository (e.g. ‘latest’)

idmtools_platform_comps.utils.package_version.fetch_versions_from_server(pkg_url: str, parser: Type[idmtools_platform_comps.utils.package_version.PackageHTMLParser] = <class 'idmtools_platform_comps.utils.package_version.LinkHTMLParser'>) → List[str]

Fetch all versions from server

Parameters
  • pkg_url – Url to fetch

  • parser – Parser tp use

Returns:

idmtools_platform_comps.utils.package_version.get_versions_from_site(pkg_url, base_version: Optional[str] = None, display_all=False, parser: Type[idmtools_platform_comps.utils.package_version.PackageHTMLParser] = <class 'idmtools_platform_comps.utils.package_version.LinkNameParser'>, exclude_pre_release: bool = True)

Utility to get the the available versions for a package. The default properties filter out pre releases. You can also include a base version to only list items starting with a particular version

Parameters
  • pkg_url – package name given

  • base_version – Optional base version. Versions above this will not be added. For example, to get versions 1.18.5, 1.18.4, 1.18.3, 1.18.2 pass 1.18

  • display_all – determine if output all package releases

  • parser – Parser needs to be a HTMLParser that returns a pkg_versions

  • exclude_pre_release – Exclude prerelease versions

Returns: the latest version of ven package

idmtools_platform_comps.utils.package_version.get_latest_version_from_site(pkg_url, base_version: Optional[str] = None, display_all=False, parser: Type[idmtools_platform_comps.utils.package_version.PackageHTMLParser] = <class 'idmtools_platform_comps.utils.package_version.LinkNameParser'>, exclude_pre_release: bool = True)

Utility to get the latest version for a given package name

Parameters
  • pkg_url – package name given

  • base_version – Optional base version. Versions above this will not be added.

  • display_all – determine if output all package releases

  • parser – Parser needs to be a HTMLParser that returns a pkg_versions

  • exclude_pre_release – Exclude pre-release versions

Returns: the latest version of ven package