Skip to content
PEP 567 Backport
Branch: master
Clone or download
Latest commit d13d478 Apr 1, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
contextvars Use module import May 2, 2018
tests Rename package: pep567 -> contextvars. Mar 21, 2018
.editorconfig Initial commit Mar 21, 2018
.gitignore Initial commit Mar 21, 2018
.travis.yml Enable 3.5 support Mar 21, 2018
LICENSE Initial commit Mar 21, 2018 Add manifest Mar 21, 2018
README.rst readme: Update Travis links Mar 21, 2018
pytest.ini Initial commit Mar 21, 2018 Bump the version to 2.4 Apr 1, 2019


PEP 567 Backport

This package implements a backport of Python 3.7 contextvars module (see PEP 567) for Python 3.6.

Important: at this moment this package does not provide an asyncio event loop with PEP 567 support yet. Stay tuned for updates.

Original "contextvars" Package

This package replaces the old "contextvars" PyPI package which repository is available here.


Read the official contextvars module documentation here:

PEP 567 also provides a comprehensive overview of the API and explains all design choices.


$ pip install contextvars


import contextvars

my_var = contextvars.ContextVar('my_var')

# ...

Listing as a Dependency

The good news is that the standard library always takes the precedence over site packages, so even if a local contextvars module is installed, the one from the standard library will be used. Therefore you can simply list "contextvars" in your requirements.txt or files.

Another option is to use "platform specific dependencies" setuptools feature:

import setuptools



Apache 2.0.

You can’t perform that action at this time.