You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A breaking change was made to the Choice object api at some point between questionary versions 1.6.0 and 1.8.0 when specifying the value parameter.
Previously, in v1.6.0, the expected behavior was for the selected choice to return the provided value= "as is" with no modifications.
However, in v1.8.0, anything passed to value is now type cast as a string, leading to breaking changes for applications expecting the returned value to be of the same type originally passed in to the value parameter. (See BradenM/micropy-cli#184, the issue that led to finding this.)
Quick search through the commit history points to this commit: 604c112 from #14 as a likely culprit.
I'm not sure if Questionary follows semantic versioning or not, but if so that PR (if it is actually the culprit) probably should have bumped the project version up by a major version given that the change is not backwards compatible w/ existing projects using v1.6.0.
Questionary v1.6.0
Python3.8.3 (default, May222020, 23:45:08)
Type'copyright', 'credits'or'license'formoreinformationIPython7.19.0--AnenhancedInteractivePython. Type'?'forhelp.
In [1]: fromquestionaryimportChoiceIn [2]: importquestionaryaspromptIn [3]: choices= [Choice("one", value=1)]
In [4]: prompt_ch=prompt.checkbox("Choose a value", choices=choices).ask()
? Chooseavalue [one]
In [5]: prompt_chOut[5]: [1]
In [6]: type(prompt_ch[0])
Out[6]: intIn [7]: prompt.__version__Out[7]: '1.6.0'
Questionary v1.8.0
Python3.8.3 (default, May222020, 23:45:08)
Type'copyright', 'credits'or'license'formoreinformationIPython7.19.0--AnenhancedInteractivePython. Type'?'forhelp.
In [1]: fromquestionaryimportChoiceIn [2]: importquestionaryaspromptIn [3]: choices= [Choice("one", value=1)]
In [4]: prompt_ch=prompt.checkbox("Choose a value", choices=choices).ask()
? Chooseavalue [one]
In [5]: prompt_chOut[5]: ['1']
In [6]: type(prompt_ch[0])
Out[6]: strIn [7]: prompt.__version__Out[7]: '1.8.0'
The text was updated successfully, but these errors were encountered:
BradenM
added a commit
to BradenM/micropy-cli
that referenced
this issue
Nov 17, 2020
A breaking change was made to the Choice object api at some point between questionary versions 1.6.0 and 1.8.0 when specifying the
value
parameter.Previously, in v1.6.0, the expected behavior was for the selected choice to return the provided
value=
"as is" with no modifications.However, in v1.8.0, anything passed to
value
is now type cast as a string, leading to breaking changes for applications expecting the returned value to be of the same type originally passed in to thevalue
parameter. (See BradenM/micropy-cli#184, the issue that led to finding this.)Quick search through the commit history points to this commit: 604c112 from #14 as a likely culprit.
I'm not sure if Questionary follows semantic versioning or not, but if so that PR (if it is actually the culprit) probably should have bumped the project version up by a major version given that the change is not backwards compatible w/ existing projects using v1.6.0.
Questionary v1.6.0
Questionary v1.8.0
The text was updated successfully, but these errors were encountered: