The `deprecation` library (version 2.1.0) provides decorators to manage automated deprecations in Python code, including updating docstrings and enabling test failures for removed code. It aims to automate the process of signaling deprecated features to users and ensuring timely removal of obsolete code. The library's last release was in April 2020, suggesting a maintenance or slower release cadence. [1, 7]
pip install deprecationVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to use the `@deprecated` decorator with versioning and how to call the decorated function. It also shows the typical use case for `fail_if_not_removed` in a testing context to ensure deprecated code is eventually removed. Note that `PYTHONWARNINGS` or a `-W` flag is often required to see `DeprecationWarning` messages at runtime. [1, 7]
Ensure `PYTHONWARNINGS` environment variable is set to `default` or `always` in development and testing environments, or run Python with the `-Wd` or `-Wa` flag. For production, consider capturing warnings in logs.
Actively remove code that has passed its `removed_in` version to avoid test failures. Use `current_version` parameter accurately to reflect your project's version.
Double-check import statements to ensure `from deprecation import deprecated` for this library, and `from deprecated import deprecated` for the other. Consult the respective library's documentation for API differences.
Install the 'deprecation' library using pip: 'pip install deprecation'.
Ensure the import statement is correct: 'from deprecation import deprecated'.
Provide the 'deprecated_in' argument when using the decorator: '@deprecated(deprecated_in="1.0", removed_in="2.0", current_version=__version__, details="Use the bar function instead")'.
Ensure the import statement is correct: 'from deprecation import fail_if_not_removed'.
Update the code to use the recommended alternative function as specified in the deprecation warning.
No dependency data recorded yet.