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 configargparser
To install from source:
python setup.py install
This 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
argparse
handles error messages
- (easy) Write a function that figures out
dest
fromargs
inadd_argument
, instead of relying on theAction
object
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
section
in the config file.) - (hard?) Sub Commands (Sub-commands should also get a
section
in the config file.)