backports.shutil_get_terminal_size
A backport of the get_terminal_size function from Python 3.3's shutil.
What it is and what it does
This package backports Python 3.3's shutil.get_terminal_size() function to earlier Python versions that lack it. It returns a named tuple containing the terminal's column count and line count, useful for terminal-aware applications that need to adapt output width and height.
The implementation is written in pure Python rather than C. The package has been abandoned since 2016 with no releases after 2014-08-19, and is primarily relevant for legacy Python 2 codebases; modern Python 3 versions include this function in the standard library.
Use it for:
- Detect terminal dimensions in Python 2.6 or 2.7 applications that format output for the current terminal width
- Build terminal-based CLI tools that need to wrap text or position output based on available columns and lines
- Support older Python versions in a codebase that must run across multiple Python generations
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides the get_terminal_size() function for Python versions that lack it natively, returning terminal dimensions as a named tuple of columns and lines.
No, unless you are maintaining legacy Python 2 code that requires terminal size detection and cannot upgrade to Python 3. For any modern codebase, use shutil.get_terminal_size() directly from the standard library. The package is abandoned and offers no advantages over the native implementation.
Install
backports-shutil-get-terminal-size on PyPI
pip
pip install backports-shutil-get-terminal-sizeuv
uv add backports-shutil-get-terminal-sizepoetry
poetry add backports-shutil-get-terminal-sizeInstalling backports.shutil_get_terminal_size
Before you install
Low install friction with no runtime dependencies. However, the package is abandoned—last commit was 2016-11-03 and no releases since 2014-08-19.
License in practice
MIT license is permissive and poses no restrictions on use, modification, or distribution in commercial or private projects.
Quickstart
from backports.shutil_get_terminal_size import get_terminal_size
size = get_terminal_size()
print(size.columns, size.lines)
Verify before relying
- Whether the pure-Python implementation handles all edge cases that the native C version covers
- Current compatibility with Python 2.6 and 2.7 environments still in active use
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 4,378 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 435,391/month — #6,681 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: backports.shutil_get_terminal_size-1.0.0-py2.py3-none-any.whl
Tags
More Terminals packages
Wraps any iterable to display a real-time…
copyleft · top 100 on PyPI
richRich renders styled text, tables, progress…
permissive · top 100 on PyPI
coloramaColorama makes ANSI escape sequences for…
permissive · top 100 on PyPI
wcwidthMeasures the displayed width of Unicode strings…
permissive · top 1,000 on PyPI
ptyprocessRun a subprocess in a pseudo terminal (pty) and…
permissive · top 1,000 on PyPI
pexpectPexpect spawns and controls interactive console…
permissive · top 1,000 on PyPI
pathlib3xBackport of Python 3.11 pathlib to Python 3.8+…
permissive · top 15,000 on PyPI
backports.sslProvides the Python 3.4 ssl module API on older…
permissive · top 15,000 on PyPI
textwrap3Backports Python 3.6's textwrap module to…
permissive · top 5,000 on PyPI
backports.zstdProvides Zstandard compression support for…
permissive · top 1,000 on PyPI
linecache2Provides a backport of Python's linecache…
permissive · top 5,000 on PyPI
traceback2Provides a backport of Python's traceback…
permissive · top 5,000 on PyPI
terminaltablesRenders formatted ASCII tables in terminal…
permissive · top 5,000 on PyPI
backports.functools-lru-cacheProvides the lru_cache decorator from Python…
permissive · top 5,000 on PyPI
zipfile36Provides a backport of Python 3.6's zipfile…
permissive · top 5,000 on PyPI