gh-76007: Deprecate __version__ attribute (#138675)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
This commit is contained in:
Hugo van Kemenade 2025-09-29 11:03:23 +02:00 committed by GitHub
parent 408154d64a
commit 872eafd2b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 320 additions and 29 deletions

View file

@ -21,8 +21,6 @@
(options, args) = parser.parse_args()
"""
__version__ = "1.5.3"
__all__ = ['Option',
'make_option',
'SUPPRESS_HELP',
@ -1669,3 +1667,12 @@ def _match_abbrev(s, wordmap):
# which will become a factory function when there are many Option
# classes.
make_option = Option
def __getattr__(name):
if name == "__version__":
from warnings import _deprecated
_deprecated("__version__", remove=(3, 20))
return "1.5.3" # Do not change
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")