skillfed

pathlib2

Object-oriented filesystem paths

pathlib2 v2.3.7.post1 4.4M downloads/30d#2,304 on PyPI86
Permissive license MIT DORMANT released

What it is and what it does

pathlib2 is a backport of Python's standard pathlib module, designed to bring modern path-handling APIs to older Python versions that predate pathlib's inclusion in the standard library. It provides an object-oriented interface for working with filesystem paths across platforms, replacing string-based path manipulation with a cleaner, more intuitive API. The package depends on six, scandir, and typing to maintain compatibility across Python 2.7 and early Python 3 releases.

The backport tracks the standard library's pathlib implementation, so features added to the standard module are eventually available through pathlib2 on older Python versions. However, it carries a known limitation: on Windows with Python 2.7, non-ASCII filename characters may be silently corrupted due to the platform's filesystem encoder having poor Unicode support. Development now occurs primarily in the Python standard library itself, making this package a maintenance-light compatibility shim rather than an actively developed project.

Use it for:

  • Migrate legacy Python 2.7 codebases to use modern pathlib syntax before upgrading to Python 3.
  • Maintain a single codebase across Python 2.7 and early Python 3.x versions using consistent path APIs.
  • Use pathlib's object-oriented path interface in projects that must support Python 3.5 or 3.6.
  • Backport pathlib features to environments where the standard library version is unavailable or outdated.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Backport of Python's standard pathlib module for older Python versions, providing object-oriented filesystem path manipulation.

No, unless you are maintaining legacy Python 2.7 or very early Python 3 code. Modern Python versions include pathlib in the standard library; use that instead. The package is stable and permissively licensed, but dormant maintenance and the availability of built-in pathlib make it unnecessary for new projects.

Install

pathlib2 on PyPI

pip

pip install pathlib2

uv

uv add pathlib2

poetry

poetry add pathlib2

Installing pathlib2

Before you install

Low install friction with a pure-Python wheel. Dormant maintenance status—last release was 2022-02-10 and last commit 2023-09-29—but the package is stable and tracks the standard library, so updates are infrequent by design.

License in practice

MIT license (permissive) allows use in commercial and open-source projects with minimal restrictions.

Quickstart

pip install pathlib2

from pathlib2 import Path
p = Path('/home/user/file.txt')
print(p.exists())

Intended for Python 2.7 and early Python 3.x; modern Python versions include pathlib in the standard library and should use that instead.

Verify before relying

  • Whether the package is still actively maintained or if it is effectively superseded by the standard library pathlib.
  • Current compatibility with Python versions beyond 3.9 and whether the package is tested against modern releases.
  • Whether the Windows Python 2.7 unicode filename issue (issue #56) remains unfixed and affects current users.

Package facts

License MIT (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 3 — six, scandir, typing
Maintenance dormant — 1,646 days since the last release
Last repo commit
First released
Downloads 4,426,297/month — #2,304 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pathlib2-2.3.7.post1-py2.py3-none-any.whl

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: LibrariesTopic :: System :: Filesystems

Tags

pathlib backportobject-oriented file pathsfilesystem path manipulationpython 2.7 pathliblegacy python path handlingcross-platform path operationspathlib older python versions
legacy-pythonbackport

More Libraries packages