reportDeprecated.md
April 8, 2026 · View on GitHub
Overview
reportDeprecated is a Pylance and Pyright diagnostic that warns when your code uses deprecated functions, classes, or modules. This helps you keep your codebase up to date and avoid using features that may be removed in future versions of libraries or Python itself.
Representative Issues
- #4163: Ensure consistency in the use of type stubs between Pyright's CLI and Pylance settings, especially with
useLibraryCodeForTypes. - #5200: Provide a configuration setting to allow users to customize diagnostic rule severities based on the type checking mode, improving the granularity of error reporting.
Examples
from typing_extensions import deprecated
@deprecated("Use new_function instead")
def old_function() -> None:
pass
old_function() # Warning: "old_function" is deprecated
Fix — use the recommended alternative:
def new_function() -> None:
pass
new_function() # No warning
Common Fixes & Workarounds
- Replace deprecated functions, classes, or modules with their recommended alternatives.
- Review library and Python release notes for deprecation warnings and migration guides.
- Refactor code to remove or update deprecated usages.
- Refer to the Pyright configuration documentation for details on configuring or disabling this diagnostic.
See Also
python.analysis.diagnosticSeverityOverrides— adjust or suppress this diagnosticpython.analysis.typeCheckingMode— controls which diagnostics are enabled by default