typer
typer copied to clipboard
[BUG] typer does not support click 8
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.
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'
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.
Just to cross-ref, this is essentially the same as https://github.com/tiangolo/typer/issues/278
@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.
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.)
@tiangolo was involved in that change from click
https://github.com/pallets/click/issues/1484
I think we should just confirm that last commit was a year ago and author just doesn't have time to maintain the package.
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.
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 Thank you! ❤️
should be closed?
should be closed?
@patricksurry Yes.
Assuming the original issue was solved, it will be automatically closed now. But feel free to add more comments or create new issues.