Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

environment

minto.environment

Environment information collection module for MINTO experiments.

This module provides functionality to automatically collect and record environment metadata for optimization experiments, including OS information, hardware specifications, Python environment details, and package versions.

Classes

EnvironmentInfo

EnvironmentInfo(os_name: str, os_version: str, platform_info: str, cpu_info: str, cpu_count: int, memory_total: int, architecture: str, python_version: str, python_executable: str, virtual_env: typing.Optional, package_versions: dict, timestamp: str)

Container for environment information collected during experiment execution.

Methods

to_dict
to_dict() -> dict

Convert EnvironmentInfo to dictionary for serialization.


Functions

get_os_info

get_os_info() -> tuple

Get operating system information.

Returns:

TypeDescription
tupleTuple of (os_name, os_version, platform_info)

get_cpu_info

get_cpu_info() -> tuple

Get CPU information.

Returns:

TypeDescription
tupleTuple of (cpu_info, cpu_count, architecture)

get_memory_info

get_memory_info() -> int

Get total system memory in bytes.

Returns:

TypeDescription
intTotal memory in bytes

get_python_env_info

get_python_env_info() -> tuple

Get Python environment information.

Returns:

TypeDescription
tupleTuple of (python_version, python_executable, virtual_env)

get_package_versions

get_package_versions(key_packages: typing.Optional = None) -> dict

Get versions of key packages used in the experiment.

Args: key_packages: Iterable of package names to check. If None, uses default list.

Returns:

TypeDescription
dictDictionary mapping package names to their versions

collect_environment_info

collect_environment_info(include_packages: bool = True, additional_packages: typing.Optional = None) -> minto.environment.EnvironmentInfo

Collect comprehensive environment information.

Parameters:

NameTypeDescription
include_packagesboolWhether to include package version information
additional_packagestyping.OptionalAdditional packages to check versions for

Returns:

TypeDescription
minto.environment.EnvironmentInfoEnvironmentInfo object containing all collected information

format_memory_size

format_memory_size(bytes_size: int) -> str

Format memory size in human-readable format.

Parameters:

NameTypeDescription
bytes_sizeintSize in bytes

Returns:

TypeDescription
strFormatted string (e.g., “8.0 GB”)

get_environment_summary

get_environment_summary(env_info: minto.environment.EnvironmentInfo) -> str

Get a human-readable summary of environment information.

Parameters:

NameTypeDescription
env_infominto.environment.EnvironmentInfoEnvironmentInfo object

Returns:

TypeDescription
strFormatted summary string