Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow for choices to be empty in config file but not on command line #257

Open
mathisloevenich opened this issue Oct 29, 2021 · 5 comments

Comments

@mathisloevenich
Copy link

A config file like:

values = []

resolves in:
values=['']

it's unpleasent to have this empyt string. Instead it should be possible to just get an empty list.

@mathisloevenich
Copy link
Author

If you work with choices, it will mess up the code.
A workaround for this is to add an empty string to choices

choices.append([''])

@mathisloevenich
Copy link
Author

If there is no particular reason for this behaviour it would be nice to fix this,
even if it's not necessarily a bug.

@mathisloevenich mathisloevenich changed the title allow empty lists for parmeters allow for choices to be empty in config file but not on command line Oct 31, 2021
@mathisloevenich
Copy link
Author

With the new version 1.5.3 this is no longer working.
It worked on 1.2.3

@mathisloevenich
Copy link
Author

We can simply fix this with nargs="*", but obviously this would allow to have flags with no effects

@carlfischerjba
Copy link

This is an issue with environment variables too.

VALUES= python mytest.py will set the corresponding arg to [''], overriding the default value. This is generally not what we want.

If the env var VALUES is undefined it works as expected and the default value is used for that arg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants