Access to underlying click capabilities in the vendored click world #1816
-
First Check
Example Code# how should I do this?
class LocatorParser(click.ParamType):
# weirdly the name field is the thing that gets printed in the help message as the type
name = "text"
def convert(self, value: str, param, ctx) -> Locator:
# my custom conversion logic goes here
return Locator("blah")
## or, how about this?
from click import get_current_context
def my_method_that_might_result_in_needing_to_reinvoke():
if my_condition_to_reinvoke:
ctx = get_current_context()
ctx.invoke(ctx.command, *ctx.args, **ctx.params)DescriptionWhat is the recommended approach for accessing click internals now that it's bundled in typer? Is there a canonical way to do things like override param types? Operating SystemmacOS Operating System DetailsNo response Project Version0.26.5 Python Version3.13.12 Additional ContextThank you. This project is awesome |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Hi! We strongly recommend against using any functions/methods from the We want to carefully reconsider which Click functionality we want to keep in the future. When it's things we want to keep, we'll expand the Typer codebase and documentation to cover it clearly. When it's things we don't want to keep, we're likely to remove them from the vendored code. If there are Click capabilities not currently covered by Typer's public API, I suggest you create a separate Discussion thread for each such piece of functionality. Explain what exactly you'd want and why, and what it could look like. We'll then discuss whether this is something we'll want to support in the future, and we can take it from there. |
Beta Was this translation helpful? Give feedback.
Hi!
We strongly recommend against using any functions/methods from the
typer/_clickmodule (in 0.26.0+) directly, as these will be subject to change in the near future. There's a high chance we will refactor theContextstuff, too.We want to carefully reconsider which Click functionality we want to keep in the future. When it's things we want to keep, we'll expand the Typer codebase and documentation to cover it clearly. When it's things we don't want to keep, we're likely to remove them from the vendored code.
If there are Click capabilities not currently covered by Typer's public API, I suggest you create a separate Discussion thread for each such piece of functionality. Explain what e…