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
Click 8.0 Custom Parameter Types and convert() #1898
Comments
This code works fine in 7.1.2, but fails in 8.0.0. Documentation doesn't note that the values should have changed. I don't have the exact error anymore, but
The code is from here: |
The value processing did change somewhat, and converters may get values that are already the correct type in situations such as using a default value or passing values from Python code instead of the command line. The reason for this change is so that type casting is applied consistently throughout the processing pipeline, regardless of how the command is called or where the value comes from. My guess is that you have a
You can adapt your custom type with something like this: def convert(self, value, param, ctx):
if isinstance(value, int):
return value If this isn't the issue, can you post a self-contained example and the error you get? |
I'm also experiencing the same issue with version 8.0. While the @click.command()
@click.option('-n', type=BASED_INT, default=10)
def main(n):
pass fails with |
Thanks. I think I can get past my particular issue by wrapping the value inside of |
It appears the actual values are coming through rather than strings of the values which is causing some unexpected results.
The text was updated successfully, but these errors were encountered: