path
A module wrapper for os.path
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 pathuv
uv add pathpoetry
poetry add pathInstalling 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
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
path.pyProvides Path objects that wrap filesystem…
permissive · top 15,000 on PyPI
pathtoolsProvides pattern matching and utility functions…
permissive · top 15,000 on PyPI
UnipathUnipath provides an object-oriented interface…
permissive · top 15,000 on PyPI
fspathProvides a more intuitive Python API for…
agpl · top 15,000 on PyPI
dpathdpath lets you access, search, and modify…
permissive · top 5,000 on PyPI
pathlib-abcProvides abstract base classes for implementing…
permissive · top 1,000 on PyPI
pathlibProvides object-oriented filesystem path…
permissive · top 5,000 on PyPI
chialisp-stdlibProvides path access to Chialisp standard…
unclear · top 15,000 on PyPI
zippProvides a pathlib-compatible wrapper around…
permissive · top 100 on PyPI
pathmagicProvides File and Dir classes that wrap…
permissive · top 15,000 on PyPI