pathlib-abc is a Python library that provides abstract base classes (ABCs) for `pathlib.Path`-like objects. It serves as a backport and preview of `pathlib` functionality intended for future Python standard library releases, specifically designed to enable path implementations for non-local filesystems (e.g., archives, remote storage). The library is currently at version 0.5.2 and is under active development, requiring Python 3.9+.
pip install pathlib-abcVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to create a custom path class by inheriting from `JoinablePath` and implementing the necessary abstract methods. It shows basic path manipulation using the overloaded division operator and accessing path components like `parent` and `name`.
Do not assume direct inheritance from standard `pathlib` types. Implementations using `pathlib-abc` should define their own class hierarchies or explicitly cast/convert if `pathlib.Path` compatibility is needed.
Regularly review the `pathlib-abc` changelog and documentation for updates. Pin exact versions in production environments to avoid unexpected changes.
For consistent and stable usage across Python versions, always use `pathlib-abc` from PyPI when implementing custom path classes for non-local filesystems. Avoid importing from `pathlib._abc` in the standard library.
pip install pathlib-abc
Subclass the desired `pathlib-abc` ABC (e.g., `JoinablePath`) and implement all its required abstract methods within your custom path class.
Update your custom path class to inherit from `pathlib-abc`'s `JoinablePath`, `ReadablePath`, or `WritablePath` ABCs instead of relying on `pathlib`'s internal structure.
Implement the unsupported method in your custom `pathlib-abc` subclass if the operation is feasible for your specific non-local filesystem, or handle the `UnsupportedOperation` exception gracefully if the operation is genuinely not supported by your custom path's backend.
No dependency data recorded yet.