Skip to content

ImportError: cannot import name 'get_terminal_size' from 'click.termui' #377

@jmhummel

Description

@jmhummel

First Check

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

Commit to Help

  • I commit to help with one of those options 👆

Example Code

import typer

Description

  • Install latest versions of typer (0.4.0) and click (8.1.0)
  • Run script with single line import typer
  • Import fails due to method get_terminal_size having been removed in click 8.1.0 (remove deprecated code pallets/click#2130)
Traceback (most recent call last):
  File "test.py", line 1, in <module>
    import typer
  File "/.venv/lib/python3.8/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' (/.venv/lib/python3.8/site-packages/click/termui.py)

Operating System

Linux

Operating System Details

Ubunutu 20.04

Typer Version

0.4.0

Python Version

Python 3.8.10

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions