contextvars
PEP 567 Backport
Decision gist · record as of 2026-08-14
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.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Python 3.6 only; Python 3.7+ includes contextvars in the standard library and will use that instead of this backport.
- High install friction due to source distribution.
- Package is abandoned as of 2019 with no maintenance since its last release.
License · maintenance · safety
Apache License, Version 2.0 (permissive) — Licensed under Apache License, Version 2.0 (permissive). No restrictions on commercial or private use; attribution required.
last release 2019-04-01 (2692 days) · last repo commit 2019-04-01 · 90 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,399,193 downloads/mo, #3,954 on PyPI
Alternatives
Verify before relying
pip install contextvars
import contextvars
my_var = contextvars.ContextVar('my_var')
my_var.set('value')- 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.
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 on this page. Verify before relying on it.
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
contextvars on PyPI
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.
Python 3.6 only; Python 3.7+ includes contextvars in the standard library and will use that instead of this backport.
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')
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 | Not specified |
| Install friction | High. Source build required |
| Runtime dependencies | None |
| Maintenance | Abandoned 2,692 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,399,193 / month, #3,954 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 3 - AlphaIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.5Programming Language :: Python :: 3.6 |
Evidence: contextvars-2.4.tar.gz
Tags
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 variables python 3.6”
- contextvarsProvides the PEP 567 contextvars module for Python 3.6, enabling…
- aiocontextvarsProvides asyncio support for the contextvars backport library on…
- jinja2-simple-tagsProvides base classes to create custom Jinja2 template tags…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also aiocontextvars · opencensus-context · types-contextvars · pickle5 · backports.zoneinfo · futures · dataclasses · eval-type-backport · asyncio · contextlib2