$npx skillfedfor your agent

jaraco.context

Useful decorators and context managers

Worth itPyPI Released Mar 2026215.4M downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — jaraco_context-6.1.2-py3-none-any.whl
v6.1.2 · released 2026-03-20 · Python >=3.10 · 1 runtime deps: backports.tarfile

Yes. jaraco.context is a lightweight, actively maintained utility library with no security issues, a permissive license, and low install friction. It's worth installing if you regularly use exception traps, context managers for directory changes, or tarball extraction in your code—it reduces boilerplate and improves readability. Skip it if your codebase doesn't use these patterns.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python 3.10 or later.
  • Low install friction with a single runtime dependency (backports.tarfile).
  • The package is actively maintained with a recent release and has been stable since its initial release in 2014.

License · maintenance · safety

MIT (permissive) — MIT license permits use in commercial and private projects with minimal restrictions; attribution required.

last release 2026-03-20 (147 days) · last repo commit 2026-05-03 · 3 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 215,370,078 downloads/mo, #190 on PyPI

Verify before relying

pip install jaraco.context

from jaraco.context import ExceptionTrap

with ExceptionTrap() as trap:
    result = some_function()
if trap.exception:
    handle_error(trap.exception)
  • Whether backports.tarfile is a compiled dependency or pure Python.
  • Performance characteristics when handling large tarballs or many context switches.
Same gist for agents: .md · .json

What it is and what it does

jaraco.context is a collection of decorators and context managers that simplify common control-flow patterns in Python. It wraps exception handling, directory changes, and resource cleanup into reusable, composable utilities. The package's main components include ExceptionTrap for capturing and acting on exceptions, suppress as a decorator form of contextlib.suppress, on_interrupt for CLI keyboard handling, pushd for temporary directory changes, tarball for downloading and extracting archives, and null for conditional context symmetry.

The package is designed for developers who want to reduce boilerplate around exception handling and resource management. It's particularly useful in CLI tools, testing code, and applications that work with temporary files or network resources. With a permissive MIT license, active maintenance, and no known vulnerabilities, it presents a low-risk addition to projects targeting Python 3.10+.

Use it for

  • Wrap function calls to convert exceptions into boolean outcomes using ExceptionTrap with passes/raises decorators.
  • Suppress specific exceptions as a decorator instead of using contextlib.suppress in a with statement.
  • Handle KeyboardInterrupt gracefully in CLI entry points using the on_interrupt decorator.
  • Temporarily change working directory for a code block using pushd, then restore the original directory.
  • Download, extract, and work with remote tarballs while ensuring cleanup with the tarball context manager.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

jaraco.context is a lightweight, actively maintained utility library with no security issues, a permissive license, and low install friction. It's worth installing if you regularly use exception traps, context managers for directory changes, or tarball extraction in your code—it reduces boilerplate and improves readability. Skip it if your codebase doesn't use these patterns.

Install

jaraco-context on PyPI

Before you install

Low install friction with a single runtime dependency (backports.tarfile). The package is actively maintained with a recent release and has been stable since its initial release in 2014.

Requires Python 3.10 or later.

License in practice

MIT license permits use in commercial and private projects with minimal restrictions; attribution required.

Quickstart

pip install jaraco.context

from jaraco.context import ExceptionTrap

with ExceptionTrap() as trap:
    result = some_function()
if trap.exception:
    handle_error(trap.exception)

Verify before relying

  • Whether backports.tarfile is a compiled dependency or pure Python.
  • Performance characteristics when handling large tarballs or many context switches.

Package facts

LicenseMIT permissive
Python supportSupports the current Python release >=3.10
Install frictionLow. Pure-Python wheel
Runtime dependencies
1 package
backports.tarfile
MaintenanceActively maintained 147 days since the last release
Last repo commit
First released
Downloads215,370,078 / month, #190 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 5 - Production/StableIntended Audience :: DevelopersProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: Only

Evidence: jaraco_context-6.1.2-py3-none-any.whl

Tags

Capabilities
context managers decoratorsexception handling wrappersuppress decoratorkeyboard interrupt handlerworking directory contexttarball extraction contextexception trap decorator
Topics
context-managersdecoratorsexception-handling

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “context managers decorators”

  • jaraco.contextProvides decorators and context managers for exception handling,…
  • aiotoolsaiotools provides idiomatic asyncio utilities for structured…
  • stopitProvides context managers and decorators to enforce timeouts on code…

Give your agent the search over MCP, or paste the wish link into any chat.

Similar packages

jaraco.functools With conditions
PyPI · released Jul 2026

Provides additional functional programming utilities beyond Python's standard library functools, including decorators and higher-order functions for common patterns.

Install only if you have a specific need for the additional functools it provides—it's a specialized library, not a general dependency.

MITpure Python · 3.10+
231.0Mdownloads / mo
stopit Skip
PyPI · Utilities · released Feb 2018

Provides context managers and decorators to enforce timeouts on code blocks and function calls, and raise exceptions asynchronously in other threads.

MITbuilds from sourceabandoned
233.1Kdownloads / mo
jaraco.classes With conditions
PyPI · released Mar 2024

Provides utility functions for working with Python class constructs and class-related patterns.

MITpure Python · 3.8+
231.7Mdownloads / mo
jaraco.ui With conditions
PyPI · Utilities · released Aug 2024

Provides command-line and user-interface utilities for Python developers, built on jaraco.classes, jaraco.text, named, and typer.

MITpure Python · 3.8+
84.8Kdownloads / mo
interruptingcow Skip
PyPI · System · released Feb 2018

Interrupts long-running Python code by raising an exception after a specified timeout, using signal-based interruption on the main thread.

MITbuilds from sourceabandoned
169.3Kdownloads / mo
python-backoff Worth it
PyPI · Python Modules · released Aug 2026

Provides function decorators for retrying operations with configurable backoff strategies when exceptions occur or predicates are met, supporting both synchronous and asynchronous code.

Install it if you need to add resilience to functions that interact with unreliable external resources.

MITpure Python · 3.9+
4.6Mdownloads / mo

See also async-interrupt · backoff · undecorated · redo