Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add context API and implementation #22

Closed
@reyang

Description

@reyang

We target Python 3, which has different ways of handing asynchronous context:

  1. Python 3.0 - 3.5, only Thread Local Storage is supported.
  2. Python 3.6, contextvars supported as a backport https://pypi.org/project/contextvars/.
  3. Python 3.7+, contextvars provided by the default library.

The current decision:

  1. In order to support v3.x, we need to take the similar approach like what we did in OpenCensus.
  2. 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.
  3. The context library should be released as an individual package.

Metadata

Metadata

Assignees

Labels

apiAffects the API package.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions