mafw.steering.environment

Resolve steering-scoped dotenv files without changing process state.

Author:

Bulgheroni Antonio

Description:

Build an isolated environment mapping for one steering file.

Added in version 2.4.

Functions

resolve_steering_environment(config, ...[, ...])

Merge dotenv values and the process environment for one steering file.

Classes

EnvironmentFileStatus(configured_path, ...)

A configured dotenv path and its safe-to-display validation message.

SteeringEnvironment(values, files[, errors])

Environment values and path statuses belonging to one steering file.

Exceptions

SteeringEnvironmentError

Raised when a steering file cannot resolve one of its dotenv files.

exception mafw.steering.environment.SteeringEnvironmentError[source]

Bases: ValueError

Raised when a steering file cannot resolve one of its dotenv files.

class mafw.steering.environment.EnvironmentFileStatus(configured_path: str, resolved_path: Path | None, error: str | None = None)[source]

Bases: object

A configured dotenv path and its safe-to-display validation message.

class mafw.steering.environment.SteeringEnvironment(values: dict[str, str], files: tuple[EnvironmentFileStatus, ...], errors: tuple[str, ...] = ())[source]

Bases: object

Environment values and path statuses belonging to one steering file.

mafw.steering.environment.resolve_steering_environment(config: Mapping[str, Any], steering_file: Path | str, *, process_environment: Mapping[str, str] | None = None, strict: bool = True) → SteeringEnvironment[source]

Merge dotenv values and the process environment for one steering file.

Parameters:
  • config – Raw steering mapping before interpolation.

  • steering_file – Source TOML path used to resolve relative dotenv paths.

  • process_environment – Optional environment snapshot; defaults to os.environ.

  • strict – Raise when any configured entry is invalid; false returns all safe statuses.

Returns:

Merged values and safe per-file status records.

Raises:

SteeringEnvironmentError – If the setting or any configured file is invalid.