thamos package

Subpackages

Submodules

thamos.cli module

Command line interface Thamos for interaction with Thoth.

thamos.cli.handle_cli_exception(func: Callable) → Callable[source]

Suppress exception in CLI if debug mode was not turned on.

thamos.config module

CLI and library configuration.

thamos.discover module

Implementation discovery methods to detect the current environment and its configuration.

thamos.discover.discover_cpu() → Dict[str, Union[str, int, None]][source]

Discover CPU model, model name and family.

thamos.discover.discover_cuda_version(interactive: bool = False) → Optional[str][source]

Check for CUDA version, if no CUDA is installed, return None.

thamos.discover.discover_distribution() → tuple[source]

Get distribution identifier and distribution version.

thamos.discover.discover_platform() → str[source]

Discover platform used.

thamos.discover.discover_python_version() → str[source]

Discover Python version in which we run in.

thamos.exceptions module

Exception hierarchy in Thamos.

exception thamos.exceptions.ConfigurationError[source]

Bases: thamos.exceptions.ThamosException

An exception raised if there are issues with configuration file.

exception thamos.exceptions.InternalError[source]

Bases: thamos.exceptions.ThamosException

An exception raised on internal programming errors.

exception thamos.exceptions.NoApiSupported[source]

Bases: thamos.exceptions.ThamosException

Raised if client and Thoth server does not support same API versions.

exception thamos.exceptions.NoProjectDirError[source]

Bases: thamos.exceptions.ThamosException

An exception raised if the project directory cannot be found.

exception thamos.exceptions.NoRequirementsFormatError[source]

Bases: thamos.exceptions.ThamosException

An exception raised if no requirements format could be found in configuration file.

exception thamos.exceptions.NoRuntimeEnvironmentError[source]

Bases: thamos.exceptions.ThamosException

An exception raised if no runtime environment could be found in configuration file.

exception thamos.exceptions.ServiceUnavailable[source]

Bases: thamos.exceptions.ThamosException

Raised if Thoth service is not available.

exception thamos.exceptions.ThamosException[source]

Bases: Exception

A base class for exceptions in Thamos.

exception thamos.exceptions.TimeoutError[source]

Bases: thamos.exceptions.ThamosException

An exception raised if the API takes longer than timeout limit.

exception thamos.exceptions.UnknownAnalysisType[source]

Bases: thamos.exceptions.ThamosException

Raised analysis type (adviser, package-extract, …) cannot be determined from analysis identifier.

thamos.lib module

Core parts of library for interacting with Thoth.

thamos.lib.advise(api_client: thamos.swagger_client.api_client.ApiClient, pipfile: str, pipfile_lock: str, recommendation_type: str = None, *, runtime_environment: dict = None, runtime_environment_name: str = None, dev: bool = False, no_static_analysis: bool = False, nowait: bool = False, force: bool = False, limit: int = None, count: int = 1, debug: bool = False, origin: str = None, github_event_type: Optional[str] = None, github_check_run_id: Optional[int] = None, github_installation_id: Optional[int] = None, github_base_repo_url: Optional[str] = None, source_type: Optional[thoth.common.enums.ThothAdviserIntegrationEnum] = None) → Optional[tuple][source]

Submit a stack for adviser checks and wait for results.

thamos.lib.advise_here(recommendation_type: Optional[str] = None, *, runtime_environment: dict = None, runtime_environment_name: Optional[str] = None, dev: bool = False, no_static_analysis: bool = False, nowait: bool = False, force: bool = False, limit: Optional[int] = None, count: int = 1, debug: bool = False, origin: Optional[str] = None, github_event_type: Optional[str] = None, github_check_run_id: Optional[int] = None, github_installation_id: Optional[int] = None, github_base_repo_url: Optional[str] = None, source_type: Optional[thoth.common.enums.ThothAdviserIntegrationEnum] = None) → Optional[tuple][source]

Run advise in current directory, requires no arguments.

thamos.lib.build_analysis(api_client: thamos.swagger_client.api_client.ApiClient, build_log: dict, base_image: str, output_image: str, *, environment_type: str, registry_user: str = None, registry_password: str = None, registry_verify_tls: bool = True, nowait: bool = False, force: bool = False, debug: bool = False) → Union[Dict, str][source]

Submit a build image and logs for analysis to Thoth.

thamos.lib.get_analysis_results(api_client: thamos.swagger_client.api_client.ApiClient, analysis_id: str)[source]

Get the analysis result from a given id.

thamos.lib.get_log(api_client: thamos.swagger_client.api_client.ApiClient, analysis_id: str = None)[source]

Get log of an analysis - the analysis type and endpoint are automatically derived from analysis id.

If analysis_id is not provided, its get from the last thamos call which stores it in a temporary file.

thamos.lib.get_status(api_client: thamos.swagger_client.api_client.ApiClient, analysis_id: str = None)[source]

Get status of an analysis - the analysis type and endpoint are automatically derived from analysis id.

If analysis_id is not provided, its get from the last thamos call which stores it in a temporary file.

thamos.lib.image_analysis(api_client: thamos.swagger_client.api_client.ApiClient, image: str, *, environment_type: str, registry_user: str = None, registry_password: str = None, verify_tls: bool = True, nowait: bool = False, force: bool = False, debug: bool = False) → Union[Dict, str, None][source]

Submit an image for analysis to Thoth.

thamos.lib.provenance_check(api_client: thamos.swagger_client.api_client.ApiClient, pipfile: str, pipfile_lock: str, *, nowait: bool = False, force: bool = False, debug: bool = False, origin: str = None) → Optional[tuple][source]

Submit a stack for provenance checks and wait for results.

thamos.lib.provenance_check_here(*, nowait: bool = False, force: bool = False, debug: bool = False, origin: str = None) → Optional[tuple][source]

Submit a provenance check in current directory.

thamos.lib.with_api_client(func: Callable)[source]

Load configuration entries from Thoth configuration file.

thamos.utils module

Utility and helper functions for Thamos.

thamos.utils.cwd(target)[source]

Manage cwd in a pushd/popd fashion.

thamos.utils.workdir(file_lookup: str = None)[source]

Find project directory and cd into it.

Module contents

A CLI tool and library for interacting with Thoth.