Open systematicguy opened 4 years ago
Hi @kottalovag , glad you're planning to submit a PR. I would go with 2a. in case somebody already has code that depends on the current behavior.
Hi @bw2 thanks for the positive feedback. Just a heads-up, I have started working on this, and then slept over it to have a refined solution. I have basically implemented the change, I will now have to look into the tests (and of course cover the new cases). https://github.com/kottalovag/ConfigArgParse/commits/feature/flexible-auto_env_var_prefix
Same problem here, it's nice if we have a flag or something to stop upcasing.
First of all, I am overall very pleased with configargparse module as it saves me the legwork I did for at least 5 of my previous projects - now I have configargparse at my fingertips with an acceptable amount of compromises to make. Thanks for your work with this!
To the topic: We use Atlassian Bamboo for ci/cd, and unfortunately Bamboo plan variables which are injected as environment variables, are prefixed with "bamboo_" when running on unix agents.
Now I found in https://github.com/bw2/ConfigArgParse/blob/1.0/configargparse.py#L426 that we do the upper for the whole concatenated thing, and thus e.g. bamboo_TOOL_PARAM will not be picked up, only BAMBOO_TOOL_PARAM. I also see this mentioned in the docstring. I see the idea of upper-casing the param names basically a good thing (after all e.g. on windows there are only upper-case envvars), but sometimes we don't have a way to force the "user" (in this case the ci system) to do this or that. On the long term I would like to see the prefix allowing it to be mixed-case, instead of doing the os.environ patching (which I apply now as a horrible workaround before parsing).
I am about to make my first PR in my life about this as the fix is really easy and non-intrusive, but wanted to ask