馃悰 Use the first app or function defined in the file in the typer command - #1952
Open
lenamonj wants to merge 1 commit into
Open
馃悰 Use the first app or function defined in the file in the typer command#1952lenamonj wants to merge 1 commit into
lenamonj wants to merge 1 commit into
Conversation
lenamonj
force-pushed
the
fix-typer-command-app-order
branch
from
September 4, 2026 01:58
30793ab to
52fc347
Compare
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
typercommand picks "any Typer app" and "any function" by iterating asetof module names, so which one runs depends on the process hash seed. A file that defineszeta = typer.Typer()and thenalpha = typer.Typer()runsalphaon five of eightPYTHONHASHSEEDvalues andzetaon the other three. The docs promise "the first Typer app available in the file, with any name" and "the first function in the file".This iterates the module's names in definition order instead, and the any-name function fallback accepts only functions defined in that file, so an imported callable such as
pathlib.Pathcan no longer be picked.Two new tests run each asset under eight hash seeds; both fail on
masterand pass with the change.scripts/test.sh(1382 passed) andscripts/lint.share clean.