prefigure

raw JSON →
0.0.10 verified Mon Apr 27 auth: no python

Run configuration management utilities combining configparser, argparse, and wandb.API. Version 0.0.10 is the latest; release cadence is sporadic.

pip install prefigure
error AttributeError: 'Config' object has no attribute 'parse'
cause Using version < 0.0.8 where parse was called differently.
fix
Upgrade to >=0.0.8: pip install --upgrade prefigure or use Config.parse() only in newer versions.
error ModuleNotFoundError: No module named 'wandb'
cause wandb not installed but code tries to use wandb features.
fix
Install wandb: pip install wandb or disable wandb usage in config.
gotcha The 'parse' method may overwrite defaults with command-line args; be careful about order of operations.
fix Call cfg.parse() after setting defaults explicitly.
gotcha If wandb is not installed, the wandb integration fails silently; no error is raised.
fix Install wandb if you need logging: pip install wandb
deprecated The 'wandb_api_key' parameter is deprecated in favor of environment variable WANDB_API_KEY.
fix Set WANDB_API_KEY env var instead of passing it to Config.

Create a Config object with defaults, then parse arguments.

from prefigure import Config
import os

# Define configuration
cfg = Config(
    defaults={
        'learning_rate': 1e-3,
        'batch_size': 32,
    },
    wandb_api_key=os.environ.get('WANDB_API_KEY', '')
)

# Parse command line arguments
cfg.parse()
print(cfg.learning_rate)