skillfed

path

A module wrapper for os.path

path v17.1.1 1.3M downloads/30d#4,105 on PyPI1,124
Permissive license MIT Active released

What it is and what it does

Path is a wrapper around os.path that implements filesystem paths as first-class objects with methods for common file operations. Instead of calling separate functions like os.chmod(path, mode), you invoke methods directly on Path instances: Path(path).chmod(mode). Path objects inherit from str, so they can be passed directly to APIs that expect string paths without explicit casting, unlike pathlib.Path objects which require PEP 519 PathLike support or manual str() conversion.

The package provides convenience methods beyond basic path operations—rmtree for recursive deletion, remove_p for conditional removal, permissions properties, and sophisticated walk and TempDir behaviors. It supports path concatenation with the / operator, context managers for temporary directory changes, and glob patterns. Path has been actively maintained since 2003 and aims to offer compatibility with pathlib where possible, while remaining freely iterable as a PyPI package rather than bound to Python's release cycle.

Use it for:

  • Write cleanup scripts that recursively remove files matching patterns with chmod and rmtree in a single fluent chain.
  • Pass Path objects directly to legacy APIs expecting string paths without intermediate str() conversions.
  • Traverse directory trees with glob patterns and apply batch file operations (permissions, deletion) in loops.
  • Subclass Path to add custom filesystem methods without managing OS-specific variants.
  • Use context managers to temporarily change working directory for a block of operations.

Worth the install?

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

Provides Path objects that wrap filesystem operations as methods, allowing direct invocation of file operations on path instances with a str-compatible interface.

Yes. Path is stable, actively maintained, has no vulnerabilities, and zero runtime dependencies. Install it if you prefer method-based path operations and need str-compatible path objects for legacy APIs. If you're already using pathlib and don't need str compatibility or custom subclassing, pathlib is the standard choice; otherwise, Path offers genuine advantages for filesystem scripting.

Install

path on PyPI

pip

pip install path

uv

uv add path

poetry

poetry add path

Installing path

Before you install

Low friction installation with no runtime dependencies. Active maintenance as of 2026-04-13, last release 2025-07-27, and no known vulnerabilities.

License in practice

MIT license permits commercial and private use with minimal restrictions; suitable for most projects.

Quickstart

from path import Path

d = Path("/home/user/bin")
for f in d.files("*.py"):
    f.chmod(0o755)

foo_txt = Path("bar") / "foo.txt"

Requires Python 3.9 or later.

Verify before relying

  • Whether Path objects remain fully backward-compatible with pathlib.Path in all use cases.
  • Performance characteristics compared to pathlib for large directory traversals.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 383 days since the last release
Last repo commit
First released
Downloads 1,289,838/month — #4,105 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: path-17.1.1-py3-none-any.whl

Development Status :: 5 - Production/StableIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyTopic :: Software Development :: Libraries :: Python Modules

Tags

filesystem path objectsos.path wrapperfile operations on pathspath manipulation librarypathlib alternativestring-compatible path objectsfile globbing and traversal
filesystem-operationspath-manipulation

More Python Modules packages