Skip to content

[FEATURE] [BUG] Behavior of app with single command is inconsistent if added to another app #1073

Answered by patrick91
graue70 asked this question in Questions
Discussion options

You must be logged in to vote

With Typer 0.15.0 you can now omit name when using add_typer and get this behavior, see:

# welcome.py
import typer


app = typer.Typer()


@app.command()
def welcome():  # this will be the name for this command
    typer.echo("Hello World!")


if __name__ == "__main__":
    app()
# parent.py
import typer

import welcome


app = typer.Typer()
app.add_typer(welcome.app)


@app.command()
def main():
    typer.echo("Hello parent app!")


if __name__ == "__main__":
    app()

Replies: 8 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by tiangolo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature, enhancement or request
8 participants
Converted from issue

This discussion was converted from issue #243 on December 03, 2024 15:51.