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

Closed
dbanty opened this issue Apr 30, 2020 · 3 comments
Closed

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

dbanty opened this issue Apr 30, 2020 · 3 comments
Labels
answered bug Something isn't working good first issue Good for newcomers

Comments

@dbanty
Copy link

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 commented Oct 11, 2020

@tiangolo could i take this up?

alexreg added a commit to alexreg/typer-cloup that referenced this issue May 12, 2022
alexreg added a commit to alexreg/typer-cloup that referenced this issue May 13, 2022
alexreg added a commit to alexreg/typer-cloup that referenced this issue May 13, 2022
alexreg added a commit to alexreg/typer-cloup that referenced this issue May 13, 2022
alexreg added a commit to alexreg/typer-cloup that referenced this issue May 13, 2022
alexreg added a commit to alexreg/typer-cloup that referenced this issue May 15, 2022
alexreg added a commit to alexreg/typer-cloup that referenced this issue May 15, 2022
alexreg added a commit to alexreg/typer-cloup that referenced this issue Jun 17, 2022
alexreg added a commit to alexreg/typer-cloup that referenced this issue Jul 2, 2022
alexreg added a commit to alexreg/typer-cloup that referenced this issue Jul 9, 2022
@tiangolo
Copy link
Owner

Thank you! This should be solved in #430 , and will be available in the next release. 🤓

alexreg added a commit to alexreg/typer-cloup that referenced this issue Jul 21, 2022
@github-actions
Copy link

Assuming the original issue was solved, it will be automatically closed now. But feel free to add more comments or create new issues.

alexreg added a commit to alexreg/typer-cloup that referenced this issue Jul 31, 2022
alexreg added a commit to alexreg/typer-cloup that referenced this issue Aug 7, 2022
alexreg added a commit to alexreg/typer-cloup that referenced this issue Aug 8, 2022
alexreg added a commit to alexreg/typer-cloup that referenced this issue Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants