click_config_file
click_config_file copied to clipboard
Additional configuration providers
It would be nice to have more file formats for configuration files.
When I started this project, I decided to use Configobj as a configuration file parser, because it supports the more tricky combinations such as click.option('--arg', nargs=2, type=(str, int), multiple=True)
. For this reason I was ok with adding configobj as a dependency.
However, I would keep the dependencies to a minimum. Yaml would be nice, for example, but difficult to implement without additional dependencies. That's why I would like to focus on formats which can be supported without adding new dependencies.
All providers should be analyzed and tested against tricky combinations like the one above. It might not be possible to support all types and that's ok, but all restrictions should be well documented.
These candidates come to mind:
- [ ] json
- [ ] configparser
- [ ] plistlib
- [ ] xml
- [ ] sqlite3
- [ ] yaml
I'd also add yml to the provider list
FYI, I created click-extra
, an utility that is supporting both YAML and TOML config file for Click.
See a usage example at: https://github.com/kdeldycke/click-extra#toml-configuration
Since my last post, click-extra added supports for commented JSON and INI/configparse
configuration files.