bw2 / ConfigArgParse

A drop-in replacement for argparse that allows options to also be set via config files and/or environment variables.
MIT License
719 stars 121 forks source link

Useful config parsers - TOML and INI parsers with support for sections #270

Closed tristanlatr closed 1 year ago

tristanlatr commented 2 years ago

Hello @bw2,

This PR adds TOML and INI parsers with support for sections.

This PR solves issues #250, #227 and #20.

I know you manifested medium interest into this feature, but I'm sending a PR anyway because I think I propose a good way to integrate configargparse config parsing with standard project config files likes setup.cfg or pyproject.toml.

I've added pretty extensive documentation, so everything should be clear by reading the readme additions.

Tell me if you are interested into merging this kind of feature, I think it would be very useful (and I'm not the only one). I did not migrated the tests yet, I wanted to hear back from you before continuing working on this.

Tell me what you think :)

Thanks

adiroiban commented 2 years ago

Thanks for putting together this PR.

I think that support for pyproject.toml is nice as it makes it easy to integrate any CLI tool with the standard pyproject.toml file.

Looking forward to see this merged :)

tristanlatr commented 1 year ago

I’ll open a PR with some tests for this feature… it’s already used by pydoctor, so I’ll juste have to paste the tests here.

https://github.com/twisted/pydoctor/blob/master/pydoctor/test/test_configparser.py