nci-config-loader

Configuration file loader and parser


License
Apache-2.0
Install
pip install nci-config-loader==1.0.12

Documentation

nci-config-loader

A simple library to handle ini, yaml and json configuration files within your projects

Usage

Every aspect of the Config class is statically defined; This means that once initiated, the same information is available anywhere within the execution of the program.

Loading a config file:

if not Config.ready():
  Config.load("config.ini")

Accessing data

INI

Given one of these config files:

[GoogleAnalytics]
user : myusername
password : mypassword
GoogleAnalytics:
  user : myusername
  password : mypassword
"GoogleAnalytics":{  
  "user":"myusername",
  "password":"mypassword"
}

You can access the GoogleAnalytics user in your application using this line:

print(Config.get("GoogleAnalytics")["user"])

Get a Categories

Getting a category without specifying a variable name will return a dictionary; This means that all standard dictionary methods can apply:

  • get values: Config.get("Commands").values()
  • get keys: Config.get("Commands").keys()