Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Typer allows passing a
default_factory
to options and arguments, which is a callable that will be used at runtime to determine the default value. Typer sets the option'sdefault
on the Click command object to the supplied factory value.The Textual application created by Trogon crashes when this is used, because it tries to convert the str representation of the callable function for display when it should be converting the result of calling that function instead.
I don't think I fully understand why this crash occurs, since it appears that Trogon properly handles a default Click application when an option's default is e.g. a
lambda
. Perhaps Typer is missing something in its translation ofdefault_factory
to Click'sdefault
, and I'm open to filing an issue/opening a PR on their end if it appears that's the case, but I'd need help in better understanding it!