-
-
Notifications
You must be signed in to change notification settings - Fork 33k
gh-76007: Deprecate __version__
attribute
#138675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
38e19bd
c23ee78
6e01534
ddb6a2b
7b13a13
bfbe4b7
6bb4cbe
d352594
d17235d
134c8be
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
Pending removal in Python 3.17 | ||
------------------------------ | ||
|
||
* :mod:`collections.abc`: | ||
|
||
- :class:`collections.abc.ByteString` is scheduled for removal in Python 3.17. Prefer | ||
:class:`~collections.abc.Sequence` or :class:`~collections.abc.Buffer`. For use in | ||
type annotations, prefer a union, like ``bytes | bytearray``, or | ||
:class:`collections.abc.Buffer`. (Contributed by Shantanu Jain in :gh:`91896`.) | ||
|
||
* :mod:`typing`: | ||
|
||
- Before Python 3.14, old-style unions were implemented using the private class | ||
``typing._UnionGenericAlias``. This class is no longer needed for the implementation, | ||
but it has been retained for backward compatibility, with removal scheduled for Python | ||
3.17. Users should use documented introspection helpers like :func:`typing.get_origin` | ||
and :func:`typing.get_args` instead of relying on private implementation details. | ||
|
||
hugovk marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
- :class:`typing.ByteString`, deprecated since Python 3.9, is scheduled for removal in | ||
Python 3.17. Prefer :class:`~collections.abc.Sequence` or | ||
:class:`~collections.abc.Buffer`. For use in type annotations, prefer a union, like | ||
``bytes | bytearray``, or :class:`collections.abc.Buffer`. | ||
(Contributed by Shantanu Jain in :gh:`91896`.) | ||
hugovk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
* :mod:`collections.abc`: | ||
|
||
- :class:`collections.abc.ByteString` is scheduled for removal in Python 3.17. Prefer | ||
:class:`~collections.abc.Sequence` or :class:`~collections.abc.Buffer`. For use in | ||
type annotations, prefer a union, like ``bytes | bytearray``, or | ||
:class:`collections.abc.Buffer`. (Contributed by Shantanu Jain in :gh:`91896`.) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Pending removal in Python 3.20 | ||
------------------------------ | ||
|
||
* The ``__version__`` attribute has been deprecated in these standard library | ||
modules and will be removed in Python 3.20. | ||
Use :py:data:`sys.version_info` instead. | ||
|
||
- :mod:`argparse` | ||
- :mod:`csv` | ||
- :mod:`!ctypes.macholib` | ||
- :mod:`ipaddress` | ||
- :mod:`json` | ||
- :mod:`logging` (``__date__`` also deprecated) | ||
- :mod:`optparse` | ||
- :mod:`pickle` | ||
- :mod:`platform` | ||
- :mod:`re` | ||
- :mod:`socketserver` | ||
- :mod:`tabnanny` | ||
- :mod:`tkinter.font` | ||
- :mod:`tkinter.ttk` | ||
|
||
(Contributed by Hugo van Kemenade in :gh:`76007`.) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -569,9 +569,42 @@ hashlib | |
|
||
(Contributed by Bénédikt Tran in :gh:`134978`.) | ||
|
||
__version__ | ||
----------- | ||
|
||
* The ``__version__`` attribute has been deprecated in these standard library | ||
modules and will be removed in Python 3.20. | ||
Use :py:data:`sys.version_info` instead. | ||
|
||
- :mod:`argparse` | ||
- :mod:`csv` | ||
- :mod:`!ctypes.macholib` | ||
- :mod:`ipaddress` | ||
- :mod:`json` | ||
- :mod:`logging` (``__date__`` also deprecated) | ||
- :mod:`optparse` | ||
- :mod:`pickle` | ||
- :mod:`platform` | ||
- :mod:`re` | ||
- :mod:`socketserver` | ||
- :mod:`tabnanny` | ||
- :mod:`tkinter.font` | ||
- :mod:`tkinter.ttk` | ||
|
||
(Contributed by Hugo van Kemenade in :gh:`76007`.) | ||
|
||
.. Add deprecations above alphabetically, not here at the end. | ||
|
||
.. include:: ../deprecations/pending-removal-in-3.16.rst | ||
|
||
.. include:: ../deprecations/pending-removal-in-3.17.rst | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So this will show the same list twice in this page? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, that's how we're already doing it for other ones (I'm not sure if we should, but that's another discussion). |
||
|
||
.. include:: ../deprecations/pending-removal-in-3.19.rst | ||
|
||
.. include:: ../deprecations/pending-removal-in-3.20.rst | ||
|
||
.. include:: ../deprecations/pending-removal-in-future.rst | ||
|
||
Removed | ||
======= | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,9 +45,6 @@ | |
|
||
__author__ = "Vinay Sajip <[email protected]>" | ||
__status__ = "production" | ||
# The following module attributes are no longer updated. | ||
__version__ = "0.5.1.2" | ||
__date__ = "07 February 2010" | ||
|
||
#--------------------------------------------------------------------------- | ||
# Miscellaneous module data | ||
|
@@ -2341,3 +2338,16 @@ def captureWarnings(capture): | |
if _warnings_showwarning is not None: | ||
warnings.showwarning = _warnings_showwarning | ||
_warnings_showwarning = None | ||
|
||
|
||
def __getattr__(name): | ||
if name in ("__version__", "__date__"): | ||
from warnings import _deprecated | ||
|
||
_deprecated(name, remove=(3, 20)) | ||
return { # Do not change | ||
"__version__": "0.5.1.2", | ||
"__date__": "07 February 2010", | ||
}[name] | ||
|
||
raise AttributeError(f"module {__name__!r} has no attribute {name!r}") |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,6 @@ | |
|
||
Misc variables: | ||
|
||
__version__ | ||
format_version | ||
compatible_formats | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.