Python experiments configuration files library
For a configuration file cfg.py
:
digit = 2
key = "a"
value = {
"a": 12,
"b": 42,
}[key]
Loads the configuration file as a dictionary
from pyconfyg import Confyg
config = Confyg("cfg.py").dict
assert(conifg['value'] == 12)
Loads the configuration file and update the parameter 'key' before retrieving the dictionary
from pyconfyg import Confyg
config = Confyg("cfg.py", {'key': 'b'}).dict
assert(conifg['value'] == 42)
Creates a configuration iterator for multiple values of the parameter 'key'
from pyconfyg import GridConfyg
configs = [c.dict for c in GridConfyg("cfg.py", {'key': ['a', 'b']})]
Creates a configuration iterator for multiple values of the parameters 'key' and 'digit' (creating 6 different configurations)
from pyconfyg import GridConfyg
configs = list(GridConfyg("cfg.py", {'key': ['a', 'b'], 'digit': [2, 4, 8]}))