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

Support existing click.ParamType instance in type hint #304

Closed
wants to merge 2 commits into from

Conversation

JacobHayes
Copy link

@JacobHayes JacobHayes commented Jul 22, 2021

We had a custom KeyValueType(click.ParamType) we used in click.option(..., type=KeyValueType()) for key=value style flags. When converting to typer, I was hoping to be able to set these in the param type hint, but ran into RuntimeError(f"Type not yet supported: {annotation}"). Adding this extra check fixed my use, and I'm guessing any other custom ParamTypes?

Is this the right place/way to add this support? If so, happy to dig into how to add a test for this!

cc @rockwellw

@github-actions
Copy link

📝 Docs preview for commit addbc63 at: https://639cea76d8175d0bb72d5f48--typertiangolo.netlify.app

@tiangolo
Copy link
Owner

tiangolo commented May 1, 2023

Thanks! Support for this was added in #583, the new docs are here: https://typer.tiangolo.com/tutorial/parameter-types/custom-types/, it's available in Typer 0.8.0, just released. 🎉

Given that, I'll close this one, but thanks for your effort! 🍰 🚀

@tiangolo tiangolo closed this May 1, 2023
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

Successfully merging this pull request may close these issues.

None yet

2 participants