Configuration file loader
Project description
Configuration file loader for Python projects
Based on: https://github.com/dominictarr/rc
Features
Read environment variables and config files and return them merged with predefined list of arguments.
- Arguments:
appname: application name, used for config files and environemnt variable names.
args: arguments from command line (optparse, docopt, etc).
strip_dashes: strip dashes prefixing key names from args dict.
- Returns:
dict containing the merged variables of environment variables, config files and args.
Environment variables are read if they start with appname in uppercase with underscore, for example:
TEST_VAR=1
Config files compatible with ConfigParser are read and the section name appname is read, example:
[appname] var=1
- Files are read from:
/etc/appname/config
/etc/appfilerc
~/.config/appname/config
~/.config/appname
~/.appname/config
~/.appnamerc
.appnamerc
file provided by config variable in args
Example usage with docopt:
args = rcfile(__name__, docopt(__doc__, version=__version__))
TODO
Requirements
Python >= 2.6 or >= 3.3
License
MIT licensed. See the bundled LICENSE file for more details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file rcfile-0.1.4.tar.gz
.
File metadata
- Download URL: rcfile-0.1.4.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21bdab7e1b82a6277c18effc90e1163e9e09edbcded260a3940d6a3afa5f8bf9 |
|
MD5 | 5459564f69b5818cc8845737e1861122 |
|
BLAKE2b-256 | bd6e18417ba4cb5260ab7f079247e681f79c06581a8cc3ec18377585deb0de8f |
File details
Details for the file rcfile-0.1.4-py27-none-any.whl
.
File metadata
- Download URL: rcfile-0.1.4-py27-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 2.7
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fa3a9757a11f2e7b2f1ea7ea4e1144fe4f2e964865832b2891739579072cc14 |
|
MD5 | 5444513dac076018f5d75fee9ec52b1c |
|
BLAKE2b-256 | aecb208b8622eae72fb0e3a6db423177723a794c1577bb746a8c541f02824156 |