We target Python 3, which has different ways of handing asynchronous context:
- Python 3.0 - 3.5, only Thread Local Storage is supported.
- Python 3.6,
contextvars supported as a backport https://pypi.org/project/contextvars/.
- Python 3.7+,
contextvars provided by the default library.
The current decision:
- In order to support v3.x, we need to take the similar approach like what we did in OpenCensus.
- We need to provide the ability for user to switch from
contextvars back to Thread Local Storage, in order to make it work for existing systems like gevent and tornado. This can be exposed through a non-public API first, considering this is not a common scenario and we can remove it once all systems onboarded to contextvars.
- The context library should be released as an individual package.
We target Python 3, which has different ways of handing asynchronous context:
contextvarssupported as a backport https://pypi.org/project/contextvars/.contextvarsprovided by the default library.The current decision:
contextvarsback to Thread Local Storage, in order to make it work for existing systems like gevent and tornado. This can be exposed through a non-public API first, considering this is not a common scenario and we can remove it once all systems onboarded tocontextvars.