click_config_file icon indicating copy to clipboard operation
click_config_file copied to clipboard

Additional configuration providers

Open phha opened this issue 5 years ago • 3 comments

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

phha avatar Apr 24 '19 14:04 phha

I'd also add yml to the provider list

M1strall avatar Nov 11 '19 21:11 M1strall

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

kdeldycke avatar Jan 02 '22 20:01 kdeldycke

Since my last post, click-extra added supports for commented JSON and INI/configparse configuration files.

kdeldycke avatar Apr 08 '22 17:04 kdeldycke