--- id: types-contextvars version: "2.4.7.3" license: Apache-2.0 license license_treatment: permissive maintenance: active --- # types-contextvars — Typing stubs for contextvars License: permissive · Maintenance: active · Downloads: 222.9K/mo ## What it is and what it does types-contextvars is a PEP 561 type stub package that supplies type annotations for Python's built-in contextvars module. It allows static type checkers and IDEs to understand the types and signatures of contextvars functions and classes, enabling developers to catch type errors during development rather than at runtime. The package is generated from typeshed and was last tested with mypy 1.4.1, pyright 1.1.316, and pytype 2023.6.16. It has no runtime dependencies and installs as a pure-Python wheel. However, the package is explicitly unmaintained and will not receive updates, so its accuracy may drift as Python and type-checking tools evolve. Use it for: - Enable mypy or pyright to type-check code that uses contextvars.ContextVar for thread-safe context storage - Provide IDE autocomplete and type hints when working with context variables in modern Python projects - Validate type safety in async frameworks that rely on contextvars for managing request-scoped state - Support legacy projects still using older type-checking tool versions that require explicit stubs ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides type stubs for Python's contextvars module, enabling static type checkers like mypy, pyright, and pytype to validate code using context variables. Yes, if you use contextvars and need type checking with mypy, pyright, or pytype on Python versions up to those tested. However, be aware that the package is unmaintained—if you are on a newer Python version or type-checker version than those listed, the stubs may become inaccurate. For modern Python (3.7+), consider whether your type checker already includes contextvars stubs inline before installing. ## Install pip install types-contextvars uv add types-contextvars poetry add types-contextvars ## Installing types-contextvars Before you install: Low friction installation as a pure-Python stub package with no runtime dependencies. However, the package is explicitly unmaintained and has not been updated since July 2023, so it will not receive fixes for new Python versions or type-checking tool changes. License in practice: Licensed under Apache-2.0, a permissive open-source license that allows free use, modification, and distribution with minimal restrictions, making it safe to include in most projects. Quickstart: pip install types-contextvars # Then use in your code with type checking enabled: import contextvars my_var: contextvars.ContextVar[str] = contextvars.ContextVar('my_var') This package is only useful when running a static type checker (mypy, pyright, pytype, or IDE type checking); it provides no runtime functionality. Verify before relying: - Whether the stubs remain accurate for contextvars in current Python versions beyond those tested (mypy 1.4.1, pyright 1.1.316, pytype 2023.6.16) - Whether unmaintained status will cause compatibility issues as type checkers evolve ## Package facts - License: Apache-2.0 license (permissive) - Python support: unspecified - Install friction: low - Maintenance: active - Downloads: 222.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags contextvars type stubs, typing stubs for contextvars, mypy contextvars types, static type checking context variables, PEP 561 type stubs, pyright contextvars support, type-stubs, unmaintained [View on SkillFed](https://skillfed.io/packages/types-contextvars) · [View on PyPI](https://pypi.org/project/types-contextvars/)