Behavior changes
A false value for a flag now overrides lower-priority sources (#365, #105)
Previously, setting a flag (an arg that takes no value, such as store_true, store_false, count or store_const) to false in an environment variable or a higher-priority config file added nothing to the command line, so a true for the same flag in a lower-priority config file still turned it on. Now the false value counts as setting the flag, and lower-priority config files no longer set it. For example, VERBOSE=false now wins over verbose = true in a config file. Args that take a value are unchanged.
A bare -- in a list value is now an error
A list value from a config file or environment variable, such as items = [a, --], used to put a bare -- on the command line, which ended option parsing and turned the user's own command-line options after it into positional args. It now fails with an error that names the key.
Fixes
- Options after
--on the command line no longer block other sources (#363). Inprog -- --level,--levelis a positional arg, so environment variables and config files can still set--level. IniConfigParser.serialize()escapes%(#364), so values like%Y-%m-%dread back unchanged, and a saved%(name)sis no longer replaced by another key's value when the file is loaded.- Saved config files keep
store_falseandstore_constvalues (#360).write_config_file()now writestrueorfalseaccording to whether the flag was given, rather than the value the flag stores. ConfigparserConfigFileParserreads files that only have a[DEFAULT]section (#362), including the files its ownserialize()writes.ConfigparserConfigFileParserround trip: values written byserialize()read back the same in more cases (for example strings that look like lists, and list elements containing#or;), a value that will be cut short by a#or;comment now produces a warning, and interpolation errors name only the key, not the value, which may be a secret.
Full changelog: v1.8.0...v1.9.0