types-contextvars
Typing stubs for contextvars
Decision gist · record as of 2026-08-14
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.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- This package is only useful when running a static type checker (mypy, pyright, pytype, or IDE type checking); it provides no runtime functionality.
- 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 · maintenance · safety
Apache-2.0 license (permissive) — 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.
last release 2023-07-07 (1134 days) · last repo commit 2026-08-14 · 5,108 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 222,896 downloads/mo, #9,256 on PyPI
Alternatives
Verify before relying
pip install types-contextvars
# Then use in your code with type checking enabled:
import contextvars
my_var: contextvars.ContextVar[str] = contextvars.ContextVar('my_var')- 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
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 on this page. Verify before relying on it.
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
types-contextvars on PyPI
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.
This package is only useful when running a static type checker (mypy, pyright, pytype, or IDE type checking); it provides no runtime functionality.
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')
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 | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 1,134 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 222,896 / month, #9,256 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: Apache Software LicenseProgramming Language :: Python :: 3Typing :: Stubs Only |
Evidence: types_contextvars-2.4.7.3-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “contextvars type stubs”
- types-contextvarsProvides type stubs for Python's contextvars module, enabling static…
- contextvarsProvides the PEP 567 contextvars module for Python 3.6, enabling…
- aiocontextvarsProvides asyncio support for the contextvars backport library on…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also types-typed-ast · types-appdirs · contextvars · types-DateTimeRange · aiocontextvars · types-urllib3 · types-dataclasses · pytype · types-babel · types-futures