[Python] Simple typer script gives TypeError

Discussão em 'Python' iniciado por Stack, Maio 11, 2025.

  1. Stack

    Stack Membro Participativo

    I think typer 0.15.3 (maybe earlier) is broken. I don't make this claim lightly. But if I create a very basic script, I get an error:

    pyproject.toml:

    [project]
    name = "typer-example"
    version = "0.1.0"
    description = "Add your description here"
    readme = "README.md"
    requires-python = ">=3.13"
    dependencies = [
    "typer>=0.15.3",
    ]


    main.py:

    import typer

    def main(name: str):
    print(f"Hello, {name}!")

    typer.run(main)


    ❯ uv run python main.py
    # ... stack trace
    TypeError: TyperArgument.make_metavar() takes 1 positional argument but 2 were given


    I expect default help output rather than a TypeError. Am I missing something? Or is typer broken as of 0.15.3?

    Continue reading...

Compartilhe esta Página