cyclonedx_py.utils.conda

Module Contents

Classes

CondaPackage

Internal package for unifying Conda package definitions to.

Functions

conda_package_to_purl(→ packageurl.PackageURL)

Return the purl for the specified package.

_conda_package_to_pypi_purl(→ packageurl.PackageURL)

Return the purl for a pip-installed package in a conda environment.

parse_conda_json_to_conda_package(→ Optional[CondaPackage])

parse_conda_list_str_to_conda_package(...)

Helper method for parsing a line of output from conda list --explicit into our internal CondaPackage object.

split_package_string(→ Tuple[str, str, str, str])

Helper method for parsing package_name_version_build_string.

split_package_build_string(→ Tuple[str, Optional[int]])

Helper method for parsing build_string.

class cyclonedx_py.utils.conda.CondaPackage[source]

Bases: TypedDict

Internal package for unifying Conda package definitions to.

base_url: str[source]
build_number: int | None[source]
build_string: str[source]
channel: str[source]
dist_name: str[source]
name: str[source]
platform: str[source]
version: str[source]
package_format: str | None[source]
md5_hash: str | None[source]
cyclonedx_py.utils.conda.conda_package_to_purl(pkg: CondaPackage) packageurl.PackageURL[source]

Return the purl for the specified package. See https://github.com/package-url/purl-spec/blob/master/PURL-TYPES.rst#conda

cyclonedx_py.utils.conda._conda_package_to_pypi_purl(pkg: CondaPackage) packageurl.PackageURL[source]

Return the purl for a pip-installed package in a conda environment. These packages are listed as if from the pseudo-channel “pypi”. See https://github.com/package-url/purl-spec/blob/master/PURL-TYPES.rst#pypi

cyclonedx_py.utils.conda.parse_conda_json_to_conda_package(conda_json_str: str) CondaPackage | None[source]
cyclonedx_py.utils.conda.parse_conda_list_str_to_conda_package(conda_list_str: str) CondaPackage | None[source]

Helper method for parsing a line of output from conda list –explicit into our internal CondaPackage object.

Params:
conda_list_str:

Line of output from conda list –explicit

Returns:

Instance of CondaPackage else None.

cyclonedx_py.utils.conda.split_package_string(package_name_version_build_string: str) Tuple[str, str, str, str][source]

Helper method for parsing package_name_version_build_string.

Returns:

Tuple (package_name, build_version, build_string)

cyclonedx_py.utils.conda.split_package_build_string(build_string: str) Tuple[str, int | None][source]

Helper method for parsing build_string.

Returns:

Tuple (build_string, build_number)