This library provides a pure Python backport of the `get_terminal_size` function, originally introduced in Python 3.3's `shutil` module. It allows applications targeting older Python versions (like Python 2.6, 2.7, and 3.2) to access terminal dimension information. Currently at version 1.0.0, the package was last updated in 2014, indicating a stable, low-cadence release cycle typical for a compatibility backport.
pip install backports-shutil-get-terminal-sizeVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to import and use the `get_terminal_size` function to retrieve the current terminal's column and line dimensions. The function returns a `terminal_size` named tuple with `columns` and `lines` attributes.
For Python 3.3+, use `from shutil import get_terminal_size` directly. This backport is for compatibility with older Python environments.
No direct fix for performance; this is an inherent characteristic of the backport. Prefer the native `shutil.get_terminal_size` on Python 3.3+ for optimal performance.
Ensure `backports-shutil-get-terminal-size` is installed in an isolated virtual environment. If using `conda`, try `conda install backports.shutil_get_terminal_size` or re-installing `ipython` if the issue arises in that context. Verify correct import path `from backports.shutil_get_terminal_size import get_terminal_size`.
Ensure the package is correctly installed using `pip install backports.shutil_get_terminal_size` or, if using Anaconda, `conda install backports.shutil_get_terminal_size` after adding the `conda-forge` channel. If problems persist, try reinstalling the dependent package (e.g., IPython) or setting up a clean virtual environment.
Verify that `backports.shutil_get_terminal_size` is installed correctly. For Python versions 3.3 and above, you should directly import `get_terminal_size` from the standard `shutil` module, as the backport is unnecessary. If on older Python, ensure the backport is installed and reachable by the Python path.
Upgrade your `pip` and `setuptools` to the latest versions using `pip install --upgrade pip setuptools`. If the issue persists, consider installing the package directly from its GitHub source or using a package manager like `conda` if available.
Ensure that if `backports.shutil_get_terminal_size` is a dependency, it is properly installed. If you are on Python 3.3 or newer, the `shutil.get_terminal_size` function is built-in and the backports library is not required; check if a dependent library is unnecessarily trying to use the backport.
No dependency data recorded yet.