Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] typer.main.get_group should return a click.Group #96

Open
dbanty opened this issue Apr 30, 2020 · 1 comment
Open

[BUG] typer.main.get_group should return a click.Group #96

dbanty opened this issue Apr 30, 2020 · 1 comment
Labels
bug good first issue

Comments

@dbanty
Copy link
Sponsor

@dbanty dbanty commented Apr 30, 2020

Describe the bug

The function typer.main.get_group is annotated as returning a click.Command which isn't wrong because a click.Group is a click.Command, but means I have to cast to group when trying to integrate with existing Click applications.

To Reproduce

Steps to reproduce the behavior with a minimum self-contained file.

Replace each part with your own scenario:

  • Create a file main.py with:
import typer

app = typer.Typer()


@app.callback()
def callback():
    """ My partially-upgraded-to-Typer app """

# insert some fancy new Typer commands here


click_group = typer.main.get_group(app)


@click_group.command()
def some_old_click_function():
      """ I need to rewrite this somday """

Run mypy on this script with mypy main.py and it will output something like

main.py:16: error: "Command" has no attribute "command"

Expected behavior

Able to drop in Typer at the top level to start slowly converting an existing Click app.

Screenshots

If applicable, add screenshots to help explain your problem.

Environment

  • OS: macOS
  • Typer Version: 0.2.1
  • Python version: 3.8.2
  • mypy version: 0.770
@mdaj06
Copy link

@mdaj06 mdaj06 commented Oct 11, 2020

@tiangolo could i take this up?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug good first issue
Projects
None yet
Development

No branches or pull requests

3 participants