Skip to main content

Modular Configuation Library

Project description

ModYml

📦 Project Introduction

ModYml is a lightweight Python configuration management library designed for modular and reusable configurations. With YAML file support, it enables configuration inheritance, parameter overriding, and alias systems, making complex configuration management simple and intuitive.

✨ Key Features

  • Modular Configs: Split configurations into reusable modules
  • Dynamic Inheritance: Reference other configs using $module.key syntax
  • Parameter Overriding: Modify parameters at runtime with $module.key(param=value)
  • Alias System: Create short aliases for config items key(alias)
  • Namespace Isolation: Automatic namespace management for config items
  • Dot-access: Returns EasyDict objects for attribute-style access

⚙️ Installation

pip install modyml

🚀 Quick Start

  1. Create module config (modules/optimizers.yml):
adam:
  type: Adam
  params:
    learning_rate(lr): 0.001
    weight_decay(wd): 0.0001
  1. Create experiment config (experiments/E01.yml):
training:
  base_optimizer: $optimizers.adam
  custom_optimizer: $optimizers.adam(lr=0.002)
  special_optimizer($optimizers.adam):
    params:
      wd: 0.01
  1. Load configuration:
from modyml import load

config = load(
    "experiments/E01.yml",
    module_files=["modules/optimizers.yml"],
    base_dir="configs/"
)

print(config.training.base_optimizer.params.lr)  # Output: 0.001
print(config.training.custom_optimizer.params.lr)  # Output: 0.002
print(config.training.special_optimizer.params.wd)  # Output: 0.01

🧪 Testing

pytest tests/

Author: Yuyao Huang (Sam) License: MIT

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

modyml-0.1.0.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

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

modyml-0.1.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file modyml-0.1.0.tar.gz.

File metadata

  • Download URL: modyml-0.1.0.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.3

File hashes

Hashes for modyml-0.1.0.tar.gz
Algorithm Hash digest
SHA256 edd03552484611dc45133aa366b38d5a6c5a72ba0d8e820670738467ae95294c
MD5 f93a3ff4dd5c8f01ead097f5b2a40863
BLAKE2b-256 db0119140202f8603bbf191fff83f99c720d7ffd0979fee562d91408bfb1afed

See more details on using hashes here.

File details

Details for the file modyml-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: modyml-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.3

File hashes

Hashes for modyml-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9ee7b0e9c5f810de0af218a866b699883c89cab527abeb61ea3ad2e63b85dc76
MD5 077cc045163e384b796c4f937e4aedf7
BLAKE2b-256 15836446b79bc5d96eb49228a4749b959af3a7ab1fc7328b6bb8fd76e92b0fff

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