typer icon indicating copy to clipboard operation
typer copied to clipboard

[BUG] typer does not support click 8

Open ssbarnea opened this issue 3 years ago • 12 comments

Describe the bug

click 8 was finally released and typer does not support it, at least from https://github.com/tiangolo/typer/blob/master/pyproject.toml#L30 point of view.

ssbarnea avatar May 15 '21 14:05 ssbarnea

Here is one instance of what happens in case click 8 is installed atm:

❯ cruft update -c v1.0.0
Traceback (most recent call last):
  File "/usr/bin/cruft", line 33, in <module>
    sys.exit(load_entry_point('cruft==2.8.0', 'console_scripts', 'cruft')())
  File "/usr/bin/cruft", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.9/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 855, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/usr/lib/python3.9/site-packages/cruft/__init__.py", line 6, in <module>
    from cruft._commands import check, create, diff, link, update
  File "/usr/lib/python3.9/site-packages/cruft/_commands/__init__.py", line 2, in <module>
    from .check import check
  File "/usr/lib/python3.9/site-packages/cruft/_commands/check.py", line 6, in <module>
    import typer
  File "/usr/lib/python3.9/site-packages/typer/__init__.py", line 29, in <module>
    from .main import Typer as Typer
  File "/usr/lib/python3.9/site-packages/typer/main.py", line 11, in <module>
    from .completion import get_completion_inspect_parameters
  File "/usr/lib/python3.9/site-packages/typer/completion.py", line 10, in <module>
    import click._bashcomplete
ModuleNotFoundError: No module named 'click._bashcomplete'

languitar avatar May 17 '21 10:05 languitar

Yep, I found it myself but did not had time to investigate. Still we do need tracking ticket for this issue. This can cause real issues for cli authors which expect to install tools outside isolated virtualens (direct affect on those packaging them for linux distros).

Temporary I switched installing my typer based tool using pipx, but I do not expect everyone knowing or being able to the same. At least I am lucky that my typer tools has likely one user only.

ssbarnea avatar May 17 '21 11:05 ssbarnea

Just to cross-ref, this is essentially the same as https://github.com/tiangolo/typer/issues/278

StanczakDominik avatar May 25 '21 06:05 StanczakDominik

@tiangolo This is beginning to affect our production apps. Other applications, such as uvicorn will use click 8 and that will be pinned by a tool such as pip-tools in requirements.txt, but then we have some CLI tests in that use typer and pin click 7 in dev-requirements.txt. This makes reconciling them extra work.

johnthagen avatar Jun 22 '21 11:06 johnthagen

Fedora Linux just updated to click 8.x in the development version (Rawhide). I just added python-typer to the distribution a little less than two weeks ago, but I won’t be able to keep it there if a patch doesn’t surface in the next couple of months—at least a viable PR, if not a release. (It’s unlikely that I’ll have enough time to study both projects and develop the patch myself.)

musicinmybrain avatar Jun 30 '21 01:06 musicinmybrain

@tiangolo was involved in that change from click https://github.com/pallets/click/issues/1484

postmasters avatar Jul 19 '21 04:07 postmasters

I think we should just confirm that last commit was a year ago and author just doesn't have time to maintain the package.

arogozhnikov avatar Aug 07 '21 06:08 arogozhnikov

I think we should just confirm that last commit was a year ago and author just doesn't have time to maintain the package.

@tiangolo recently tweeted that he was hoping to speed up Typer (and FastAPI) development: https://github.com/tiangolo/typer/issues/300#issuecomment-891839986

Hopefully this means he'll be able to devote some time to Typer.

johnthagen avatar Aug 07 '21 11:08 johnthagen

Thanks for the interest and discussion everyone! :coffee:

I just released Typer 0.4.0, which is compatible with both Click 7 and Click 8. :tada:

tiangolo avatar Aug 30 '21 09:08 tiangolo

@tiangolo Thank you! ❤️

johnthagen avatar Aug 30 '21 11:08 johnthagen

should be closed?

patricksurry avatar Feb 21 '22 13:02 patricksurry

should be closed?

@patricksurry Yes.

johnthagen avatar Feb 21 '22 14:02 johnthagen

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

github-actions[bot] avatar May 01 '23 11:05 github-actions[bot]