GitHub - MagicStack/contextvars: PEP 567 Backport
Repository navigation
contextvarsPublic
About
PEP 567 Backport
Resources
Readme Apache-2.0 license Activity Custom propertiesStars
90 starsWatchers
6 watchingForks
9 forks Report repositoryBranches
Tags
Go to Branches page Go to Tags page
Latest commit
History
17 Commits
View commit history for this file.
Folders and files
| Name | Name | Last commit message | Last commit date |
|---|---|---|---|
| contextvars | contextvars | ||
| tests | tests | ||
| .editorconfig | .editorconfig | ||
| .gitignore | .gitignore | ||
| .travis.yml | .travis.yml | ||
| LICENSE | LICENSE | ||
| MANIFEST.in | MANIFEST.in | ||
| README.rst | README.rst | ||
| pytest.ini | pytest.ini | ||
| setup.py | setup.py | ||
Repository files navigation
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.
About
PEP 567 Backport