--- id: contextvars version: "2.4" license: Apache License, Version 2.0 license_treatment: permissive maintenance: abandoned --- # contextvars — PEP 567 Backport License: permissive · Maintenance: abandoned · Downloads: 1.4M/mo ## What it is and what it does This package backports Python 3.7's contextvars module to Python 3.6, implementing PEP 567 context-local state. It allows you to create and manage context variables that maintain separate values across concurrent execution contexts—useful in async code and thread pools where thread-local storage is insufficient. The package is now largely obsolete: Python 3.7+ includes contextvars in the standard library, and the package itself has been abandoned since its last release on 2019-04-01 with no active maintenance. It exists primarily as a compatibility shim for legacy Python 3.6 codebases. The standard library always takes precedence, so listing it as a dependency is safe but unnecessary for modern projects. Use it for: - Maintaining request-scoped state in async frameworks running on Python 3.6. - Passing context through concurrent.futures thread pools without global variables. - Porting code that uses contextvars from Python 3.7+ down to Python 3.6 environments. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides the PEP 567 contextvars module for Python 3.6, enabling context-local state management in concurrent code. No. If you are on Python 3.7 or later, use the standard library contextvars. If you must support Python 3.6, this backport is your only option, but the lack of maintenance since 2019-04-01 and high install friction make it a last resort. Modern projects should not depend on this. ## Install pip install contextvars uv add contextvars poetry add contextvars ## Installing contextvars Before you install: High install friction due to source distribution. Package is abandoned as of 2019 with no maintenance since its last release. Modern Python versions include contextvars in the standard library, making this backport obsolete for most use cases. License in practice: Licensed under Apache License, Version 2.0 (permissive). No restrictions on commercial or private use; attribution required. Quickstart: pip install contextvars import contextvars my_var = contextvars.ContextVar('my_var') my_var.set('value') Python 3.6 only; Python 3.7+ includes contextvars in the standard library and will use that instead of this backport. Verify before relying: - Whether asyncio event loop support was ever added after the 2019 release note stating it was not yet available. - Compatibility with Python 3.5 (listed in classifiers) despite the description stating Python 3.6 support. - Current status of Python 3.6 support lifecycle and whether this backport remains usable. ## Package facts - License: Apache License, Version 2.0 (permissive) - Python support: unspecified - Install friction: high - Maintenance: abandoned - Downloads: 1.4M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags context variables python 3.6, PEP 567 backport, contextvars backport, context-local state management, async context variables, thread-local alternatives, backport, deprecated, python-3.6-only [View on SkillFed](https://skillfed.io/packages/contextvars) · [View on PyPI](https://pypi.org/project/contextvars/)