contextlib2


Namecontextlib2 JSON
Version 21.6.0 PyPI version JSON
download
home_pagehttp://contextlib2.readthedocs.org
SummaryBackports and enhancements for the contextlib module
upload_time2021-06-27 06:54:40
maintainer
docs_urlNone
authorNick Coghlan
requires_python>=3.6
licensePSF License
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. image:: https://jazzband.co/static/img/badge.svg
   :target: https://jazzband.co/
   :alt: Jazzband

.. image:: https://github.com/jazzband/contextlib2/workflows/Test/badge.svg
   :target: https://github.com/jazzband/contextlib2/actions
   :alt: Tests

.. image:: https://codecov.io/gh/jazzband/contextlib2/branch/master/graph/badge.svg
   :target: https://codecov.io/gh/jazzband/contextlib2
   :alt: Coverage

.. image:: https://readthedocs.org/projects/contextlib2/badge/?version=latest
   :target: https://contextlib2.readthedocs.org/
   :alt: Latest Docs

contextlib2 is a backport of the `standard library's contextlib
module <https://docs.python.org/3/library/contextlib.html>`_ to
earlier Python versions.

It also sometimes serves as a real world proving ground for possible future
enhancements to the standard library version.

Licensing
---------

As a backport of Python standard library software, the implementation, test
suite and other supporting files for this project are distributed under the
Python Software License used for the CPython reference implementation.

The one exception is the included type hints file, which comes from the
``typeshed`` project, and is hence distributed under the Apache License 2.0.

Development
-----------

contextlib2 has no runtime dependencies, but requires ``setuptools`` and
``wheel`` at build time to generate universal wheel archives.

Local testing is a matter of running::

    python3 -m unittest discover -t . -s test

You can test against multiple versions of Python with
`tox <https://tox.testrun.org/>`_::

    pip install tox
    tox

Versions currently tested in both tox and GitHub Actions are:

* CPython 3.6
* CPython 3.7
* CPython 3.8
* CPython 3.9
* CPython 3.10
* PyPy3

Updating to a new stdlib reference version
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

As of Python 3.10, 4 files needed to be copied from the CPython reference
implementation to contextlib2:

* ``Doc/contextlib.rst`` -> ``docs/contextlib2.rst``
* ``Lib/contextlib.py`` -> ``contextlib2/__init__.py``
* ``Lib/test/test_contextlib.py`` -> ``test/test_contextlib.py``
* ``Lib/test/test_contextlib_async.py`` -> ``test/test_contextlib_async.py``

The corresponding version of ``contextlib2/__init__.pyi`` also needs to be
retrieved from the ``typeshed`` project::

    wget https://raw.githubusercontent.com/python/typeshed/master/stdlib/contextlib.pyi

For the 3.10 sync, the only changes needed to the test files were to import from
``contextlib2`` rather than ``contextlib``. The test directory is laid out so
that the test suite's imports from ``test.support`` work the same way they do in
the main CPython test suite.

The following patch files are saved in the ``dev`` directory:

* changes made to ``contextlib2/__init__.py`` to get it to run on the older
  versions (and to add back in the deprecated APIs that never graduated to
  the standard library version)
* changes made to ``contextlib2/__init__.pyi`` to make the Python version
  guards unconditional (since the ``contextlib2`` API is the same on all
  supported versions)
* changes made to ``docs/contextlib2.rst`` to use ``contextlib2`` version
  numbers in the version added/changed notes and to integrate the module
  documentation with the rest of the project documentation



            

Raw data

            {
    "_id": null,
    "home_page": "http://contextlib2.readthedocs.org",
    "name": "contextlib2",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "",
    "author": "Nick Coghlan",
    "author_email": "ncoghlan@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c7/13/37ea7805ae3057992e96ecb1cffa2fa35c2ef4498543b846f90dd2348d8f/contextlib2-21.6.0.tar.gz",
    "platform": "",
    "description": ".. image:: https://jazzband.co/static/img/badge.svg\n   :target: https://jazzband.co/\n   :alt: Jazzband\n\n.. image:: https://github.com/jazzband/contextlib2/workflows/Test/badge.svg\n   :target: https://github.com/jazzband/contextlib2/actions\n   :alt: Tests\n\n.. image:: https://codecov.io/gh/jazzband/contextlib2/branch/master/graph/badge.svg\n   :target: https://codecov.io/gh/jazzband/contextlib2\n   :alt: Coverage\n\n.. image:: https://readthedocs.org/projects/contextlib2/badge/?version=latest\n   :target: https://contextlib2.readthedocs.org/\n   :alt: Latest Docs\n\ncontextlib2 is a backport of the `standard library's contextlib\nmodule <https://docs.python.org/3/library/contextlib.html>`_ to\nearlier Python versions.\n\nIt also sometimes serves as a real world proving ground for possible future\nenhancements to the standard library version.\n\nLicensing\n---------\n\nAs a backport of Python standard library software, the implementation, test\nsuite and other supporting files for this project are distributed under the\nPython Software License used for the CPython reference implementation.\n\nThe one exception is the included type hints file, which comes from the\n``typeshed`` project, and is hence distributed under the Apache License 2.0.\n\nDevelopment\n-----------\n\ncontextlib2 has no runtime dependencies, but requires ``setuptools`` and\n``wheel`` at build time to generate universal wheel archives.\n\nLocal testing is a matter of running::\n\n    python3 -m unittest discover -t . -s test\n\nYou can test against multiple versions of Python with\n`tox <https://tox.testrun.org/>`_::\n\n    pip install tox\n    tox\n\nVersions currently tested in both tox and GitHub Actions are:\n\n* CPython 3.6\n* CPython 3.7\n* CPython 3.8\n* CPython 3.9\n* CPython 3.10\n* PyPy3\n\nUpdating to a new stdlib reference version\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nAs of Python 3.10, 4 files needed to be copied from the CPython reference\nimplementation to contextlib2:\n\n* ``Doc/contextlib.rst`` -> ``docs/contextlib2.rst``\n* ``Lib/contextlib.py`` -> ``contextlib2/__init__.py``\n* ``Lib/test/test_contextlib.py`` -> ``test/test_contextlib.py``\n* ``Lib/test/test_contextlib_async.py`` -> ``test/test_contextlib_async.py``\n\nThe corresponding version of ``contextlib2/__init__.pyi`` also needs to be\nretrieved from the ``typeshed`` project::\n\n    wget https://raw.githubusercontent.com/python/typeshed/master/stdlib/contextlib.pyi\n\nFor the 3.10 sync, the only changes needed to the test files were to import from\n``contextlib2`` rather than ``contextlib``. The test directory is laid out so\nthat the test suite's imports from ``test.support`` work the same way they do in\nthe main CPython test suite.\n\nThe following patch files are saved in the ``dev`` directory:\n\n* changes made to ``contextlib2/__init__.py`` to get it to run on the older\n  versions (and to add back in the deprecated APIs that never graduated to\n  the standard library version)\n* changes made to ``contextlib2/__init__.pyi`` to make the Python version\n  guards unconditional (since the ``contextlib2`` API is the same on all\n  supported versions)\n* changes made to ``docs/contextlib2.rst`` to use ``contextlib2`` version\n  numbers in the version added/changed notes and to integrate the module\n  documentation with the rest of the project documentation\n\n\n",
    "bugtrack_url": null,
    "license": "PSF License",
    "summary": "Backports and enhancements for the contextlib module",
    "version": "21.6.0",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "60a6b4ed6c8e75ba8d02f3d5562bc0e5",
                "sha256": "3fbdb64466afd23abaf6c977627b75b6139a5a3e8ce38405c5b413aed7a0471f"
            },
            "downloads": -1,
            "filename": "contextlib2-21.6.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "60a6b4ed6c8e75ba8d02f3d5562bc0e5",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.6",
            "size": 13277,
            "upload_time": "2021-06-27T06:54:20",
            "upload_time_iso_8601": "2021-06-27T06:54:20.972809Z",
            "url": "https://files.pythonhosted.org/packages/76/56/6d6872f79d14c0cb02f1646cbb4592eef935857c0951a105874b7b62a0c3/contextlib2-21.6.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "dcdca610617ab7fffc6fd99665567987",
                "sha256": "ab1e2bfe1d01d968e1b7e8d9023bc51ef3509bba217bb730cee3827e1ee82869"
            },
            "downloads": -1,
            "filename": "contextlib2-21.6.0.tar.gz",
            "has_sig": false,
            "md5_digest": "dcdca610617ab7fffc6fd99665567987",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 43795,
            "upload_time": "2021-06-27T06:54:40",
            "upload_time_iso_8601": "2021-06-27T06:54:40.841178Z",
            "url": "https://files.pythonhosted.org/packages/c7/13/37ea7805ae3057992e96ecb1cffa2fa35c2ef4498543b846f90dd2348d8f/contextlib2-21.6.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-06-27 06:54:40",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "contextlib2"
}
        
Elapsed time: 0.01641s