🐛 Ensure that typer.launch forwards correctly when launching a file#1708
Merged
tiangolo merged 4 commits intofastapi:masterfrom Apr 22, 2026
Merged
🐛 Ensure that typer.launch forwards correctly when launching a file#1708tiangolo merged 4 commits intofastapi:masterfrom
typer.launch forwards correctly when launching a file#1708tiangolo merged 4 commits intofastapi:masterfrom
Conversation
svlandeg
commented
Apr 20, 2026
| typer.launch("not a url") | ||
|
|
||
| launch_mock.assert_called_once_with("not a url") | ||
| launch_mock.assert_called_once_with("not a url", wait=False, locate=False) |
Member
Author
There was a problem hiding this comment.
The original test would fail with this PR and needs to be adjusted. False is the default value for both of these parameters so it's correct that those are now getting forwarded when calling typer.launch.
tiangolo
approved these changes
Apr 22, 2026
Member
tiangolo
left a comment
There was a problem hiding this comment.
Nice! Thank you! 🙌
This will be available in Typer 0.24.2, released in the next few hours. 🚀
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The current code in
main.pydidn't forward thelocateandwaitarguments to click. When launching a file and settinglocate=True, Click would open a file manager instead of launching the file directly. The Typer docstring indicate the same behaviour is targeted.From the added unit test in this PR, we see this isn't actually happening on
master. When forwarding the arguments correctly, the behaviour is as expected.Running this test on Windows only because it doesn't feel necessary to mock this behaviour for the various OS's.