作者:Nolan
首页:https://github.com/innovate-invent/configutator
文档:None
下载链接
configutator
Maps yaml nodes and command line arguments to python function parameters.
To install: pip install configutator Or::
git clone [email protected]:innovate-invent/configutator.git cd configutator python3 setup.py install
To use:
. Create a main function with all the parameters you need, annotated with any defaults.
. Use the @ConfigMap and @ArgMap decorators to modify the default mappings if needed.
. In the if __name__ == "__main__": block at the bottom of the file call the loadConfig() function.
Here is an example of the most basic use::
from configutator import loadConfig from sys import argv
def foo(param1, param2, param3=None): pass
if name == "main": for argmap in loadConfig(argv, (foo,))