pypi ConfigArgParse 1.7.7

2 hours ago

Fixes

Args with a custom argparse.Action and nargs can now be set from a config file (#354, #357)

An arg declared with a custom Action subclass and nargs="+" parsed fine from the command line but was rejected from a config file with can't be set to a list ... unless its action type is changed to 'append' or nargs is set to '*', '+', or > 1, which is not what the check actually tested. The check now looks only at nargs, as the message always said. Thanks to @yobeonline for the report and @lo-0l for the fix.

Improvements

toml is now a declared optional dependency (#355, #356)

TomlConfigParser reads with the standard library's tomllib on Python 3.11+ and falls back to the toml package below that, but that dependency was not declared anywhere. There is now a toml extra:

pip install configargparse[toml]

Note that tomllib can only read, so writing a config file out needs the toml package on every Python version.

A missing optional dependency is no longer silent. CompositeConfigParser tries each parser in turn, and a parser whose optional dependency was not installed used to be skipped indistinguishably from one that simply could not read the file. Such a parser now raises ConfigFileParserMissingDependency (a subclass of ConfigFileParserException, so existing handlers keep working), and the composite emits a warning naming the parser and how to install it, then continues down the chain.

TOML config files can now be read from binary streams on Python versions before 3.11.

Thanks to @TobiasDijkhuis for reporting and implementing this.

Full changelog: v1.7.6...v1.7.7

Don't miss a new ConfigArgParse release

NewReleases is sending notifications on new releases.