The config.py module#

Summary#

FluidsMCPConfig

Resolved configuration values.

ConfigError

Raised when an environment variable is set to an invalid value.

load_config

Read and validate every recognized environment variable.

validate_config

Validate configuration.

Description#

Centralized environment-variable configuration for PyFluent MPP.

Every FLUIDS_MCP_* variable is read once at startup and validated. validate_config() is called from each leaf’s CLI entry point so a typo or out-of-range value fails fast with a clear message instead of silently corrupting runtime behavior later.

Module detail#

config.load_config(env: dict[str, str] | None = None) FluidsMCPConfig#

Read and validate every recognized environment variable.

Pass env to inject a synthetic environment for unit tests. Unknown FLUIDS_MCP_* variables produce a warning string in the returned config (also logged at WARNING level), but do not abort.

Parameters:
envOptional[dict[str, str]]

Environment mapping to read instead of the process environment.

Returns:
FluidsMCPConfig

Result produced by the function.

config.validate_config(env: dict[str, str] | None = None) FluidsMCPConfig#

Validate configuration.

Alias of load_config() that raises ConfigError on any issue. Call once from each CLI entry point.

Parameters:
envOptional[dict[str, str]]

Environment mapping to read instead of the process environment.

Returns:
FluidsMCPConfig

Result produced by the function.