minitrino.core.context module#
Core context and controls for Minitrino CLI.
- class minitrino.core.context.MinitrinoContext[source][source]#
Bases:
objectExpose context and core controls to CLI scripts.
Notes
The lib_dir property cannot be accessed prior to _lib_safe being set to True, which occurs early during initialize(). The idea is to force any user-provided env vars (since one of them may be LIB_PATH) to load before we attempt to do anything with the library.
- library_manager: LibraryManager[source]#
- logger: MinitrinoLogger[source]#
- cmd_executor: CommandExecutor[source]#
- initialize(cluster_name: str = '', version_only: bool = False, log_level: LogLevel | None = None) None[source][source]#
Initialize core CLI context attributes.
This method sets up logging, environment variables, and context-specific resources like the cluster and Docker clients. If version_only is True, initialization is limited to what is required to resolve the CLI and library versions.
- Parameters:
cluster_name (str, optional) – The cluster name to scope operations to. Defaults to “default”.
version_only (bool, optional) – If True, initializes only the attributes required for version fetching (e.g. minitrino –version).
log_level (LogLevel, optional) – The log level to set for the logger.
- property user_log_level: LogLevel[source]#
The user-configured log level for this context.
Immutable once set.
- Returns:
The immutable log level set by the user or default (INFO).
- Return type:
- property lib_dir: str[source]#
Get the library directory.
- Returns:
Path to the resolved library directory.
- Return type:
str
Notes
The directory is determined using the following order of precedence:
Use LIB_PATH if provided via environment.
Check if the library exists relative to the location of this file, assuming the project is running in a repository context.