linecache2
Backports of the linecache module
What it is and what it does
linecache2 is a backport of Python's standard linecache module designed for Python 2.6, 2.7, and Python 3.2, 3.3, 3.4. It provides the same interface as the standard library's linecache, which caches and retrieves lines from source files—useful for tools that need to display or inspect source code at runtime, such as debuggers, profilers, and error handlers.
The package has been unmaintained since its last commit on 2017-09-01 and its repository is archived. It exists primarily for legacy codebases still running on Python 2 or very early Python 3 versions. Installation is straightforward with no external dependencies.
Use it for:
- Debugging tools or error handlers on Python 2.7 that need to retrieve and display source code lines.
- Profilers or tracing utilities targeting Python 2.6–3.4 that require cached line information.
- Legacy application maintenance when upgrading linecache functionality is not feasible.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a backport of Python's linecache module for older Python versions, allowing code to access cached line information from source files across Python 2 and early Python 3 releases.
No. The package targets Python versions that are no longer supported and has been abandoned since 2017-09-01. Modern Python includes linecache in the standard library. Install only if maintaining a legacy codebase on Python 2.6, 2.7, 3.2, 3.3, or 3.4 that explicitly requires this backport.
Install
linecache2 on PyPI
pip
pip install linecache2uv
uv add linecache2poetry
poetry add linecache2Installing linecache2
Before you install
Installation is frictionless with no runtime dependencies, but the package has been abandoned since 2017-09-01 and its repository is archived.
License in practice
Licensed under the Python Software Foundation License (permissive), which poses no legal barrier to use.
Quickstart
pip install linecache2
import linecache2 as linecache
linecache.getline('path/to/file.py', 1)
Verify before relying
- Whether linecache2 is still necessary given that Python 2.6, 2.7, 3.2, 3.3, and 3.4 are no longer officially supported.
- Whether the backported implementation matches current linecache behavior in modern Python versions.
Package facts
| License | UNKNOWN (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 4,179 days since the last release |
| Last repo commit | (repository archived) |
| First released | |
| Downloads | 1,535,864/month — #3,799 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: linecache2-1.0.0-py2.py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
traceback2Provides a backport of Python's traceback…
permissive · top 5,000 on PyPI
backports.tempfileProvides the TemporaryDirectory context manager…
permissive · top 5,000 on PyPI
inspect2Provides the Python 3.6 inspect module API on…
permissive · top 15,000 on PyPI
contextlib2contextlib2 backports the Python standard…
permissive · top 5,000 on PyPI
HTMLParserProvides HTMLParser from Python 2.7 as a…
permissive · top 15,000 on PyPI
functools32Backport of Python 3.2's functools module…
permissive · top 15,000 on PyPI
importlibProvides importlib.import_module() for Python…
unclear · top 15,000 on PyPI
backports_abcProvides backports of abstract base classes…
permissive · top 15,000 on PyPI
backports.sslProvides the Python 3.4 ssl module API on older…
permissive · top 15,000 on PyPI
weakrefmethodProvides a WeakMethod class for storing bound…
permissive · top 15,000 on PyPI