Skip to main content

PEP 567 Backport

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

contextvars-2.3.tar.gz (9.6 kB view details)

Uploaded Source

File details

Details for the file contextvars-2.3.tar.gz.

File metadata

  • Download URL: contextvars-2.3.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.19.8 CPython/3.6.6

File hashes

Hashes for contextvars-2.3.tar.gz
Algorithm Hash digest
SHA256 2341042e1c03a271813e07dba29b6b60fa85c1005ea5ed1638a076cf50b4d625
MD5 e933c76bb4ff3675e472bb315efae194
BLAKE2b-256 28013c237e3975afded3038d5eacb80646d919c008fb05d25b36cd25495c5467

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page