Skip to content

evaline-ju/alchemy-config

 
 

Repository files navigation

Alchemy Config

The aconfig library provides simple yaml configuration in python with environment-based overrides.

Installation

To install, simply use pip

pip install alchemy-config

Quick Start

config.yaml

foo: 1
bar:
    baz: "bat"

main.py

import aconfig

if __name__ == "__main__":
    config = aconfig.Config.from_yaml("config.yaml")
    print(config.foo)
    print(config.bar.baz)
export BAR_BAZ="buz"
python3 main.py

Corner-case Behavior

You CAN set builtin method names as attributes on the config. However, you should only access/delete them via dictionary access methods.

For example:

import aconfig
cfg = {"update": True}

config = aconfig.Config(cfg)

# DO NOT DO THIS:
config.update

# DO THIS INSTEAD:
config["update"]

This is because there is no way in Python to tell whether you want the method or the attribute "update" when "getting" it from the object.

About

The aconfig library supports yaml-based configuration files with environment-variable overrides in python

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 91.0%
  • Dockerfile 6.5%
  • Shell 2.5%