Skip to content

gabriel-vanzandycke/pyconfyg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pyconfyg

Python experiments configuration files library

For a configuration file cfg.py:

digit = 2
key = "a"
value = {
  "a": 12,
  "b": 42,
}[key]

Usage

Load configuration

Loads the configuration file as a dictionary

from pyconfyg import Confyg
config = Confyg("cfg.py").dict
assert(conifg['value'] == 12)

Runtime overwriting parameters

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)

Confyg iterator

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']})]

Cartesian product Confyg iterator

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]}))

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published