Runtime Configuration Utilities
The config package contains small runtime helpers that are importable in a clone of this repository.
Package Structure
config/
├── __init__.py
├── cli.py
└── logconf.py
config.cli
config.cli is a Typer wrapper with two commands, run as python -m config.cli <command>:
tfopt [--mode local] [--conf PATH]: runspython -m tfopt.localwith that configuration (only the local mode exists).fitanalysis [--conf PATH]: runspython -m tfopt.fitanalysis.
The tfopt command (Command line) covers both and more.
config.logconf
config.logconf exposes the package logger (setup_logger, from tfopt.local.config.logconf): console and optional
file logging. A run logs to <results_dir>/logs.
config_loader.py
The root-level config_loader.py finds the config.toml (--conf PATH on the command line, else TFOPT_CONFIG,
else the clone's config.toml), loads it, and merges the mode-specific overrides recursively:
config_loader.load(mode, section) returns [section] updated with [section.modes.<mode>], plus the [paths]
table and the folder of the file, against which relative paths resolve.
tfopt.local.config.constants computes its module constants from it on first use, never at import, and
tfopt.api.load_config reads a given file directly. A process that has already used the constants keeps them
until constants.reload(); the simplest way to switch configurations is a fresh process (the notebooks set
TFOPT_CONFIG before importing the loaders).