Skip to main content
https://travis-ci.org/MagicStack/contextvars.svg?branch=master

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.

Documentation

Read the official contextvars module documentation here: https://docs.python.org/3.7/library/contextvars.html

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

Installation

$ pip install contextvars

Usage

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 setup.py files.

Another option is to use “platform specific dependencies” setuptools feature:

import setuptools

setuptools.setup(
    name="Project",
    ...
    install_requires=[
        'contextvars;python_version<"3.7"'
    ]
)

License

Apache 2.0.

Metadata

Release files for contextvars 2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for contextvars 2.0
File Size Uploaded
contextvars-2.0.tar.gz 9.6 kB Details

Release files / contextvars-2.0.tar.gz

Download URL contextvars-2.0.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
5b2f1f8fb9e8dd241c18c85b7eef99146fcae695253c361d89b68d6cda8426c4
BLAKE2b-256 checksum
How to use checksums
a34d5a2bb7c683c8edc2711011c23b2aac855b39e8eaa8a9f730f57dde77792a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

2.4

1 release file

2.3

1 release file

2.2

1 release file

2.1

1 release file

This release

2.0 This release

1 release file

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page