skillfed

backports.shutil_get_terminal_size

A backport of the get_terminal_size function from Python 3.3's shutil.

backports-shutil-get-terminal-size v1.0.0 435.4K downloads/30d#6,681 on PyPI8
Permissive license MIT Abandoned released

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-size

uv

uv add backports-shutil-get-terminal-size

poetry

poetry add backports-shutil-get-terminal-size

Installing 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

Development Status :: 5 - Production/StableLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 2.6Programming Language :: Python :: 2.7Programming Language :: Python :: 3.2

Tags

terminal size detectionget terminal dimensionsterminal width heightshutil backportterminal columns linesterminal size python 2
legacyterminal-io

More Terminals packages