-
-
Notifications
You must be signed in to change notification settings - Fork 656
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
[BUG] Multiple value option gives tuple and not list #127
Comments
I was able to reproduce this issue. Would this be considered a bug or a documentation issue, @tiangolo? I'd like to work on this. |
UPDATE: I have discussed this with my MLH mentor and we concluded that it was a bug, however, I am not sure if the bug is in the typing library or Typer itself. |
Hey @ovezovs ! Thanks! Yes, I think it would probably make sense to ensure that the value passed is a |
Hi @ovezovs, are you still planning on looking into this (or already working on it)? I encountered this bug in the wild, and if you've changed your mind, I'd be interested in trying to fix it. |
Feel free to take on it. |
As an extra layer to this, if an option is declared as In comparison Would this be considered the same issue, or should I raise a new one? |
Thanks for the clear example @jayqi! 🤓 🍰 And thanks for the discussion everyone. ☕ @Andrew-Sheridan, could you please create a new issue with that example? This was fixed by @hellowhistler in #143 It will be available in the next release, in some hours, Typer version |
Created #410 with the example |
Describe the bug
The standard way to configure an option that expects multiple values is to declare with
List
, as described in the docs.However, this provides a tuple of values, and not a list of values, as one would expect based on the type hint declaration. It also contradicts the documentation, which states "You will receive the values as you declared them, as a list of str".
To Reproduce
Steps to reproduce the behavior with a minimum self-contained file.
main.py
with:Expected behavior
I would expect to get a container of values that is class
list
as declared.Environment
The text was updated successfully, but these errors were encountered: