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

click latest release as a dependency to typer causes error #2230

Closed
stezskal opened this issue Mar 28, 2022 · 6 comments
Closed

click latest release as a dependency to typer causes error #2230

stezskal opened this issue Mar 28, 2022 · 6 comments

Comments

@stezskal
Copy link

Hi - I use typer and it has click as a dependency. The latest click release 8.1.0 does not work and gives the error below - 8.0.4 works so my workaround is to explicitly specify 8.0.4.

Traceback (most recent call last):
  File  line 158, in <module>
    import typer
  File "/lib/python3.7/site-packages/typer/__init__.py", line 12, in <module>
    from click.termui import get_terminal_size as get_terminal_size
    ImportError: cannot import name 'get_terminal_size' from 'click.termui' (/lib/python3.7/site-packages/click/termui.py)

I know it's not a lot of information but maybe it means something to developers here. Not sure if this is more appropriate to post as a typer issue.

@stezskal
Copy link
Author

This is already addressed in the typer repo.

@henryiii
Copy link
Contributor

Typer has not addressed this yet: tiangolo/typer#375 (and duplicates) are not in yet, much yet released.

Would something like this be acceptable to provide a transition period?

def get_terminal_size(*args, **kwargs):
    msg = "Deprecated, please use shutil.get_teriminal_size instead"
    warnings.warn(msg, FutureWarning, stacklevel=2)
    from shutil import get_terminal_size
    return get_terminal_size(*args, **kwargs)

All typer apps are broken at the moment, and this is not an underscore import, like the one that broke black. Just curious.

@davidism
Copy link
Member

This was already issuing a deprecation warning, documented as such in the changelog, and then documented as removed in the changelog.

Use a tool like pip-tools to pin your dependency tree and control when you get updates. Be sure to run your tests with deprecation warnings treated as errors so that you get notified of these types of changes early.

@davidism
Copy link
Member

The typer maintainer is currently at a conference, I'm sure they'll make a release when they get back and have the ability to.

@tiangolo
Copy link
Contributor

Hello! I just released Typer 0.4.1 that should handle this. 🚀 🤓

Thanks for the conversation and for understanding!

@pombredanne
Copy link
Contributor

pombredanne commented Apr 1, 2022

FWIW MO is that this and #2232 and psf/black#2964 and #2228 caused roughly 1/2 of the world's Python CI jobs to break ;)

Use a tool like pip-tools to pin your dependency tree and control when you get updates. Be sure to run your tests with deprecation warnings treated as errors so that you get notified of these types of changes early.

This is usually not an option as various libraries would pin on different versions and this will make things fail even more.

May I suggest this should have been a version 9 rather than a version 8.1?

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants