https://github.com/magicstack/contextvars
PEP 567 Backport
https://github.com/magicstack/contextvars
Last synced: 15 days ago
JSON representation
PEP 567 Backport
- Host: GitHub
- URL: https://github.com/magicstack/contextvars
- Owner: MagicStack
- License: apache-2.0
- Created: 2018-03-21T01:40:24.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-01T14:43:19.000Z (about 6 years ago)
- Last Synced: 2024-04-26T23:20:16.902Z (12 months ago)
- Language: Python
- Homepage:
- Size: 15.6 KB
- Stars: 86
- Watchers: 8
- Forks: 9
- Open Issues: 6
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
.. image:: https://travis-ci.org/MagicStack/contextvars.svg?branch=master
:target: https://travis-ci.org/MagicStack/contextvarsPEP 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
============.. code-block:: bash
$ pip install contextvars
Usage
=====.. code-block:: python
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:.. code-block:: python
import setuptools
setuptools.setup(
name="Project",
...
install_requires=[
'contextvars;python_version<"3.7"'
]
)License
=======Apache 2.0.