--- id: oslo-context version: "6.5.0" license: Apache-2.0 license_treatment: permissive maintenance: active --- # oslo.context — Oslo Context library License: permissive · Maintenance: active · Downloads: 988.9K/mo ## What it is and what it does oslo.context is a small library from the OpenStack project that helps you store and retrieve request-scoped metadata—such as request IDs, user identifiers, and project names—in a way that's accessible throughout your application without passing context as a function parameter. It's typically used in WSGI applications to populate context in the middleware layer, then accessed by logging and other modules downstream. The library uses thread-local (or async-context-aware) storage to keep request data isolated between concurrent requests. It's designed as a utility for larger OpenStack-based systems but can be used standalone in any Python application that needs to track request metadata across function call boundaries. Use it for: - Store and retrieve request IDs in WSGI middleware to correlate logs across service calls. - Maintain user and project identifiers in context for access control checks in business logic. - Populate logging formatters with request metadata without threading context through every function. - Track request-scoped data in OpenStack services and compatible cloud applications. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. oslo.context provides utilities to store and access request context information—such as request IDs and user details—that can be shared across a WSGI application and its logging pipeline. Yes, if you're building a WSGI application that needs to propagate request metadata (IDs, user info) across your codebase without explicit parameter passing. Low install friction, active maintenance, no known vulnerabilities, and permissive licensing make it a safe choice. Not necessary for simple scripts or applications that don't need request-scoped context. ## Install pip install oslo-context uv add oslo-context poetry add oslo-context ## Installing oslo.context Before you install: Low friction: pure Python wheel, only two lightweight runtime dependencies (pbr and typing-extensions). Active maintenance with a release 35 days ago. Requires Python 3.11 or later. License in practice: Apache License 2.0 (permissive): you can use, modify, and distribute this package freely in commercial and private projects, provided you include the license notice. Quickstart: pip install oslo.context from oslo_context import context ctx = context.RequestContext(user='alice', project='myproject') context.set_ctx(ctx) request_id = context.get_current().request_id Requires Python 3.11 or later. Verify before relying: - Whether oslo.context integrates automatically with WSGI frameworks or requires manual middleware setup. - What specific request metadata fields are available beyond user and project identifiers. ## Package facts - License: Apache-2.0 (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 988.9K/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags request context management, wsgi context tracking, request id propagation, context-local storage, logging context helpers, openstack context library, thread-local request data, openstack, wsgi-middleware, request-tracking [View on SkillFed](https://skillfed.io/packages/oslo-context) · [View on PyPI](https://pypi.org/project/oslo-context/)