Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify context #370

Open
RazerM opened this issue Jan 17, 2024 · 0 comments
Open

Simplify context #370

RazerM opened this issue Jan 17, 2024 · 0 comments
Milestone

Comments

@RazerM
Copy link
Collaborator

RazerM commented Jan 17, 2024

Logbook has a ContextObject which is used by various objects, most notably the Handler class. As a context manager, these objects will push either greenlet or thread context depending on whether "gevent" support is enabled. There are explicit contextmanagers, push, and pop methods for each variant:

  • applicationbound(), push_application(), pop_application()
  • threadbound(), push_thread(), pop_thread()
  • greenletbound(), push_greenlet(), pop_greenlet()
  • contextbound(), push_context(), pop_context()

application context is global and so still has a purpose.

contextvars is available in all the Python versions we support, and greenlet 1.0+ supports it natively, so we can get rid of the thread/greenlet variants.

I wonder if we can already deprecate them and make them use context underneath.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant