Skip to content

⬆️ Add compatibility with Click 8.2 #1222

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

Merged
merged 23 commits into from
May 26, 2025
Merged

⬆️ Add compatibility with Click 8.2 #1222

merged 23 commits into from
May 26, 2025

Conversation

tiangolo
Copy link
Member

⬆️ Add compatibility with Click 8.2

@thewhaleking
Copy link

Also, the docs reference using mix_stderr=False for CliRunner, but this is not longer available in Click 8.2.0

@davidism
Copy link

I haven't looked over this PR, but we did just add a new doc page about supporting multiple versions in Click, with an example for the get_metavar signature change. https://click.palletsprojects.com/en/stable/support-multiple-versions/ If there are other parts that you think we should document, or need help figuring out compatibility with, please let us (Click maintainers) know.

Copy link

📝 Docs preview for commit 02f6565 at: https://a1cfb4c7.typertiangolo.pages.dev

Copy link

📝 Docs preview for commit 1cbcbc1 at: https://3eb7a4b8.typertiangolo.pages.dev

@tiangolo
Copy link
Member Author

tiangolo commented May 22, 2025

Thanks a lot for offering help @davidism and especially for writing those docs! 🙌


I'm currently debugging the output showing errors for required parameters, with the update it doesn't show what was the (missing) required parameter, I probably have something wrong here... still debugging. 🤓 This was mainly about updating output formatting.

Now I'm debugging something related to shell completion. The shell completion thing was only about accessing the result.output.


The challenge was finding something related to the new support for enums in Click. In Click 8.2, choice types can use enums, but they expect the command to pass the name of the enum, not the value. And Typer has supported enums but using the value as the input instead of the enum name. This was handled by creating a custom Typer class type for choice that handles the input with the old Typer behavior.

Copy link

📝 Docs preview for commit bd98584 at: https://ec702d88.typertiangolo.pages.dev

Copy link

📝 Docs preview for commit 17350f5 at: https://f7ea7382.typertiangolo.pages.dev

kiinami added a commit to kamihi-dev/kamihi that referenced this pull request May 26, 2025
Copy link

📝 Docs preview for commit 3b8f9bc at: https://560ec3ed.typertiangolo.pages.dev

Copy link

📝 Docs preview for commit ce2f27b at: https://243fb83f.typertiangolo.pages.dev

Copy link

📝 Docs preview for commit a336edd at: https://530c5e42.typertiangolo.pages.dev

Copy link

Copy link

Copy link

@tiangolo tiangolo marked this pull request as ready for review May 26, 2025 14:18
@tiangolo tiangolo merged commit 74e0923 into master May 26, 2025
24 checks passed
@tiangolo tiangolo deleted the click-8.2 branch May 26, 2025 14:22
@tiangolo
Copy link
Member Author

This is now available in Typer 0.16.0 🚀 🎉

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

Successfully merging this pull request may close these issues.

4 participants