flake8-deprecated

raw JSON →
2.3.0 verified Mon Apr 27 auth: no python

A flake8 plugin that warns about deprecated method calls in Python code. Current version: 2.3.0, compatible with Python >=3.10. Maintained but low release cadence.

pip install flake8-deprecated
error No module named 'flake8_deprecated'
cause Attempting to import flake8_deprecated directly in Python code.
fix
Do not import the plugin manually. It is automatically registered when you run flake8.
error flake8 reports DA1 ... (unexpected warning)
cause The plugin flags deprecated calls that may still be present in your codebase.
fix
Read the warning message; it includes the specific deprecated function. Replace with the suggested alternative.
gotcha Only Python >=3.10 is supported as of version 2.3.0. Older Python versions will fail installation.
fix Upgrade Python to 3.10+ or pin to an older version (e.g., flake8-deprecated==1.4) if needed.
gotcha The plugin only reports deprecated calls that are explicitly listed; it does not detect all forms of deprecation (e.g., missing deprecation warnings in third-party libs).
fix Supplement with other tools like pylint or bandit for broader deprecated API detection.

After installing, run flake8 on your code. The plugin adds checks prefixed with 'DA' (Deprecated API).

# Sample code with deprecated calls
import os
os.getcwd()  # Example
# Run: flake8 --select=DA mycode.py