If you find yourself writing multiple tools/scripts that share common configuration settings and despise ini files, this will be of interest to you. In my setting, I frequently write code that goes against the same databases and accesses the same resources. So I am constantly repeating code for configuration settings or worse yet, hard-coding it in where it shouldn't be.
YamJam is a Python module that allows you to put it in a common area that you can secure properly from prying eyes and makes working with oft used resources simple and straight forward.
YamJam attributes
* Project settings can saved in a user directory.
* Multiple configuration files can be specified.
* files are proper yaml files
Details
The main yamjam config file is located ~/.yamjam/config.yaml
* on windows: c:documents and settings[username].yamjamconfig.yaml
* on *nix: ~/.yamjam/config.yaml
Then yamjam looks for possible overrides/additions in the local config.yaml(if it exists) You can override the default config file(s) when you call the function by specifying a different one explicitly. i.e.
from YamJam import yamjam
myConfig = yamjam('file/path/filename')
myConfig is now a dictionary populated with the values from the specified yaml config file. By default YamJam looks for 2 config.yaml files, the main and then a project specific one. You may specify one or more files. Each file path listed should be separated by semi-colons(;)
myConfig = yamjam('file/path/filename;other/path/file')
The config.yaml file is yaml formatted which is a superset of json.
Every call to yamjam() re-reads the config file. If you wish to cache the info then do it in the calling code. i.e.
myConfig = yamjam()
If you only want to cache part of the configuration
myCfg = yamjam()['mykey']
Product's homepage
Requirements:
· Python