There are three main ways that programs get data from their environment when they start up:
- Commandline arguments,
- Configuration files
- Environment variables
Currently, if a python program wants to parse data from these sources, it needs to first check the environment variables, then check for a configuration file and finally look at the commandline arguments. The general cascade is that commandline arguments should override config files which should override environment variables. Unfortunately, checking all of these places is a major pain -- which is what configargparser is meant to address.
Installation should be straight forward:
To install via pip:
pip install configargparserTo install from source:
python setup.py installThis implementation is still incomplete. Here's a partial TODO list:
- (easy) Interaction with parser defaults
- (easy) If type conversion doesn't work, check against how
argparsehandles error messages
- (easy) Write a function that figures out
destfromargsinadd_argument, instead of relying on theActionobject
I haven't tried any of this yet. It's unlikely—but still possible!—that it could just work…
- (hard?) Mutual Exclusion
- (hard?) Argument Groups (If implemented, these groups should get a
sectionin the config file.) - (hard?) Sub Commands (Sub-commands should also get a
sectionin the config file.)