Deprecated Library

raw JSON →
1.3.1 verified Tue May 12 auth: no python install: verified quickstart: stale

A Python library providing a `@deprecated` decorator to mark functions, classes, or methods as deprecated, encouraging developers to transition to newer APIs. Current version: 1.3.1. Release cadence: Regular updates with new features and fixes.

pip install deprecated
error ModuleNotFoundError: No module named 'deprecated'
cause The 'deprecated' Python package has not been installed in the active Python environment.
fix
Run pip install deprecated in your terminal to install the library.
error TypeError: deprecated() got an unexpected keyword argument 'name'
cause This error typically occurs due to a version mismatch or incompatibility between a package (e.g., `pip`, `pyopenssl`, `botocore`) and its internal or dependent use of a 'deprecated' utility, which might be an older version or a custom implementation that does not accept a 'name' argument.
fix
Upgrade the related conflicting packages to their latest compatible versions, often starting with pip install --upgrade pip setuptools and then pip install --upgrade pyopenssl or other libraries mentioned in the traceback.
error DeprecationWarning: Call to deprecated function (or staticmethod) <function_name>.
cause While `DeprecationWarning` messages are emitted, they are often ignored by default by Python's warning filters, especially when the deprecated code is not in the `__main__` module.
fix
To make DeprecationWarning messages visible, run your Python script with PYTHONWARNINGS='default' or add import warnings; warnings.simplefilter('default', DeprecationWarning) at the beginning of your script.
breaking Deprecated Library version 1.3.0 introduced support for wrapt 2.x, which may cause compatibility issues with previous versions.
fix Upgrade to wrapt 2.x or adjust your code to maintain compatibility.
deprecated Python 2.7 support is deprecated and will be removed in future releases.
fix Upgrade to Python 3.7 or later.
gotcha Using the `@deprecated` decorator without specifying a version may lead to confusion about the deprecation status.
fix Always specify the version when marking a function as deprecated.
breaking Attempting to use `@deprecated` directly as a decorator results in a `TypeError: 'module' object is not callable` because `deprecated` refers to the module itself. The actual decorator function is `deprecated.deprecated`.
fix Use `@deprecated.deprecated` when marking a function as deprecated, optionally passing arguments like version: `@deprecated.deprecated(version='1.0')`.
python os / libc status wheel install import disk
3.10 alpine (musl) - - 0.15s 18.4M
3.10 slim (glibc) - - 0.10s 19M
3.11 alpine (musl) - - 0.18s 20.3M
3.11 slim (glibc) - - 0.14s 21M
3.12 alpine (musl) - - 0.14s 12.2M
3.12 slim (glibc) - - 0.14s 13M
3.13 alpine (musl) - - 0.10s 11.8M
3.13 slim (glibc) - - 0.10s 12M
3.9 alpine (musl) - - 0.07s 17.9M
3.9 slim (glibc) - - 0.06s 18M

Example of using the `@deprecated` decorator to mark a function as deprecated.

import deprecated

@deprecated
def old_function():
    pass

old_function()