Description
Currently, deprecation mechanisms are primarily focused on granular elements like individual functions, methods, or classes. It would be highly beneficial to introduce a streamlined, abstract way to deprecate an entire Python module at once.
Instead of requiring developers to decorate or update every single component within a file, there should be a high-level mechanism to flag the whole module as obsolete.
Suggested Behavior
- Module-Level Flag: A simple, declarative way (such as a module-level attribute or an entry in
__init__.py) to mark the module's status.
- Unified Warning: Automatically trigger a
DeprecationWarning whenever any part of the module is imported or accessed.
Benefits
- Reduces Boilerplate: Eliminates the need to add repetitive warning code to dozens of functions.
- Clear Intent: Provides a straightforward signal to downstream users that the entire module is slated for removal in a future release.
Description
Currently, deprecation mechanisms are primarily focused on granular elements like individual functions, methods, or classes. It would be highly beneficial to introduce a streamlined, abstract way to deprecate an entire Python module at once.
Instead of requiring developers to decorate or update every single component within a file, there should be a high-level mechanism to flag the whole module as obsolete.
Suggested Behavior
__init__.py) to mark the module's status.DeprecationWarningwhenever any part of the module is imported or accessed.Benefits