Ensure auto_env_var_prefix converts dash to underscore like ArgParse#29
Ensure auto_env_var_prefix converts dash to underscore like ArgParse#29bw2 merged 1 commit intobw2:masterfrom
Conversation
|
Hi @helgi I'm hesitating to merge this because there are many special characters that can't be included in auto_env_var_prefix (eg. '=', etc.), so I'd rather just leave it to the user to provide a sensible auto_env_var_prefix value instead of trying to fix specific kinds of bad characters like '-' . |
|
This actually has nothing to do with the prefix it self but rather the arguments themselves. It is transforming Right now the code in master straight up takes the config name, no transformation. Replacing Shell doesn't like the |
From https://docs.python.org/dev/library/argparse.html#dest: Any internal - characters will be converted to _ characters to make sure the string is a valid attribute name
|
Oh, I see. My mistake. |
Ensure auto_env_var_prefix converts dash to underscore like ArgParse
|
Thanks for merging! I can see why it would be confusing given people can add in their own prefix ending and I didn't specifically mention values only :-) For a few minutes I did think about potentially just auto adding |
|
Does it make sense to do the same for all configuration sources, except the command line? For example, I would expect p.add_arguments('-c', '--config-file') to have a corresponding yaml key of 'config_file'. |
From https://docs.python.org/dev/library/argparse.html#dest: Any internal - characters will be converted to _ characters to make sure the string is a valid attribute name
Also bumped the version to
0.10.0to be more semvar since0.9.4was really feature addition.