Skip to main content

A simple config reader based on python Config Parser.

Project description

This is a simple project to read python configurations from INI files. Has the following features:

  • It uses the Singleton pattern to configure the reader only once and used it across an application.

  • Reloads the configurations when the configuration file is changed.

  • Read OS variables as Strings, e.g., ‘%(LANG)s’

  • The configurations are automatically converted to a python data type

  • Collect a configuration section as a dictionary

The available data types are: - Strings, surrounded by ‘’ or “” - Integers - Floats - Lists, [1,2,3] - Dictionaries, {‘test’: {‘is_dict’: True}}


To use the config_reader simple install using pip

$ pip install ini-config-reader


Python3 tested for versions 3.5, 3.6 and 3.7


The conf_reader has three class variables, INI_FILE, RELOAD and DICT_CACHE.




Path to the file that contains the configurations


Set if the INI file should be reloaded when changes are detected


When collecting the section as dictionary store it in a dict to avoid processing the reading

Regular usage

Since the config_reader implements the singleton pattern the user only needs to configure the INI_File once. Then the get method and get_section_dict can be used as static methods.

from conf_reader.reader import ConfReader

ConfReader.get('Section_1', 'configuration_1')  # Can be used in different modules


The config_reader uses a decorator to inject configuration in functions. To use it the INI_FILE must be already configured and a config variable must exist in the function’s signature.

from conf_reader.reader import ConfReader, read_conf

@read_conf("SECTION_1", 'config_2')
def read_with_arguments(*args, config, **kwargs):



This project is licensed under the MIT License - see the LICENSE.txt file for details

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ini-config-reader-0.0.3.tar.gz (4.5 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page