This library is for management of constants. This helps you to create an application which have the environments like dev, stg, prd.
$ pip install constants_manager
Setup "constants.ini".
[DEFAULT]
flag = False
val_only_default = val_only_default
[dev]
flag = True
val_only_dev = val_only_dev
you write a code like below.
!#/usr/bin/env python
from constants_manager import constants_manager
consts = constants_manager.ConstantsManager()
print(consts.get('val_only_default'))
if you want to use some constants which differed under environments, set the environments variables like this.
ENV=dev python sample.py
So you can access the value of "dev" section for using the environments variables.
If you do not set any environments variables, you can access the default value. So if you used those "constatns.ini" and use "flag" constant, it returns "False", not return 'True'.
There is the similar library which called "constants". The differences is that "constants_manager" is case-sensitivity. It distinguish on case of key.
- Issue
- Fork and pull requests.
- automatic test execution
- if you had some trouble, contact @masudaK
- run nosetests to the test file
- various version tests with using tox
- CI with travis
MIT