-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Deprecate ImageCms constants and versions() function #7702
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 2 commits
08f11c5
edc46e2
bddfebc
208a34c
1e8a03c
71ba20b
5347b47
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 |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| 10.3.0 | ||
| ------ | ||
|
|
||
| Backwards Incompatible Changes | ||
| ============================== | ||
|
|
||
| TODO | ||
| ^^^^ | ||
|
|
||
| Deprecations | ||
| ============ | ||
|
|
||
| ImageCms constants and versions() function | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
|
||
| A number of constants and a function in :py:mod:`.ImageCms` have been deprecated. | ||
| This includes a table of flags based on LittleCMS version 1 which has been replaced | ||
| with a new class :py:class:`.ImageCms.Flags` based on LittleCMS 2 flags. | ||
|
|
||
| ===================================================== ============================================================ | ||
| Deprecated Use instead | ||
| ===================================================== ============================================================ | ||
| ``ImageCms.DESCRIPTION`` | ||
| ``ImageCms.VERSION`` ``PIL.__version__`` | ||
nulano marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ``ImageCms.FLAGS["MATRIXINPUT"]`` :py:attr:`.ImageCms.Flags.CLUT_POST_LINEARIZATION` | ||
| ``ImageCms.FLAGS["MATRIXOUTPUT"]`` :py:attr:`.ImageCms.Flags.FORCE_CLUT` | ||
| ``ImageCms.FLAGS["MATRIXONLY"]`` | ||
|
||
| ``ImageCms.FLAGS["NOWHITEONWHITEFIXUP"]`` :py:attr:`.ImageCms.Flags.NOWHITEONWHITEFIXUP` | ||
| ``ImageCms.FLAGS["NOPRELINEARIZATION"]`` :py:attr:`.ImageCms.Flags.CLUT_PRE_LINEARIZATION` | ||
| ``ImageCms.FLAGS["GUESSDEVICECLASS"]`` :py:attr:`.ImageCms.Flags.GUESSDEVICECLASS` | ||
| ``ImageCms.FLAGS["NOTCACHE"]`` :py:attr:`.ImageCms.Flags.NOCACHE` | ||
| ``ImageCms.FLAGS["NOTPRECALC"]`` :py:attr:`.ImageCms.Flags.NOOPTIMIZE` | ||
| ``ImageCms.FLAGS["NULLTRANSFORM"]`` :py:attr:`.ImageCms.Flags.NULLTRANSFORM` | ||
| ``ImageCms.FLAGS["HIGHRESPRECALC"]`` :py:attr:`.ImageCms.Flags.HIGHRESPRECALC` | ||
| ``ImageCms.FLAGS["LOWRESPRECALC"]`` :py:attr:`.ImageCms.Flags.LOWRESPRECALC` | ||
| ``ImageCms.FLAGS["GAMUTCHECK"]`` :py:attr:`.ImageCms.Flags.GAMUTCHECK` | ||
| ``ImageCms.FLAGS["WHITEBLACKCOMPENSATION"]`` :py:attr:`.ImageCms.Flags.BLACKPOINTCOMPENSATION` | ||
| ``ImageCms.FLAGS["BLACKPOINTCOMPENSATION"]`` :py:attr:`.ImageCms.Flags.BLACKPOINTCOMPENSATION` | ||
| ``ImageCms.FLAGS["SOFTPROOFING"]`` :py:attr:`.ImageCms.Flags.SOFTPROOFING` | ||
| ``ImageCms.FLAGS["PRESERVEBLACK"]`` :py:attr:`.ImageCms.Flags.NONEGATIVES` | ||
| ``ImageCms.FLAGS["NODEFAULTRESOURCEDEF"]`` :py:attr:`.ImageCms.Flags.NODEFAULTRESOURCEDEF` | ||
| ``ImageCms.FLAGS["GRIDPOINTS"]`` :py:attr:`.ImageCms.Flags.GRIDPOINTS()` | ||
| ``ImageCms.versions()`` :py:func:`PIL.features.version_module` with | ||
| ``feature="littlecms2"``, :py:data:`sys.version` or | ||
| :py:data:`sys.version_info`, and ``PIL.__version__`` | ||
| ===================================================== ============================================================ | ||
|
|
||
| TODO | ||
| ^^^^ | ||
|
|
||
| TODO | ||
|
|
||
| API Changes | ||
| =========== | ||
|
|
||
| TODO | ||
| ^^^^ | ||
|
|
||
| TODO | ||
|
|
||
| API Additions | ||
| ============= | ||
|
|
||
| TODO | ||
| ^^^^ | ||
|
|
||
| TODO | ||
|
|
||
| Security | ||
| ======== | ||
|
|
||
| TODO | ||
| ^^^^ | ||
|
|
||
| TODO | ||
|
|
||
| Other Changes | ||
| ============= | ||
|
|
||
| TODO | ||
| ^^^^ | ||
|
|
||
| TODO | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,8 +20,10 @@ | |
| import sys | ||
| from enum import IntEnum, IntFlag | ||
| from functools import reduce | ||
| from typing import Any | ||
|
|
||
| from . import Image | ||
| from ._deprecate import deprecate | ||
|
|
||
| try: | ||
| from . import _imagingcms | ||
|
|
@@ -32,7 +34,7 @@ | |
|
|
||
| _imagingcms = DeferredError.new(ex) | ||
|
|
||
| DESCRIPTION = """ | ||
| _DESCRIPTION = """ | ||
|
Member
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. When removing this constant, is there any important info in this text we should keep somewhere?
Contributor
Author
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.
This should probably be turned into a comment - I've pushed a commit. There are also links to https://www.cazabon.com/pyCMS and https://www.littlecms.com. I'm not sure these need to be kept; https://www.cazabon.com/pyCMS is the first result I get on Google for "Kevin Cazabon's PyCMS library" in a private window. Otherwise, it just duplicates information from comments in |
||
| pyCMS | ||
|
|
||
| a Python / PIL interface to the littleCMS ICC Color Management System | ||
|
|
@@ -95,7 +97,22 @@ | |
|
|
||
| """ | ||
|
|
||
| VERSION = "1.0.0 pil" | ||
| _VERSION = "1.0.0 pil" | ||
|
|
||
|
|
||
| def __getattr__(name: str) -> Any: | ||
| if name == "DESCRIPTION": | ||
| deprecate("PIL.ImageCms.DESCRIPTION", 12) | ||
| return _DESCRIPTION | ||
| elif name == "VERSION": | ||
| deprecate("PIL.ImageCms.VERSION", 12) | ||
| return _VERSION | ||
| elif name == "FLAGS": | ||
| deprecate("PIL.ImageCms.FLAGS", 12, "PIL.ImageCms.Flags") | ||
| return _FLAGS | ||
| msg = f"module '{__name__}' has no attribute '{name}'" | ||
| raise AttributeError(msg) | ||
|
|
||
|
|
||
| # --------------------------------------------------------------------. | ||
|
|
||
|
|
@@ -184,7 +201,7 @@ def GRIDPOINTS(n: int) -> Flags: | |
| _MAX_FLAG = reduce(operator.or_, Flags) | ||
|
|
||
|
|
||
| FLAGS = { | ||
| _FLAGS = { | ||
| "MATRIXINPUT": 1, | ||
| "MATRIXOUTPUT": 2, | ||
| "MATRIXONLY": (1 | 2), | ||
|
|
@@ -1064,4 +1081,9 @@ def versions(): | |
| (pyCMS) Fetches versions. | ||
| """ | ||
|
|
||
| return VERSION, core.littlecms_version, sys.version.split()[0], Image.__version__ | ||
| deprecate( | ||
| "PIL.ImageCms.versions()", | ||
| 12, | ||
| '(PIL.features.version("littlecms2"), sys.version, PIL.__version__)', | ||
| ) | ||
| return _VERSION, core.littlecms_version, sys.version.split()[0], Image.__version__ | ||
Uh oh!
There was an error while loading. Please reload this page.