Bug#784317: ITP: python-configargparse -- this should be an appropriate short description for the eventual package: replacement for argparse allowing options to also be set via config files and/or environment vari
Package: wnpp
Severity: wishlist
Owner: Sebastien Delafond <seb@debian.org>
* Package name : python-configargparse
Version : 0.9.3
Upstream Author : Zorro
* URL : https://github.com/zorro3/ConfigArgParse
* License : MIT
Programming Lang: Python
Description : replacement for argparse allowing options to also be set via config files and/or environment variables
Applications with more than a handful of user-settable options are best
configured through a combination of command line args, config files,
hard-coded defaults, and in some cases, environment variables.
.
Python’s command line parsing modules like argparse have very limited
support for config files and environment variables, so this module
extends argparse to add these features.
.
Features:
.
- command-line, config file, env var, and default settings can now be
defined, documented, and parsed in one go using a single API (the
order of precedence is: command line args > environment variables >
config file values > defaults)
- config files can have .ini or .yaml style syntax (eg. key=value or
key: value)
- user can specify a config file path using regular command line syntax
(eg. -c config.txt) rather than the argparse-style @config.txt
- all argparse functionality is fully supported, so this module can
serve as a drop-in replacement for argparse
- env vars and config file keys & syntax are automatically documented
in the help message
- print_values() can be used to log values and their sources
(eg. command line, env var, config file, or default) for improved
reproducibility
- lite-weight (simple API, no dependencies on 3rd-party libraries),
- extensible (the following methods can be over-ridden to change config
file and environment variable parsing: parse_config_file,
get_possible_config_keys, convert_setting_to_command_line_arg)
- unittested using the tests that came with argparse, and using tox to
test python versions >= 2.7
Reply to: