Re-add deprecated PILLOW_VERSION to give projects more time to upgrade

This commit is contained in:
Hugo 2020-03-29 18:36:37 +03:00
parent 75a9ef1533
commit afa758eb33
4 changed files with 34 additions and 11 deletions

View File

@ -12,6 +12,17 @@ Deprecated features
Below are features which are considered deprecated. Where appropriate, Below are features which are considered deprecated. Where appropriate,
a ``DeprecationWarning`` is issued. a ``DeprecationWarning`` is issued.
PILLOW_VERSION constant
~~~~~~~~~~~~~~~~~~~~~~~
.. deprecated:: 5.2.0
``PILLOW_VERSION`` has been deprecated and will be removed in a future release. Use
``__version__`` instead.
It was initially removed in Pillow 7.0.0, but brought back in 7.1.0 to give projects
more time to upgrade.
ImageCms.CmsProfile attributes ImageCms.CmsProfile attributes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -69,13 +80,6 @@ Use instead:
with Image.open("hopper.png") as im: with Image.open("hopper.png") as im:
im.save("out.jpg") im.save("out.jpg")
PILLOW_VERSION constant
~~~~~~~~~~~~~~~~~~~~~~~
*Removed in version 7.0.0.*
``PILLOW_VERSION`` has been removed. Use ``__version__`` instead.
PIL.*ImagePlugin.__version__ attributes PIL.*ImagePlugin.__version__ attributes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -27,6 +27,15 @@ Reading JPEG comments
When opening a JPEG image, the comment may now be read into When opening a JPEG image, the comment may now be read into
:py:attr:`~PIL.Image.Image.info`. :py:attr:`~PIL.Image.Image.info`.
PILLOW_VERSION constant
^^^^^^^^^^^^^^^^^^^^^^^
``PILLOW_VERSION`` has been re-added but is deprecated and will be removed in a future
release. Use ``__version__`` instead.
It was initially removed in Pillow 7.0.0, but brought back in 7.1.0 to give projects
more time to upgrade.
Other Changes Other Changes
============= =============

View File

@ -39,12 +39,22 @@ from collections.abc import Callable, MutableMapping
from pathlib import Path from pathlib import Path
# VERSION was removed in Pillow 6.0.0. # VERSION was removed in Pillow 6.0.0.
# PILLOW_VERSION was removed in Pillow 7.0.0. # PILLOW_VERSION is deprecated and will be removed in a future release.
# Use __version__ instead. # Use __version__ instead.
from . import ImageMode, TiffTags, UnidentifiedImageError, __version__, _plugins from . import (
PILLOW_VERSION,
ImageMode,
TiffTags,
UnidentifiedImageError,
__version__,
_plugins,
)
from ._binary import i8, i32le from ._binary import i8, i32le
from ._util import deferred_error, isPath from ._util import deferred_error, isPath
# Silence warning
assert PILLOW_VERSION
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -16,9 +16,9 @@ Use PIL.__version__ for this Pillow version.
from . import _version from . import _version
# VERSION was removed in Pillow 6.0.0. # VERSION was removed in Pillow 6.0.0.
# PILLOW_VERSION was removed in Pillow 7.0.0. # PILLOW_VERSION is deprecated and will be removed in a future release.
# Use __version__ instead. # Use __version__ instead.
__version__ = _version.__version__ PILLOW_VERSION = __version__ = _version.__version__
del _version del _version