3 ms·
Show HN: (aconf) Global Python in-memory configuration module
- synchronizing 6y agoWrote 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 https://github.com/synchronizing/aconf * PyPi: https://pypi.org/project/aconf/ https://pypi.org/project/aconf/