Settings

Theme

Show HN: (aconf) Global Python in-memory configuration module

github.com

1 points by synchronizing 5 years ago · 1 comment

Reader

synchronizingOP 5 years ago

Wrote this module after getting annoyed at having to constantly pass `Config` objects left and right in my personal projects. Not planning on using this in any production systems but though it would be fun to package and share it.

aconf is a module for in-memory configuration. Create your configuration by doing the following:

    from aconf import make_config

    make_config(hello="world")
And then in any file inside your project access the configuration:

    from aconf import conf

    print(conf().hello)
    # >>> world
That's literally it. The configuration will live in memory for as long as the Python runtime exists, and can be accessed by any file/class/module that calls the `conf` or `config` function (more details on Github). The `make_config` function can take any Python type; objects, functions, etc. should have no issue being passed around.

* Github: https://github.com/synchronizing/aconf

* PyPi: https://pypi.org/project/aconf/

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection