Skip to main content

A package to manage YAML configuration with command line overrides

Project description

YAML Config Manager

A robust, "LLM-friendly" Python library for managing Deep Learning configurations. It seamlessly combines YAML files with command-line overrides, supporting dotted notation, scientific notation, and flexible argument styles.

Features

  • YAML + CLI: Load defaults from YAML, override via CLI.
  • Dotted Access: config.model.layer_count instead of config['model']['layer_count'].
  • Robust Parsing:
    • Supports scientific notation (1e-4 is a float, not string).
    • Smart boolean parsing (yes, on, true -> True).
  • Flexible CLI: Supports both --param=value and --param value.
  • Safety: Raises AttributeError for missing keys (no silent failures).

Installation

pip install .

Quick Start

1. Create config.yaml

training:
  lr: 1e-4
  batch_size: 32
model:
  type: transformer
  layers: 12

2. Use in Python

from yaml_config_manager import load_config

# Automatically parses sys.argv
config = load_config() 

print(f"Model: {config.model.type}")
print(f"LR: {config.training.lr} (type: {type(config.training.lr)})")

3. Run with Overrides

Mixed styles supported:

python train.py --config config.yaml --training.lr 2e-5 --model.layers=24 --debug_mode

Advanced Usage

  • Manual Args: load_config(args=['--param', 'val'])
  • Default Path: load_config(config_path='default.yaml')
  • Missing Keys: Accessing config.missing raises AttributeError to catch typos early.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yaml_config_manager-0.2.1.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yaml_config_manager-0.2.1-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file yaml_config_manager-0.2.1.tar.gz.

File metadata

  • Download URL: yaml_config_manager-0.2.1.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for yaml_config_manager-0.2.1.tar.gz
Algorithm Hash digest
SHA256 839d9ce42ab8912b8a3afcbd3e138dbf20e2f7977d464b249e0fd695903644a4
MD5 40d6b98eba6678f7a6c638010ff6a3bb
BLAKE2b-256 91be61fbfd8fcefa91b4c07e22ecf1ecfda557a7c09b40e608cdcdce13a094e4

See more details on using hashes here.

File details

Details for the file yaml_config_manager-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for yaml_config_manager-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 02bff06c2ebe755316dfc21552d9c9bd48e1e3e194d0ea4eecf74ab440a04be5
MD5 1bceabb6ee632e82f37c8ce7e2c2f8a5
BLAKE2b-256 97ed0b340f814f8359c106fa968059462416ed4eb0f016889f5bc66b4abf78a5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page