
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
.. image:: https://travis-ci.org/MagicStack/contextvars.svg?branch=master :target: https://travis-ci.org/MagicStack/contextvars
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.
This package replaces the old "contextvars" PyPI package which
repository is available here <https://github.com/gawen/contextvars>
_.
Read the official contextvars
module documentation here:
https://docs.python.org/3.7/library/contextvars.html
PEP 567 <https://www.python.org/dev/peps/pep-0567/>
_ also provides
a comprehensive overview of the API and explains all design choices.
.. code-block:: bash
$ pip install contextvars
.. code-block:: python
import contextvars
my_var = contextvars.ContextVar('my_var')
# ...
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" <http://setuptools.readthedocs.io/en/latest/setuptools.html\ #declaring-platform-specific-dependencies>
_ setuptools feature:
.. code-block:: python
import setuptools
setuptools.setup(
name="Project",
...
install_requires=[
'contextvars;python_version<"3.7"'
]
)
Apache 2.0.
FAQs
PEP 567 Backport
We found that contextvars demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.