jaraco.context


Namejaraco.context JSON
Version 6.0.1 PyPI version JSON
download
home_pageNone
SummaryUseful decorators and context managers
upload_time2024-08-20 03:39:27
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/jaraco.context.svg
   :target: https://pypi.org/project/jaraco.context

.. image:: https://img.shields.io/pypi/pyversions/jaraco.context.svg

.. image:: https://github.com/jaraco/jaraco.context/actions/workflows/main.yml/badge.svg
   :target: https://github.com/jaraco/jaraco.context/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/jaracocontext/badge/?version=latest
   :target: https://jaracocontext.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/jaraco.context
   :target: https://tidelift.com/subscription/pkg/pypi-jaraco.context?utm_source=pypi-jaraco.context&utm_medium=readme


Highlights
==========

See the docs linked from the badge above for the full details, but here are some features that may be of interest.

- ``ExceptionTrap`` provides a general-purpose wrapper for trapping exceptions and then acting on the outcome. Includes ``passes`` and ``raises`` decorators to replace the result of a wrapped function by a boolean indicating the outcome of the exception trap. See `this keyring commit <https://github.com/jaraco/keyring/commit/a85a7cbc6c909f8121660ed1f7b487f99a1c2bf7>`_ for an example of it in production.
- ``suppress`` simply enables ``contextlib.suppress`` as a decorator.
- ``on_interrupt`` is a decorator used by CLI entry points to affect the handling of a ``KeyboardInterrupt``. Inspired by `Lucretiel/autocommand#18 <https://github.com/Lucretiel/autocommand/issues/18>`_.
- ``pushd`` is similar to pytest's ``monkeypatch.chdir`` or path's `default context <https://path.readthedocs.io/en/latest/api.html>`_, changes the current working directory for the duration of the context.
- ``tarball`` will download a tarball, extract it, change directory, yield, then clean up after. Convenient when working with web assets.
- ``null`` is there for those times when one code branch needs a context and the other doesn't; this null context provides symmetry across those branches.


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-jaraco.context?utm_source=pypi-jaraco.context&utm_medium=referral&utm_campaign=github>`_.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "jaraco.context",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "\"Jason R. Coombs\" <jaraco@jaraco.com>",
    "download_url": "https://files.pythonhosted.org/packages/df/ad/f3777b81bf0b6e7bc7514a1656d3e637b2e8e15fab2ce3235730b3e7a4e6/jaraco_context-6.0.1.tar.gz",
    "platform": null,
    "description": ".. image:: https://img.shields.io/pypi/v/jaraco.context.svg\n   :target: https://pypi.org/project/jaraco.context\n\n.. image:: https://img.shields.io/pypi/pyversions/jaraco.context.svg\n\n.. image:: https://github.com/jaraco/jaraco.context/actions/workflows/main.yml/badge.svg\n   :target: https://github.com/jaraco/jaraco.context/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/jaracocontext/badge/?version=latest\n   :target: https://jaracocontext.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/jaraco.context\n   :target: https://tidelift.com/subscription/pkg/pypi-jaraco.context?utm_source=pypi-jaraco.context&utm_medium=readme\n\n\nHighlights\n==========\n\nSee the docs linked from the badge above for the full details, but here are some features that may be of interest.\n\n- ``ExceptionTrap`` provides a general-purpose wrapper for trapping exceptions and then acting on the outcome. Includes ``passes`` and ``raises`` decorators to replace the result of a wrapped function by a boolean indicating the outcome of the exception trap. See `this keyring commit <https://github.com/jaraco/keyring/commit/a85a7cbc6c909f8121660ed1f7b487f99a1c2bf7>`_ for an example of it in production.\n- ``suppress`` simply enables ``contextlib.suppress`` as a decorator.\n- ``on_interrupt`` is a decorator used by CLI entry points to affect the handling of a ``KeyboardInterrupt``. Inspired by `Lucretiel/autocommand#18 <https://github.com/Lucretiel/autocommand/issues/18>`_.\n- ``pushd`` is similar to pytest's ``monkeypatch.chdir`` or path's `default context <https://path.readthedocs.io/en/latest/api.html>`_, changes the current working directory for the duration of the context.\n- ``tarball`` will download a tarball, extract it, change directory, yield, then clean up after. Convenient when working with web assets.\n- ``null`` is there for those times when one code branch needs a context and the other doesn't; this null context provides symmetry across those branches.\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-jaraco.context?utm_source=pypi-jaraco.context&utm_medium=referral&utm_campaign=github>`_.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Useful decorators and context managers",
    "version": "6.0.1",
    "project_urls": {
        "Source": "https://github.com/jaraco/jaraco.context"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ffdb0c52c4cf5e4bd9f5d7135ec7669a3a767af21b3a308e1ed3674881e52b62",
                "md5": "f6457686dc21f042213377525b94640b",
                "sha256": "f797fc481b490edb305122c9181830a3a5b76d84ef6d1aef2fb9b47ab956f9e4"
            },
            "downloads": -1,
            "filename": "jaraco.context-6.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f6457686dc21f042213377525b94640b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 6825,
            "upload_time": "2024-08-20T03:39:25",
            "upload_time_iso_8601": "2024-08-20T03:39:25.966295Z",
            "url": "https://files.pythonhosted.org/packages/ff/db/0c52c4cf5e4bd9f5d7135ec7669a3a767af21b3a308e1ed3674881e52b62/jaraco.context-6.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dfadf3777b81bf0b6e7bc7514a1656d3e637b2e8e15fab2ce3235730b3e7a4e6",
                "md5": "bb22ef027077b1fa8528ef1d9840b838",
                "sha256": "9bae4ea555cf0b14938dc0aee7c9f32ed303aa20a3b73e7dc80111628792d1b3"
            },
            "downloads": -1,
            "filename": "jaraco_context-6.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "bb22ef027077b1fa8528ef1d9840b838",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 13912,
            "upload_time": "2024-08-20T03:39:27",
            "upload_time_iso_8601": "2024-08-20T03:39:27.358243Z",
            "url": "https://files.pythonhosted.org/packages/df/ad/f3777b81bf0b6e7bc7514a1656d3e637b2e8e15fab2ce3235730b3e7a4e6/jaraco_context-6.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-20 03:39:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jaraco",
    "github_project": "jaraco.context",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "jaraco.context"
}
        
Elapsed time: 0.74932s