typer icon indicating copy to clipboard operation
typer copied to clipboard

click.utils has no attribute _expand_args (click version 7.1.2, typer version 0.6.1)

Open falcomomo opened this issue 2 years ago • 2 comments

First Check

  • [X] I added a very descriptive title to this issue.
  • [X] I used the GitHub search to find a similar issue and didn't find it.
  • [X] I searched the Typer documentation, with the integrated search.
  • [X] I already searched in Google "How to X in Typer" and didn't find any information.
  • [X] I already read and followed all the tutorial in the docs and didn't find an answer.
  • [X] I already checked if it is not related to Typer but to Click.

Commit to Help

  • [X] I commit to help with one of those options 👆

Example Code

import typer

def main(name: str):
    typer.echo(f'Hello {name}')


if __name__ == '__main__':
    typer.run(main)

Description

  • run python typer_script.py
  • On the typer.run() call: AttributeError: 'click.utils' has no attribute '_expand_args'

I was on typer version 0.6.1 and click version 7.1.2 (which meets the requirements for typer 0.6.1)

I updated to click version 8.0.4 and it's ok now.

In typer.core:190 you call click.utils._expand_args, but this was only added in click major version 8 from what I can tell.

Operating System

Windows

Operating System Details

No response

Typer Version

0.6.1

Python Version

3.6.13

Additional Context

None

falcomomo avatar Jul 14 '22 14:07 falcomomo

Is there any update on this?

parvva avatar Aug 26 '22 09:08 parvva

In the meantime, you can just add something along the lines of click>=8.0.0,<9.0.0 to your requirements.txt, setup.py, etc. depending on your use-case.

I opened a PR and hopefully @tiangolo can see this at some point even though it seems to only be affecting a few of us.

I wouldn't care that much except for the fact that CLIs are generally going to be installed outside of a virtualenv and other libraries may have previously installed a lower version (like what I ran into).

texasfight avatar Oct 06 '22 06:10 texasfight