pathlib


Namepathlib JSON
Version 1.0.1 PyPI version JSON
download
home_pagehttps://pathlib.readthedocs.org/
SummaryObject-oriented filesystem paths
upload_time2014-09-03 15:41:57
maintainer
docs_urlNone
authorAntoine Pitrou
requires_pythonNone
licenseMIT License
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            **Attention:** this backport module isn't maintained anymore. If you want to report issues or contribute patches, please consider the `pathlib2 <https://pypi.python.org/pypi/pathlib2/>`_ project instead.

Description
-----------

pathlib offers a set of classes to handle filesystem paths.  It offers the
following advantages over using string objects:

* No more cumbersome use of os and os.path functions.  Everything can be
  done easily through operators, attribute accesses, and method calls.

* Embodies the semantics of different path types.  For example, comparing
  Windows paths ignores casing.

* Well-defined semantics, eliminating any warts or ambiguities (forward vs.
  backward slashes, etc.).

Requirements
------------

Python 3.2 or later is recommended, but pathlib is also usable with Python 2.7
and 2.6.

Install
-------

In Python 3.4, pathlib is now part of the standard library.  For Python 3.3
and earlier, ``easy_install pathlib`` or ``pip install pathlib`` should do
the trick.

Examples
--------

Importing the module classes::

   >>> from pathlib import *

Listing Python source files in a directory::

   >>> list(p.glob('*.py'))
   [PosixPath('test_pathlib.py'), PosixPath('setup.py'),
    PosixPath('pathlib.py')]

Navigating inside a directory tree::

   >>> p = Path('/etc')
   >>> q = p / 'init.d' / 'reboot'
   >>> q
   PosixPath('/etc/init.d/reboot')
   >>> q.resolve()
   PosixPath('/etc/rc.d/init.d/halt')

Querying path properties::

   >>> q.exists()
   True
   >>> q.is_dir()
   False

Opening a file::

   >>> with q.open() as f: f.readline()
   ...
   '#!/bin/bash\n'


Documentation
-------------

The full documentation can be read at `Read the Docs
<https://pathlib.readthedocs.org/>`_.


Contributing
------------

Main development now takes place in the Python standard library: see
the `Python developer's guide <http://docs.python.org/devguide/>`_, and
report issues on the `Python bug tracker <http://bugs.python.org/>`_.

However, if you find an issue specific to prior versions of Python
(such as 2.7 or 3.2), you can post an issue on the
`BitBucket project page <https://bitbucket.org/pitrou/pathlib/>`_.


History
-------

Version 1.0.1
^^^^^^^^^^^^^

- Pull request #4: Python 2.6 compatibility by eevee.

Version 1.0
^^^^^^^^^^^

This version brings ``pathlib`` up to date with the official Python 3.4
release, and also fixes a couple of 2.7-specific issues.

- Python issue #20765: Add missing documentation for PurePath.with_name()
  and PurePath.with_suffix().
- Fix test_mkdir_parents when the working directory has additional bits
  set (such as the setgid or sticky bits).
- Python issue #20111: pathlib.Path.with_suffix() now sanity checks the
  given suffix.
- Python issue #19918: Fix PurePath.relative_to() under Windows.
- Python issue #19921: When Path.mkdir() is called with parents=True, any
  missing parent is created with the default permissions, ignoring the mode
  argument (mimicking the POSIX "mkdir -p" command).
- Python issue #19887: Improve the Path.resolve() algorithm to support
  certain symlink chains.
- Make pathlib usable under Python 2.7 with unicode pathnames (only pure
  ASCII, though).
- Issue #21: fix TypeError under Python 2.7 when using new division.
- Add tox support for easier testing.

Version 0.97
^^^^^^^^^^^^

This version brings ``pathlib`` up to date with the final API specified
in :pep:`428`.  The changes are too long to list here, it is recommended
to read the `documentation <https://pathlib.readthedocs.org/>`_.

.. warning::
   The API in this version is partially incompatible with pathlib 0.8 and
   earlier.  Be sure to check your code for possible breakage!

Version 0.8
^^^^^^^^^^^

- Add PurePath.name and PurePath.anchor.
- Add Path.owner and Path.group.
- Add Path.replace().
- Add Path.as_uri().
- Issue #10: when creating a file with Path.open(), don't set the executable
  bit.
- Issue #11: fix comparisons with non-Path objects.

Version 0.7
^^^^^^^^^^^

- Add '**' (recursive) patterns to Path.glob().
- Fix openat() support after the API refactoring in Python 3.3 beta1.
- Add a *target_is_directory* argument to Path.symlink_to()

Version 0.6
^^^^^^^^^^^

- Add Path.is_file() and Path.is_symlink()
- Add Path.glob() and Path.rglob()
- Add PurePath.match()

Version 0.5
^^^^^^^^^^^

- Add Path.mkdir().
- Add Python 2.7 compatibility by Michele Lacchia.
- Make parent() raise ValueError when the level is greater than the path
  length.
            

Raw data

            {
    "_id": null,
    "home_page": "https://pathlib.readthedocs.org/",
    "name": "pathlib",
    "maintainer": "",
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": "",
    "keywords": "",
    "author": "Antoine Pitrou",
    "author_email": "solipsis@pitrou.net",
    "download_url": "https://files.pythonhosted.org/packages/ac/aa/9b065a76b9af472437a0059f77e8f962fe350438b927cb80184c32f075eb/pathlib-1.0.1.tar.gz",
    "platform": "UNKNOWN",
    "description": "**Attention:** this backport module isn't maintained anymore. If you want to report issues or contribute patches, please consider the `pathlib2 <https://pypi.python.org/pypi/pathlib2/>`_ project instead.\r\n\r\nDescription\r\n-----------\r\n\r\npathlib offers a set of classes to handle filesystem paths.  It offers the\r\nfollowing advantages over using string objects:\r\n\r\n* No more cumbersome use of os and os.path functions.  Everything can be\r\n  done easily through operators, attribute accesses, and method calls.\r\n\r\n* Embodies the semantics of different path types.  For example, comparing\r\n  Windows paths ignores casing.\r\n\r\n* Well-defined semantics, eliminating any warts or ambiguities (forward vs.\r\n  backward slashes, etc.).\r\n\r\nRequirements\r\n------------\r\n\r\nPython 3.2 or later is recommended, but pathlib is also usable with Python 2.7\r\nand 2.6.\r\n\r\nInstall\r\n-------\r\n\r\nIn Python 3.4, pathlib is now part of the standard library.  For Python 3.3\r\nand earlier, ``easy_install pathlib`` or ``pip install pathlib`` should do\r\nthe trick.\r\n\r\nExamples\r\n--------\r\n\r\nImporting the module classes::\r\n\r\n   >>> from pathlib import *\r\n\r\nListing Python source files in a directory::\r\n\r\n   >>> list(p.glob('*.py'))\r\n   [PosixPath('test_pathlib.py'), PosixPath('setup.py'),\r\n    PosixPath('pathlib.py')]\r\n\r\nNavigating inside a directory tree::\r\n\r\n   >>> p = Path('/etc')\r\n   >>> q = p / 'init.d' / 'reboot'\r\n   >>> q\r\n   PosixPath('/etc/init.d/reboot')\r\n   >>> q.resolve()\r\n   PosixPath('/etc/rc.d/init.d/halt')\r\n\r\nQuerying path properties::\r\n\r\n   >>> q.exists()\r\n   True\r\n   >>> q.is_dir()\r\n   False\r\n\r\nOpening a file::\r\n\r\n   >>> with q.open() as f: f.readline()\r\n   ...\r\n   '#!/bin/bash\\n'\r\n\r\n\r\nDocumentation\r\n-------------\r\n\r\nThe full documentation can be read at `Read the Docs\r\n<https://pathlib.readthedocs.org/>`_.\r\n\r\n\r\nContributing\r\n------------\r\n\r\nMain development now takes place in the Python standard library: see\r\nthe `Python developer's guide <http://docs.python.org/devguide/>`_, and\r\nreport issues on the `Python bug tracker <http://bugs.python.org/>`_.\r\n\r\nHowever, if you find an issue specific to prior versions of Python\r\n(such as 2.7 or 3.2), you can post an issue on the\r\n`BitBucket project page <https://bitbucket.org/pitrou/pathlib/>`_.\r\n\r\n\r\nHistory\r\n-------\r\n\r\nVersion 1.0.1\r\n^^^^^^^^^^^^^\r\n\r\n- Pull request #4: Python 2.6 compatibility by eevee.\r\n\r\nVersion 1.0\r\n^^^^^^^^^^^\r\n\r\nThis version brings ``pathlib`` up to date with the official Python 3.4\r\nrelease, and also fixes a couple of 2.7-specific issues.\r\n\r\n- Python issue #20765: Add missing documentation for PurePath.with_name()\r\n  and PurePath.with_suffix().\r\n- Fix test_mkdir_parents when the working directory has additional bits\r\n  set (such as the setgid or sticky bits).\r\n- Python issue #20111: pathlib.Path.with_suffix() now sanity checks the\r\n  given suffix.\r\n- Python issue #19918: Fix PurePath.relative_to() under Windows.\r\n- Python issue #19921: When Path.mkdir() is called with parents=True, any\r\n  missing parent is created with the default permissions, ignoring the mode\r\n  argument (mimicking the POSIX \"mkdir -p\" command).\r\n- Python issue #19887: Improve the Path.resolve() algorithm to support\r\n  certain symlink chains.\r\n- Make pathlib usable under Python 2.7 with unicode pathnames (only pure\r\n  ASCII, though).\r\n- Issue #21: fix TypeError under Python 2.7 when using new division.\r\n- Add tox support for easier testing.\r\n\r\nVersion 0.97\r\n^^^^^^^^^^^^\r\n\r\nThis version brings ``pathlib`` up to date with the final API specified\r\nin :pep:`428`.  The changes are too long to list here, it is recommended\r\nto read the `documentation <https://pathlib.readthedocs.org/>`_.\r\n\r\n.. warning::\r\n   The API in this version is partially incompatible with pathlib 0.8 and\r\n   earlier.  Be sure to check your code for possible breakage!\r\n\r\nVersion 0.8\r\n^^^^^^^^^^^\r\n\r\n- Add PurePath.name and PurePath.anchor.\r\n- Add Path.owner and Path.group.\r\n- Add Path.replace().\r\n- Add Path.as_uri().\r\n- Issue #10: when creating a file with Path.open(), don't set the executable\r\n  bit.\r\n- Issue #11: fix comparisons with non-Path objects.\r\n\r\nVersion 0.7\r\n^^^^^^^^^^^\r\n\r\n- Add '**' (recursive) patterns to Path.glob().\r\n- Fix openat() support after the API refactoring in Python 3.3 beta1.\r\n- Add a *target_is_directory* argument to Path.symlink_to()\r\n\r\nVersion 0.6\r\n^^^^^^^^^^^\r\n\r\n- Add Path.is_file() and Path.is_symlink()\r\n- Add Path.glob() and Path.rglob()\r\n- Add PurePath.match()\r\n\r\nVersion 0.5\r\n^^^^^^^^^^^\r\n\r\n- Add Path.mkdir().\r\n- Add Python 2.7 compatibility by Michele Lacchia.\r\n- Make parent() raise ValueError when the level is greater than the path\r\n  length.",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Object-oriented filesystem paths",
    "version": "1.0.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "f26b13acf298a15cdb46a3dffc8eb0de",
                "sha256": "f35f95ab8b0f59e6d354090350b44a80a80635d22efdedfa84c7ad1cf0a74147"
            },
            "downloads": -1,
            "filename": "pathlib-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f26b13acf298a15cdb46a3dffc8eb0de",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 14363,
            "upload_time": "2022-05-04T13:37:20",
            "upload_time_iso_8601": "2022-05-04T13:37:20.585901Z",
            "url": "https://files.pythonhosted.org/packages/78/f9/690a8600b93c332de3ab4a344a4ac34f00c8f104917061f779db6a918ed6/pathlib-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "5099ed48be9b1ee29b31c82819240537",
                "sha256": "6940718dfc3eff4258203ad5021090933e5c04707d5ca8cc9e73c94a7894ea9f"
            },
            "downloads": -1,
            "filename": "pathlib-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "5099ed48be9b1ee29b31c82819240537",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 49298,
            "upload_time": "2014-09-03T15:41:57",
            "upload_time_iso_8601": "2014-09-03T15:41:57.180220Z",
            "url": "https://files.pythonhosted.org/packages/ac/aa/9b065a76b9af472437a0059f77e8f962fe350438b927cb80184c32f075eb/pathlib-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2014-09-03 15:41:57",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "pathlib"
}
        
Elapsed time: 0.05447s