path


Namepath JSON
Version 17.0.0 PyPI version JSON
download
home_pageNone
SummaryA module wrapper for os.path
upload_time2024-07-27 10:46:56
maintainerNone
docs_urlNone
authorNone
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": null,
    "name": "path",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "\"Jason R. Coombs\" <jaraco@jaraco.com>",
    "keywords": null,
    "author": null,
    "author_email": "Jason Orendorff <jason.orendorff@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/ff/a3/5dac44ce60ad6543578736a5729c5c2130cdac1c3117c61aad0583c2e3c6/path-17.0.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": "17.0.0",
    "project_urls": {
        "Source": "https://github.com/jaraco/path"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "55495ffc63f96029e4f899d6caee9db40c445ded1bf15cb60b32d77363c2c8de",
                "md5": "d42d45b46d001bba7a86d2c3a9e066d9",
                "sha256": "b7309739c569e30110a34c6c812e582c09ff504c43e1232817410181838918ed"
            },
            "downloads": -1,
            "filename": "path-17.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d42d45b46d001bba7a86d2c3a9e066d9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 24831,
            "upload_time": "2024-07-27T10:46:54",
            "upload_time_iso_8601": "2024-07-27T10:46:54.700637Z",
            "url": "https://files.pythonhosted.org/packages/55/49/5ffc63f96029e4f899d6caee9db40c445ded1bf15cb60b32d77363c2c8de/path-17.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ffa35dac44ce60ad6543578736a5729c5c2130cdac1c3117c61aad0583c2e3c6",
                "md5": "b970d0bcde985133cae6926a02e496b9",
                "sha256": "e1540261d22df1416fb1b498b3b1ed5353a371a48fe197d66611bb01e7fab2d5"
            },
            "downloads": -1,
            "filename": "path-17.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "b970d0bcde985133cae6926a02e496b9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 49721,
            "upload_time": "2024-07-27T10:46:56",
            "upload_time_iso_8601": "2024-07-27T10:46:56.433251Z",
            "url": "https://files.pythonhosted.org/packages/ff/a3/5dac44ce60ad6543578736a5729c5c2130cdac1c3117c61aad0583c2e3c6/path-17.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-27 10:46:56",
    "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.71681s