https://github.com/uyar/pathstring
String with path operations.
https://github.com/uyar/pathstring
path pathlib
Last synced: 2 months ago
JSON representation
String with path operations.
- Host: GitHub
- URL: https://github.com/uyar/pathstring
- Owner: uyar
- License: bsd-3-clause
- Archived: true
- Created: 2019-03-27T08:03:38.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-04-21T21:25:26.000Z (almost 2 years ago)
- Last Synced: 2025-09-30T17:56:00.573Z (6 months ago)
- Topics: path, pathlib
- Language: Python
- Size: 121 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGES.rst
- License: LICENSE.txt
Awesome Lists containing this project
README
pathstring
==========
pathstring is a very small module that provides only one class
(``pathstring.Path``) which is a string with support for path operations.
Technically, it subclasses ``str`` and delegates path related operations to
``pathlib.Path``.
Differences from pathlib paths are:
- Paths are strings, no need to cast them to strings.
- No distinction between "pure" and "concrete" paths.
- No explicit distinction between Posix and Windows paths, but paths are
always "native" to their platform.
- Adds a ``Path.rmtree()`` method which invokes ``shutil.rmtree()``
on the path. Actually, since paths are strings, ``shutil.rmtree(path)``
will also work.
- Supports the ``walk_up`` parameter to the ``Path.relative_to()`` method
which, when set to ``True``, will also navigate "up" in the hierarchy.
- No support for case-insensitive comparisons on Windows.
- No ``Path.replace()`` method since it would cause confusion with
``str.replace()``.
Features are tested extensively against `pathlib documentation`_ to guarantee
compatibility.
License
-------
Copyright (C) 2019-2024 H. Turgut Uyar
pathstring is released under the BSD license. Read the included
``LICENSE.txt`` file for details.
.. _pathlib documentation: https://docs.python.org/3/library/pathlib.html