path


Namepath JSON
Version 16.14.0 PyPI version JSON
download
home_pagehttps://github.com/jaraco/path
SummaryA module wrapper for os.path
upload_time2024-04-09 00:46:05
maintainerJason R. Coombs
docs_urlNone
authorJason Orendorff
requires_python>=3.8
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            .. image:: https://img.shields.io/pypi/v/path.svg
   :target: https://pypi.org/project/path

.. image:: https://img.shields.io/pypi/pyversions/path.svg

.. image:: https://github.com/jaraco/path/actions/workflows/main.yml/badge.svg
   :target: https://github.com/jaraco/path/actions?query=workflow%3A%22tests%22
   :alt: tests

.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
    :target: https://github.com/astral-sh/ruff
    :alt: Ruff

.. image:: https://readthedocs.org/projects/path/badge/?version=latest
   :target: https://path.readthedocs.io/en/latest/?badge=latest

.. image:: https://img.shields.io/badge/skeleton-2024-informational
   :target: https://blog.jaraco.com/skeleton

.. image:: https://tidelift.com/badges/package/pypi/path
   :target: https://tidelift.com/subscription/pkg/pypi-path?utm_source=pypi-path&utm_medium=readme


``path`` (aka path pie, formerly ``path.py``) implements path
objects as first-class entities, allowing common operations on
files to be invoked on those path objects directly. For example:

.. code-block:: python

    from path import Path

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

    # Globbing
    for f in d.files("*.py"):
        f.chmod("u+rwx")

    # Changing the working directory:
    with Path("somewhere"):
        # cwd in now `somewhere`
        ...

    # Concatenate paths with /
    foo_txt = Path("bar") / "foo.txt"

Path pie is `hosted at Github <https://github.com/jaraco/path>`_.

Find `the documentation here <https://path.readthedocs.io>`_.

Guides and Testimonials
=======================

Yasoob wrote the Python 101 `Writing a Cleanup Script
<http://freepythontips.wordpress.com/2014/01/23/python-101-writing-a-cleanup-script/>`_
based on ``path``.

Advantages
==========

Path pie provides a superior experience to similar offerings.

Python 3.4 introduced
`pathlib <https://docs.python.org/3/library/pathlib.html>`_,
which shares many characteristics with ``path``. In particular,
it provides an object encapsulation for representing filesystem paths.
One may have imagined ``pathlib`` would supersede ``path``.

But the implementation and the usage quickly diverge, and ``path``
has several advantages over ``pathlib``:

- ``path`` implements ``Path`` objects as a subclass of ``str``, and as a
  result these ``Path`` objects may be passed directly to other APIs that
  expect simple text representations of paths, whereas with ``pathlib``, one
  must first cast values to strings before passing them to APIs that do
  not honor `PEP 519 <https://www.python.org/dev/peps/pep-0519/>`_
  ``PathLike`` interface.
- ``path`` give quality of life features beyond exposing basic functionality
  of a path. ``path`` provides methods like ``rmtree`` (from shlib) and
  ``remove_p`` (remove a file if it exists), properties like ``.permissions``,
  and sophisticated ``walk``, ``TempDir``, and ``chmod`` behaviors.
- As a PyPI-hosted package, ``path`` is free to iterate
  faster than a stdlib package. Contributions are welcome
  and encouraged.
- ``path`` provides superior portability using a uniform abstraction
  over its single Path object,
  freeing the implementer to subclass it readily. One cannot
  subclass a ``pathlib.Path`` to add functionality, but must
  subclass ``Path``, ``PosixPath``, and ``WindowsPath``, even
  to do something as simple as to add a ``__dict__`` to the subclass
  instances.  ``path`` instead allows the ``Path.module``
  object to be overridden by subclasses, defaulting to the
  ``os.path``. Even advanced uses of ``path.Path`` that
  subclass the model do not need to be concerned with
  OS-specific nuances. ``path.Path`` objects are inherently "pure",
  not requiring the author to distinguish between pure and non-pure
  variants.

This path project has the explicit aim to provide compatibility
with ``pathlib`` objects where possible, such that a ``path.Path``
object is a drop-in replacement for ``pathlib.Path*`` objects.
This project welcomes contributions to improve that compatibility
where it's lacking.


Origins
=======

The ``path.py`` project was initially released in 2003 by Jason Orendorff
and has been continuously developed and supported by several maintainers
over the years.


For Enterprise
==============

Available as part of the Tidelift Subscription.

This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.

`Learn more <https://tidelift.com/subscription/pkg/pypi-path?utm_source=pypi-path&utm_medium=referral&utm_campaign=github>`_.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/jaraco/path",
    "name": "path",
    "maintainer": "Jason R. Coombs",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "jaraco@jaraco.com",
    "keywords": null,
    "author": "Jason Orendorff",
    "author_email": "jason.orendorff@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/46/30/1e1272907a0fab069a4290c3410066514b84d6f7df0723be5e138c5861f9/path-16.14.0.tar.gz",
    "platform": null,
    "description": ".. image:: https://img.shields.io/pypi/v/path.svg\n   :target: https://pypi.org/project/path\n\n.. image:: https://img.shields.io/pypi/pyversions/path.svg\n\n.. image:: https://github.com/jaraco/path/actions/workflows/main.yml/badge.svg\n   :target: https://github.com/jaraco/path/actions?query=workflow%3A%22tests%22\n   :alt: tests\n\n.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json\n    :target: https://github.com/astral-sh/ruff\n    :alt: Ruff\n\n.. image:: https://readthedocs.org/projects/path/badge/?version=latest\n   :target: https://path.readthedocs.io/en/latest/?badge=latest\n\n.. image:: https://img.shields.io/badge/skeleton-2024-informational\n   :target: https://blog.jaraco.com/skeleton\n\n.. image:: https://tidelift.com/badges/package/pypi/path\n   :target: https://tidelift.com/subscription/pkg/pypi-path?utm_source=pypi-path&utm_medium=readme\n\n\n``path`` (aka path pie, formerly ``path.py``) implements path\nobjects as first-class entities, allowing common operations on\nfiles to be invoked on those path objects directly. For example:\n\n.. code-block:: python\n\n    from path import Path\n\n    d = Path(\"/home/guido/bin\")\n    for f in d.files(\"*.py\"):\n        f.chmod(0o755)\n\n    # Globbing\n    for f in d.files(\"*.py\"):\n        f.chmod(\"u+rwx\")\n\n    # Changing the working directory:\n    with Path(\"somewhere\"):\n        # cwd in now `somewhere`\n        ...\n\n    # Concatenate paths with /\n    foo_txt = Path(\"bar\") / \"foo.txt\"\n\nPath pie is `hosted at Github <https://github.com/jaraco/path>`_.\n\nFind `the documentation here <https://path.readthedocs.io>`_.\n\nGuides and Testimonials\n=======================\n\nYasoob wrote the Python 101 `Writing a Cleanup Script\n<http://freepythontips.wordpress.com/2014/01/23/python-101-writing-a-cleanup-script/>`_\nbased on ``path``.\n\nAdvantages\n==========\n\nPath pie provides a superior experience to similar offerings.\n\nPython 3.4 introduced\n`pathlib <https://docs.python.org/3/library/pathlib.html>`_,\nwhich shares many characteristics with ``path``. In particular,\nit provides an object encapsulation for representing filesystem paths.\nOne may have imagined ``pathlib`` would supersede ``path``.\n\nBut the implementation and the usage quickly diverge, and ``path``\nhas several advantages over ``pathlib``:\n\n- ``path`` implements ``Path`` objects as a subclass of ``str``, and as a\n  result these ``Path`` objects may be passed directly to other APIs that\n  expect simple text representations of paths, whereas with ``pathlib``, one\n  must first cast values to strings before passing them to APIs that do\n  not honor `PEP 519 <https://www.python.org/dev/peps/pep-0519/>`_\n  ``PathLike`` interface.\n- ``path`` give quality of life features beyond exposing basic functionality\n  of a path. ``path`` provides methods like ``rmtree`` (from shlib) and\n  ``remove_p`` (remove a file if it exists), properties like ``.permissions``,\n  and sophisticated ``walk``, ``TempDir``, and ``chmod`` behaviors.\n- As a PyPI-hosted package, ``path`` is free to iterate\n  faster than a stdlib package. Contributions are welcome\n  and encouraged.\n- ``path`` provides superior portability using a uniform abstraction\n  over its single Path object,\n  freeing the implementer to subclass it readily. One cannot\n  subclass a ``pathlib.Path`` to add functionality, but must\n  subclass ``Path``, ``PosixPath``, and ``WindowsPath``, even\n  to do something as simple as to add a ``__dict__`` to the subclass\n  instances.  ``path`` instead allows the ``Path.module``\n  object to be overridden by subclasses, defaulting to the\n  ``os.path``. Even advanced uses of ``path.Path`` that\n  subclass the model do not need to be concerned with\n  OS-specific nuances. ``path.Path`` objects are inherently \"pure\",\n  not requiring the author to distinguish between pure and non-pure\n  variants.\n\nThis path project has the explicit aim to provide compatibility\nwith ``pathlib`` objects where possible, such that a ``path.Path``\nobject is a drop-in replacement for ``pathlib.Path*`` objects.\nThis project welcomes contributions to improve that compatibility\nwhere it's lacking.\n\n\nOrigins\n=======\n\nThe ``path.py`` project was initially released in 2003 by Jason Orendorff\nand has been continuously developed and supported by several maintainers\nover the years.\n\n\nFor Enterprise\n==============\n\nAvailable as part of the Tidelift Subscription.\n\nThis project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.\n\n`Learn more <https://tidelift.com/subscription/pkg/pypi-path?utm_source=pypi-path&utm_medium=referral&utm_campaign=github>`_.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A module wrapper for os.path",
    "version": "16.14.0",
    "project_urls": {
        "Homepage": "https://github.com/jaraco/path"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "659a25956c1e6ac785f9e4ffcd5e4c82f4b055696e20aa5331cc8386165b61e0",
                "md5": "dc4c17e8bb2f4b5dab752ca149070c9c",
                "sha256": "8ee37703cbdc7cc83835ed4ecc6b638226fb2b43b7b45f26b620589981a109a5"
            },
            "downloads": -1,
            "filename": "path-16.14.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dc4c17e8bb2f4b5dab752ca149070c9c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 25466,
            "upload_time": "2024-04-09T00:46:03",
            "upload_time_iso_8601": "2024-04-09T00:46:03.643730Z",
            "url": "https://files.pythonhosted.org/packages/65/9a/25956c1e6ac785f9e4ffcd5e4c82f4b055696e20aa5331cc8386165b61e0/path-16.14.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "46301e1272907a0fab069a4290c3410066514b84d6f7df0723be5e138c5861f9",
                "md5": "7ed268dcce44a9e8846082555e1973c0",
                "sha256": "dbaaa7efd4602fd6ba8d82890dc7823d69e5de740a6e842d9919b0faaf2b6a8e"
            },
            "downloads": -1,
            "filename": "path-16.14.0.tar.gz",
            "has_sig": false,
            "md5_digest": "7ed268dcce44a9e8846082555e1973c0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 50076,
            "upload_time": "2024-04-09T00:46:05",
            "upload_time_iso_8601": "2024-04-09T00:46:05.561069Z",
            "url": "https://files.pythonhosted.org/packages/46/30/1e1272907a0fab069a4290c3410066514b84d6f7df0723be5e138c5861f9/path-16.14.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-09 00:46:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jaraco",
    "github_project": "path",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "path"
}
        
Elapsed time: 0.24264s