thamos package¶
Subpackages¶
- thamos.swagger_client package
- Subpackages
- thamos.swagger_client.models package
- Submodules
- thamos.swagger_client.models.advise_input module
- thamos.swagger_client.models.advise_input_library_usage module
- thamos.swagger_client.models.adviser_result_response module
- thamos.swagger_client.models.adviser_result_response_metadata module
- thamos.swagger_client.models.adviser_result_response_metadata_distribution module
- thamos.swagger_client.models.adviser_result_response_metadata_distribution_version_parts module
- thamos.swagger_client.models.adviser_result_response_metadata_python module
- thamos.swagger_client.models.adviser_result_response_result module
- thamos.swagger_client.models.adviser_result_response_result_report module
- thamos.swagger_client.models.adviser_result_response_result_report_dependency_graph module
- thamos.swagger_client.models.adviser_result_response_result_report_pipeline module
- thamos.swagger_client.models.adviser_result_response_result_report_products module
- thamos.swagger_client.models.analysis_log_response module
- thamos.swagger_client.models.analysis_response module
- thamos.swagger_client.models.analysis_response_error module
- thamos.swagger_client.models.analysis_result_response module
- thamos.swagger_client.models.analysis_result_response_metadata module
- thamos.swagger_client.models.analysis_result_response_result module
- thamos.swagger_client.models.analysis_result_response_result_aicoeci module
- thamos.swagger_client.models.analysis_result_response_result_deb module
- thamos.swagger_client.models.analysis_result_response_result_debdependencies module
- thamos.swagger_client.models.analysis_result_response_result_pythonfiles module
- thamos.swagger_client.models.analysis_result_response_result_pythoninterpreters module
- thamos.swagger_client.models.analysis_result_response_result_pythonpackages module
- thamos.swagger_client.models.analysis_status_response module
- thamos.swagger_client.models.analysis_status_response_status module
- thamos.swagger_client.models.analysis_unauthorized_error module
- thamos.swagger_client.models.analysis_with_authentication_response module
- thamos.swagger_client.models.build module
- thamos.swagger_client.models.build_analysis_response module
- thamos.swagger_client.models.build_analysis_response_base_image_analysis module
- thamos.swagger_client.models.build_analysis_response_buildlog_analysis module
- thamos.swagger_client.models.build_analysis_response_error module
- thamos.swagger_client.models.build_analysis_response_error_base_image_analysis module
- thamos.swagger_client.models.build_analysis_response_error_build_log_analysis module
- thamos.swagger_client.models.build_build_log module
- thamos.swagger_client.models.callback_info module
- thamos.swagger_client.models.container_images_response module
- thamos.swagger_client.models.container_images_response_container_images module
- thamos.swagger_client.models.container_images_response_error module
- thamos.swagger_client.models.container_images_response_parameters module
- thamos.swagger_client.models.deb_dependency_item module
- thamos.swagger_client.models.image_metadata_response module
- thamos.swagger_client.models.justification module
- thamos.swagger_client.models.justification_inner module
- thamos.swagger_client.models.kebechet_metadata module
- thamos.swagger_client.models.kebechet_webhook_input module
- thamos.swagger_client.models.project_def module
- thamos.swagger_client.models.project_def_constraints module
- thamos.swagger_client.models.provenance_input module
- thamos.swagger_client.models.provenance_result_response module
- thamos.swagger_client.models.provenance_result_response_metadata module
- thamos.swagger_client.models.provenance_result_response_metadata_distribution module
- thamos.swagger_client.models.provenance_result_response_metadata_distribution_version_parts module
- thamos.swagger_client.models.provenance_result_response_result module
- thamos.swagger_client.models.provenance_result_response_result_parameters module
- thamos.swagger_client.models.python_environments module
- thamos.swagger_client.models.python_environments_environment module
- thamos.swagger_client.models.python_package_dependencies module
- thamos.swagger_client.models.python_package_dependencies_dependencies module
- thamos.swagger_client.models.python_package_dependencies_error module
- thamos.swagger_client.models.python_package_indexes module
- thamos.swagger_client.models.python_package_indexes_indexes module
- thamos.swagger_client.models.python_package_name_import_response module
- thamos.swagger_client.models.python_package_name_import_response_package_names module
- thamos.swagger_client.models.python_package_name_response_error module
- thamos.swagger_client.models.python_package_version_environments_response module
- thamos.swagger_client.models.python_package_version_metadata_response module
- thamos.swagger_client.models.python_package_version_metadata_response_error module
- thamos.swagger_client.models.python_package_version_metadata_response_metadata module
- thamos.swagger_client.models.python_package_version_metadata_response_metadata_importlib_metadata module
- thamos.swagger_client.models.python_package_version_metadata_response_metadata_importlib_metadata_entry_points module
- thamos.swagger_client.models.python_package_versions_response module
- thamos.swagger_client.models.python_package_versions_response_error module
- thamos.swagger_client.models.python_package_versions_response_versions module
- thamos.swagger_client.models.python_packages_response module
- thamos.swagger_client.models.python_packages_response_packages module
- thamos.swagger_client.models.python_platforms module
- thamos.swagger_client.models.python_stack module
- thamos.swagger_client.models.repo_init_input module
- thamos.swagger_client.models.requirements_def module
- thamos.swagger_client.models.requirements_lock_def module
- thamos.swagger_client.models.runtime_environment module
- thamos.swagger_client.models.runtime_environment_hardware module
- thamos.swagger_client.models.runtime_environment_operating_system module
- thamos.swagger_client.models.stack_info module
- thamos.swagger_client.models.unit_def module
- Module contents
- thamos.swagger_client.thoth package
- Submodules
- thamos.swagger_client.thoth.advise_api module
- thamos.swagger_client.thoth.build_analysis_api module
- thamos.swagger_client.thoth.buildlogs_api module
- thamos.swagger_client.thoth.container_images_api module
- thamos.swagger_client.thoth.environments_api module
- thamos.swagger_client.thoth.image_analysis_api module
- thamos.swagger_client.thoth.kebechet_api module
- thamos.swagger_client.thoth.provenance_api module
- thamos.swagger_client.thoth.python_packages_api module
- Module contents
- thamos.swagger_client.models package
- Submodules
- thamos.swagger_client.api_client module
- thamos.swagger_client.configuration module
- thamos.swagger_client.rest module
- Module contents
- Subpackages
Submodules¶
thamos.cli module¶
Command line interface Thamos for interaction with Thoth.
- class thamos.cli.AliasedGroup(name: Optional[str] = None, commands: Optional[Union[Dict[str, click.core.Command], Sequence[click.core.Command]]] = None, **attrs: Any)[source]¶
Bases:
rich_click.rich_group.RichGroup
Provide clever command aliases.
- get_command(ctx, cmd_name)[source]¶
Get command to be executed based on the prefix.
https://click.palletsprojects.com/en/7.x/advanced/#command-aliases
thamos.cli_config module¶
Configuration for Thamos CLI using rich-click.
thamos.config module¶
CLI and library configuration.
thamos.discover module¶
Implementation discovery methods to detect the current environment and its configuration.
- thamos.discover.discover_all() Dict[str, Any] [source]¶
Discover all the entries used in Thoth’s configuration file.
- thamos.discover.discover_cpu() Dict[str, Optional[Union[str, int]]] [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_cudnn_version() Optional[str] [source]¶
Discover CuDNN version and return None if not found.
- thamos.discover.discover_distribution() tuple [source]¶
Get distribution identifier and distribution version.
- thamos.discover.discover_gpu_model() Optional[str] [source]¶
Check for GPU model and return None if not found.
thamos.exceptions module¶
Exception hierarchy in Thamos.
- exception thamos.exceptions.ApiError[source]¶
Bases:
thamos.exceptions.ThamosException
An exception raised if the API doesn’t return expected status code.
- 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.NoDevRequirements[source]¶
Bases:
thamos.exceptions.ThamosException
An exception raised if no development requirements are found during the installation process.
- exception thamos.exceptions.NoMatchingPackage[source]¶
Bases:
thamos.exceptions.ThamosException
An exception raised if no matching package can be found for a given import.
- exception thamos.exceptions.NoProjectDirError[source]¶
Bases:
thamos.exceptions.ThamosException
An exception raised if the project directory cannot be found.
- exception thamos.exceptions.NoRequirementsFile[source]¶
Bases:
thamos.exceptions.ThamosException
An exception raised when requirements file is not present.
- 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.PedanticRunVerificationError[source]¶
Bases:
thamos.exceptions.ThamosException
An exception raised if the runtime environment used does not match configuration.
- exception thamos.exceptions.RequirementsFileError[source]¶
Bases:
thamos.exceptions.ThamosException
An exception raised if there is an issue with requirements file or lock file.
- exception thamos.exceptions.RuntimeEnvironmentExistsError[source]¶
Bases:
thamos.exceptions.ThamosException
An exception raised the given runtime environment already exists.
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.add_requirements_to_project(requirement: List[str], runtime_environment: Optional[str], index_url: str, dev: bool)[source]¶
Add requirements to project.
- thamos.lib.advise(api_client: thamos.swagger_client.api_client.ApiClient, pipfile: str, pipfile_lock: str, *, constraints: Optional[str] = None, recommendation_type: Optional[str] = None, runtime_environment: Optional[dict] = None, src_path: str = '.', runtime_environment_name: Optional[str] = None, dev: bool = False, no_static_analysis: bool = False, no_user_stack: bool = False, nowait: bool = False, force: bool = False, debug: bool = False, origin: Optional[str] = None, timeout: Optional[int] = 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, justification: Optional[Dict] = None, stack_info: Optional[Dict] = None, kebechet_metadata: Optional[Dict] = None, verify_tls: bool = True, labels: Optional[Dict[str, str]] = 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: Optional[dict] = None, src_path: str = '.', runtime_environment_name: Optional[str] = None, dev: bool = False, no_static_analysis: bool = False, no_user_stack: bool = False, nowait: bool = False, force: bool = False, debug: bool = False, timeout: Optional[int] = None, 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, justification: Optional[Dict] = None, stack_info: Optional[Dict] = None, kebechet_metadata: Optional[Dict] = None, verify_tls: bool = True, labels: Optional[Dict[str, str]] = None) Optional[tuple] [source]¶
Run advise in current directory, requires no arguments.
- thamos.lib.advise_using_config(pipfile: str, pipfile_lock: str, config: str, *, runtime_environment_name: Optional[str] = None, constraints: Optional[str] = None, src_path: str = '.', recommendation_type: Optional[str] = None, dev: bool = False, no_static_analysis: bool = False, no_user_stack: bool = False, nowait: bool = False, force: bool = False, debug: bool = False, origin: Optional[str] = None, timeout: Optional[int] = 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, labels: Optional[Dict[str, str]] = None) Optional[Tuple[Dict[str, Any], bool]] [source]¶
Trigger advise, respecting the configuration file supplied directly as a string or as a file path.
- thamos.lib.build_analysis(api_client: thamos.swagger_client.api_client.ApiClient, build_log: dict, base_image: str, output_image: str, *, environment_type: str, base_registry_user: Optional[str] = None, base_registry_password: Optional[str] = None, base_registry_verify_tls: bool = True, output_registry_user: Optional[str] = None, output_registry_password: Optional[str] = None, output_registry_verify_tls: bool = True, origin: Optional[str] = None, 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.check_runtime_environment_run(runtime_environment: Dict[str, Any]) None [source]¶
Check the runtime environment matches runtime environment declared in the config file.
- thamos.lib.collect_support_information_dict() Dict[str, Any] [source]¶
Collect environment information suitable to report bugs or issues in a dictionary form.
- thamos.lib.get_analysis_results(api_client: thamos.swagger_client.api_client.ApiClient, analysis_id: Optional[str] = None)[source]¶
Get the analysis result from a given id.
- thamos.lib.get_diff(api_client: thamos.swagger_client.api_client.ApiClient, new_analysis_id: str, old_analysis_id: str = None)[source]¶
Get the difference of two analyses justification stack - the analysis type must be of type ‘adviser-‘.
If old_analysis_id is not provided, its get from the last thamos call which stores it in a temporary file.
- 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_package_from_imported_packages(api_client: thamos.swagger_client.api_client.ApiClient, import_name: str, raise_on_error: bool = True) List[Dict[str, Any]] [source]¶
Get all (package_name, package_version, index_url) triplets for given import package name.
- thamos.lib.get_static_analysis(src_path: str = '.', *, without_standard_imports: bool = False, without_builtin_imports: bool = False, without_builtins: bool = False) Optional[dict] [source]¶
Get static analysis of files used in project.
- thamos.lib.get_status(api_client: thamos.swagger_client.api_client.ApiClient, analysis_id: Optional[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.get_verified_packages_from_static_analysis(src_path: str = '.', *, without_standard_imports: bool = False, without_builtin_imports: bool = False, without_builtins: bool = False, raise_on_error: bool = True) List[Dict[str, str]] [source]¶
Get verified packages from invectio static analysis result.
- 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, timeout: Optional[int] = None, debug: bool = False) Optional[Union[Dict, str]] [source]¶
Submit an image for analysis to Thoth.
- thamos.lib.install(runtime_environment_name: Optional[str] = None, dev: bool = False, pip_args: Optional[Tuple[str]] = None) None [source]¶
Perform installation of packages for the given runtime environment.
If the runtime environment is not specified, the first environment stated in the configuration is used.
- thamos.lib.install_using_config(config: str, runtime_environment_name: Optional[str] = None, dev: bool = False) None [source]¶
Perform installation given the configuration supplied.
- thamos.lib.is_analysis_ready(analysis_id: str, *, verify_tls: bool = True) bool [source]¶
Handle the multiple response types available while asking for result of an analysis.
- thamos.lib.list_python_environments(api_client: thamos.swagger_client.api_client.ApiClient) Dict[str, Any] [source]¶
Get available Python environments.
- thamos.lib.list_python_package_indexes(api_client: thamos.swagger_client.api_client.ApiClient) Dict[str, Any] [source]¶
Get information about hardware for which Thoth can give recommendations.
- thamos.lib.list_thoth_container_images(api_client: thamos.swagger_client.api_client.ApiClient, *, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, cuda_version: Optional[str] = None, image_name: Optional[str] = None, library_name: Optional[str] = None, symbol: Optional[str] = None, package_name: Optional[str] = None, rpm_package_name: Optional[str] = None) List[Dict[str, Any]] [source]¶
Get available Thoth container images.
- thamos.lib.load_dot_env(dot_env_path: str) Dict[str, str] [source]¶
Load .env file and parse its content.
- thamos.lib.load_files(requirements_format: str) Tuple[str, Optional[str]] [source]¶
Load Pipfile/Pipfile.lock or requirements.in/txt from the current directory.
- thamos.lib.print_advise_results(analysis_id: Optional[str] = None)[source]¶
Print dependency graph to stdout produced by the given adviser.
- thamos.lib.print_dependency_graph(analysis_id: Optional[str] = None, *, fold: bool = True) bool [source]¶
Print dependency graph to stdout produced by the given adviser.
- thamos.lib.print_dependency_graph_from_adviser_document(adviser_document: Dict[str, Any], *, fold: bool = True) bool [source]¶
Print dependency graph to stdout from the given document.
- 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: Optional[str] = None, timeout: Optional[int] = None, justification: Optional[Dict[str, Any]] = None, stack_info: Optional[Dict[str, Any]] = None, kebechet_metadata: Optional[Dict[str, Any]] = None, verify_tls: bool = False) 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: Optional[str] = None, timeout: Optional[int] = None, justification: Optional[Dict[str, Any]] = None, stack_info: Optional[Dict[str, Any]] = None, kebechet_metadata: Optional[Dict[str, Any]] = None, verify_tls: bool = True) 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.
Module contents¶
A CLI tool and library for interacting with Thoth.