skillfed

linecache2

Backports of the linecache module

linecache2 v1.0.0 1.5M downloads/30d#3,799 on PyPI1
Permissive license UNKNOWN Abandoned released

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 linecache2

uv

uv add linecache2

poetry

poetry add linecache2

Installing 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

Development Status :: 6 - MatureIntended Audience :: DevelopersLicense :: OSI Approved :: Python Software Foundation LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.6Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.2Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Topic :: Software Development

Tags

linecache backportpython 2 linecachesource line cachinglegacy python compatibilityfile line access cachepython 2.6 2.7 support
legacypython-2

More Software Development packages