Registry / type-stubs / types-deprecated

types-deprecated

JSON →
library1.3.1.20260728pypypi✓ verified 26d ago

This is a typeshed stub package that provides static type annotations for the 'Deprecated' Python library. It enables type checkers like Mypy and Pyright to analyze code using the `Deprecated` library, which offers a `@deprecated` decorator for marking functions, methods, or classes as deprecated and emitting runtime warnings. The `types-deprecated` package is part of the `typeshed` project and its release cadence is tied to typeshed updates, aiming for compatibility with `Deprecated~=1.3.1`.

pip install types-deprecated
INSTALL
IMPORT
SIG · TYPES-DEPRECATED
T
types-deprecated
type-stubspythonv1.3.1.20260728
Install
1.8s avg
Import
Disk
66MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.3.1.20260728 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 67.1MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 1.8s · import 0.000s · 18MB
66MB installed
● package 66MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

deprecated
from deprecated_stubs import deprecated
from deprecated_stubs import deprecated

This quickstart demonstrates how to apply the `@deprecated` decorator to functions and classes from the `Deprecated` library. It also includes an example of using `@deprecated_params` for specific arguments. Crucially, it shows how to enable `DeprecationWarning` messages, which are often ignored by default in Python, so you can see the warnings generated by using deprecated code.

import warnings from deprecated import deprecated # Enable DeprecationWarnings to be visible (they are often ignored by default) warnings.simplefilter('always', DeprecationWarning) @deprecated(reason="Use new_function instead") def old_function(a: int, b: int) -> int: """This is an old function.""" return a + b @deprecated(version='1.2.0', reason="Use NewClass instead") class OldClass: def __init__(self, value: str): self.value = value def get_value(self) -> str: return self.value def new_function(x: int, y: int) -> int: """This is the new function.""" return x * y # Using the deprecated function and class result = old_function(5, 3) print(f"Result from old_function: {result}") obj = OldClass("hello") print(f"Value from OldClass: {obj.get_value()}") # Expected usage of the new function new_result = new_function(5, 3) print(f"Result from new_function: {new_result}") # Example of using a deprecated parameter (requires deprecated.params) from deprecated.params import deprecated_params @deprecated_params('old_arg', reason='Use new_arg instead') def example_function(new_arg: str, old_arg: str = 'default') -> None: print(f"Called with new_arg: {new_arg}, old_arg: {old_arg}") example_function(new_arg='modern value', old_arg='legacy value') # Restore default warning filter (optional) warnings.simplefilter('default', DeprecationWarning)
Debug
Known issues
gotchaThis `types-deprecated` package provides *only* type stubs. For the actual `@deprecated` decorator functionality at runtime, you must also install the `Deprecated` library (`pip install Deprecated`).
fix
Ensure both `pip install Deprecated` and `pip install types-deprecated` are run.
affects: All versions
gotchaBy default, `DeprecationWarning` messages are ignored in Python 2.7+ unless explicitly enabled (e.g., via `python -W always` or `warnings.simplefilter('always', DeprecationWarning)` in code). If you don't see warnings, they might be silently suppressed.
fix
To view warnings, run your Python script with `python -W always your_script.py` or add `import warnings; warnings.simplefilter('always', DeprecationWarning)` at the beginning of your script during development/testing. For production, consider using a logging configuration to capture warnings.
affects: Python 2.7+
gotchaWhen deprecating a class using `@deprecated`, the warning is typically emitted only during class instantiation (when `__new__` is called), not for every method call on an already-instantiated deprecated object.
fix
Inform users in the deprecation message that the entire class is deprecated and they should migrate to an alternative class.
affects: All versions
breakingThe `types-deprecated` stubs aim to provide accurate annotations for `Deprecated~=1.3.1`. Future major versions of the runtime `Deprecated` library (e.g., 2.x) may introduce API changes that could break type checking, even if runtime code continues to function with older versions of the library.
fix
Regularly update `types-deprecated` and review your code with a type checker for new type errors if you update the `Deprecated` runtime library to a new major version.
affects: Future `Deprecated` 2.x+ versions
Upgrade
Version history
1.3.1.20260728latest on PyPI · released Jul 28, 2026
Audit
Dependencies
DeprecatedrequiredThis package provides typing stubs for the runtime library 'Deprecated'. The runtime library is required for actual execution.
wraptrequiredA core dependency of the runtime 'Deprecated' library, used for its decorator implementation.
Agent activity
27 hits · last 30 days
node
24
OpenAI (training)
1
Resources
types-deprecated — pip install types-deprecated · libregistry