Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-cmyt for openSUSE:Factory checked in at 2023-10-10 20:59:26 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-cmyt (Old) and /work/SRC/openSUSE:Factory/.python-cmyt.new.28202 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-cmyt" Tue Oct 10 20:59:26 2023 rev:2 rq:1116420 version:2.0.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-cmyt/python-cmyt.changes 2023-10-04 22:32:49.466618615 +0200 +++ /work/SRC/openSUSE:Factory/.python-cmyt.new.28202/python-cmyt.changes 2023-10-10 20:59:50.629089295 +0200 @@ -1,0 +2,7 @@ +Mon Oct 9 06:01:30 UTC 2023 - OndÅej Súkup <mimi...@gmail.com> + +- update to 2.0.0 + * rename private module to clarify that it's not part of public API + * cycle out deprecated function from private module + +------------------------------------------------------------------- Old: ---- cmyt-1.4.0.tar.gz New: ---- cmyt-2.0.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-cmyt.spec ++++++ --- /var/tmp/diff_new_pack.FbwNYH/_old 2023-10-10 20:59:52.725165305 +0200 +++ /var/tmp/diff_new_pack.FbwNYH/_new 2023-10-10 20:59:52.725165305 +0200 @@ -17,23 +17,23 @@ Name: python-cmyt -Version: 1.4.0 +Version: 2.0.0 Release: 0 Summary: A collection of Matplotlib colormaps from the yt project License: BSD-3-Clause URL: https://github.com/yt-project/cmyt Source: https://files.pythonhosted.org/packages/source/c/cmyt/cmyt-%{version}.tar.gz -BuildRequires: python-rpm-macros -BuildRequires: %{python_module pip} -BuildRequires: %{python_module wheel} -BuildRequires: %{python_module pytest} BuildRequires: %{python_module colorspacious} -BuildRequires: %{python_module pytest-mpl} BuildRequires: %{python_module matplotlib} BuildRequires: %{python_module numpy} -Requires: python-numpy -Requires: python-matplotlib +BuildRequires: %{python_module pip} +BuildRequires: %{python_module pytest-mpl} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module wheel} BuildRequires: fdupes +BuildRequires: python-rpm-macros +Requires: python-matplotlib +Requires: python-numpy BuildArch: noarch %python_subpackages ++++++ cmyt-1.4.0.tar.gz -> cmyt-2.0.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmyt-1.4.0/PKG-INFO new/cmyt-2.0.0/PKG-INFO --- old/cmyt-1.4.0/PKG-INFO 2023-09-17 08:54:09.694593700 +0200 +++ new/cmyt-2.0.0/PKG-INFO 2023-10-04 08:37:44.466420200 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: cmyt -Version: 1.4.0 +Version: 2.0.0 Summary: A collection of Matplotlib colormaps from the yt project Author-email: The yt project <yt-...@python.org> License: BSD 3-Clause diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmyt-1.4.0/cmyt/__init__.py new/cmyt-2.0.0/cmyt/__init__.py --- old/cmyt-1.4.0/cmyt/__init__.py 2023-09-17 08:54:00.000000000 +0200 +++ new/cmyt-2.0.0/cmyt/__init__.py 2023-10-04 08:37:32.000000000 +0200 @@ -1,3 +1,3 @@ from .cm import * -__version__ = "1.4.0" +__version__ = "2.0.0" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmyt-1.4.0/cmyt/_utils.py new/cmyt-2.0.0/cmyt/_utils.py --- old/cmyt-1.4.0/cmyt/_utils.py 1970-01-01 01:00:00.000000000 +0100 +++ new/cmyt-2.0.0/cmyt/_utils.py 2023-10-04 08:37:32.000000000 +0200 @@ -0,0 +1,169 @@ +import os +from collections.abc import Iterable, Sequence +from typing import TYPE_CHECKING, Any, Final, Literal, Optional + +import matplotlib as mpl +import numpy as np +from matplotlib.colors import Colormap, LinearSegmentedColormap, ListedColormap + +# type aliases + +if TYPE_CHECKING: + from matplotlib.axes import Axes + from matplotlib.figure import Figure + +_CMYT_PREFIX: Final[str] = "cmyt." + +ColorDict = dict[Literal["red", "green", "blue", "alpha"], Sequence[tuple[float, ...]]] + +# this is used in cmyt.cm to programmatically import all cmaps +cmyt_cmaps = frozenset( + ( + "algae", + "apricity", + "arbre", + "dusk", + "kelp", + "octarine", + "pastel", + "pixel_blue", + "pixel_green", + "pixel_red", + "xray", + ) +) + + +def prefix_name(name: str) -> str: + if not name.startswith(_CMYT_PREFIX): + return f"{_CMYT_PREFIX}{name}" + return name + + +def register_colormap( + name: str, + *, + color_dict: Optional[ColorDict] = None, + colors: Optional[np.ndarray] = None, +) -> tuple[Colormap, Colormap]: + name = prefix_name(name) + + if color_dict is not None and colors is not None: + raise TypeError("Either color_dict or colors must be provided, but not both") + # register to MPL + cmap: Colormap + if color_dict is not None: + cmap = LinearSegmentedColormap(name=name, segmentdata=color_dict, N=256) + elif colors is not None: + cmap = ListedColormap(colors, name=name, N=256) + else: + raise TypeError("color_dict or colors must be provided") + + cmap_r = cmap.reversed() + mpl.colormaps.register(cmap) + mpl.colormaps.register(cmap_r) + + # return cmaps with unprefixed names for registration as importable objects + cmap.name = cmap.name.removeprefix(_CMYT_PREFIX) + cmap_r.name = cmap_r.name.removeprefix(_CMYT_PREFIX) + return cmap, cmap_r + + +graySCALE_CONVERSION_SPACE = "JCh" + + +def to_grayscale(sRGB1: np.ndarray) -> np.ndarray: + # this is adapted from viscm 0.8 + from colorspacious import cspace_converter # type: ignore[import] + + _sRGB1_to_JCh = cspace_converter("sRGB1", graySCALE_CONVERSION_SPACE) + _JCh_to_sRGB1 = cspace_converter(graySCALE_CONVERSION_SPACE, "sRGB1") + + JCh = _sRGB1_to_JCh(sRGB1) + JCh[..., 1] = 0 + return np.clip(_JCh_to_sRGB1(JCh), 0, 1) + + +def show_cmap(ax: "Axes", rgb: np.ndarray) -> None: + # this is adapted from viscm 0.8 + ax.imshow(rgb[np.newaxis, ...], aspect="auto") + + +def get_rgb(cmap: Colormap) -> np.ndarray: + # this is adapted from viscm 0.8 + from matplotlib.colors import ListedColormap + + RGB: np.ndarray[Any, Any] + if isinstance(cmap, ListedColormap) and cmap.N >= 100: + RGB = np.asarray(cmap.colors)[:, :3] + else: + x = np.linspace(0, 1, 155) + RGB = cmap(x)[:, :3] + return RGB + + +def create_cmap_overview( + *, + subset: Optional[Iterable[str]] = None, + filename: Optional[str] = None, + with_grayscale: bool = False, +) -> "Figure": + # the name of this function is inspired from the cmasher library + # but the actual content comes from yt + """ + Displays the colormaps available to cmyt. Note, most functions can use + both the matplotlib and the native cmyt colormaps; however, there are + some special functions existing within image_writer.py (e.g. write_image() + write_bitmap(), etc.), which cannot access the matplotlib + colormaps. + + In addition to the colormaps listed, one can access the reverse of each + colormap by appending a "_r" to any map. + + To only see certain colormaps, use the subset keyword argument. + + Parameters + ---------- + + subset : list of strings, optional + A list of colormap names to render. + By default, show all cmyt colormaps, skipping their reversed ("_r") versions. + + filename : str, optional + If filename is set, save the resulting image to a file. + Otherwise, the image is displayed as a interactive matplotlib window. + + with_grayscale: bool + Whether to display a grayscale version of each colorbar on top of the + colorful version. This flag requires matplotlib 3.0 or greater. + Defaults to False. + """ + import matplotlib.pyplot as plt + + cmaps = sorted(prefix_name(_) for _ in (subset or cmyt_cmaps)) + if not cmaps: + raise ValueError(f"Received invalid or empty subset: {subset}") + + # scale the image size by the number of cmaps + fig, axes = plt.subplots(nrows=len(cmaps), figsize=(6, 2.6 * len(cmaps) / 10.0)) + + for name, ax in zip(cmaps, axes): + RGBs = [get_rgb(plt.get_cmap(name))] + _axes = [ax] + if with_grayscale: + RGBs.append(to_grayscale(RGBs[0])) + _axes.append(ax.inset_axes([0, 1, 0.999999, 0.3])) + + for rgb, _ax in zip(RGBs, _axes): + _ax.axis("off") + show_cmap(_ax, rgb) + ax.text( + ax.get_xlim()[1] * 1.02, 0, name.removeprefix(_CMYT_PREFIX), fontsize=10 + ) + + fig.tight_layout(h_pad=0.2) + fig.subplots_adjust(top=0.9, bottom=0.05, right=0.85, left=0.05) + if filename is not None: + fig.savefig(os.fspath(filename), dpi=200) + + return fig diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmyt-1.4.0/cmyt/cm.py new/cmyt-2.0.0/cmyt/cm.py --- old/cmyt-1.4.0/cmyt/cm.py 2023-09-17 08:54:00.000000000 +0200 +++ new/cmyt-2.0.0/cmyt/cm.py 2023-10-04 08:37:32.000000000 +0200 @@ -1,6 +1,6 @@ from importlib import import_module -from cmyt.utils import cmyt_cmaps, register_colormap +from cmyt._utils import cmyt_cmaps, register_colormap for name in cmyt_cmaps: # register to MPL diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmyt-1.4.0/cmyt/utils.py new/cmyt-2.0.0/cmyt/utils.py --- old/cmyt-1.4.0/cmyt/utils.py 2023-09-17 08:54:00.000000000 +0200 +++ new/cmyt-2.0.0/cmyt/utils.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,189 +0,0 @@ -import os -import warnings -from collections.abc import Iterable, Sequence -from typing import TYPE_CHECKING, Any, Final, Literal, Optional - -import matplotlib as mpl -import numpy as np -from matplotlib.colors import Colormap, LinearSegmentedColormap, ListedColormap - -# type aliases - -if TYPE_CHECKING: - from matplotlib.axes import Axes - from matplotlib.figure import Figure - -_CMYT_PREFIX: Final[str] = "cmyt." - -ColorDict = dict[Literal["red", "green", "blue", "alpha"], Sequence[tuple[float, ...]]] - -# this is used in cmyt.cm to programmatically import all cmaps -cmyt_cmaps = frozenset( - ( - "algae", - "apricity", - "arbre", - "dusk", - "kelp", - "octarine", - "pastel", - "pixel_blue", - "pixel_green", - "pixel_red", - "xray", - ) -) - - -def prefix_name(name: str) -> str: - if not name.startswith(_CMYT_PREFIX): - return f"{_CMYT_PREFIX}{name}" - return name - - -def unprefix_name(name: str) -> str: - """ - Examples - -------- - >>> unprefix_name("cmyt.arbre") - 'arbre' - >>> unprefix_name("arbre") - 'arbre' - """ - warnings.warn( - "cmyt.utils.unprefix_name is deprecated since version 1.4.0 " - "and will be removed in a future version. " - "Instead, use name.removeprefix('cmyt.')", - category=DeprecationWarning, - stacklevel=2, - ) - return name.removeprefix(_CMYT_PREFIX) - - -def register_colormap( - name: str, - *, - color_dict: Optional[ColorDict] = None, - colors: Optional[np.ndarray] = None, -) -> tuple[Colormap, Colormap]: - name = prefix_name(name) - - if color_dict is not None and colors is not None: - raise TypeError("Either color_dict or colors must be provided, but not both") - # register to MPL - cmap: Colormap - if color_dict is not None: - cmap = LinearSegmentedColormap(name=name, segmentdata=color_dict, N=256) - elif colors is not None: - cmap = ListedColormap(colors, name=name, N=256) - else: - raise TypeError("color_dict or colors must be provided") - - cmap_r = cmap.reversed() - mpl.colormaps.register(cmap) - mpl.colormaps.register(cmap_r) - - # return cmaps with unprefixed names for registration as importable objects - cmap.name = cmap.name.removeprefix(_CMYT_PREFIX) - cmap_r.name = cmap_r.name.removeprefix(_CMYT_PREFIX) - return cmap, cmap_r - - -graySCALE_CONVERSION_SPACE = "JCh" - - -def to_grayscale(sRGB1: np.ndarray) -> np.ndarray: - # this is adapted from viscm 0.8 - from colorspacious import cspace_converter # type: ignore[import] - - _sRGB1_to_JCh = cspace_converter("sRGB1", graySCALE_CONVERSION_SPACE) - _JCh_to_sRGB1 = cspace_converter(graySCALE_CONVERSION_SPACE, "sRGB1") - - JCh = _sRGB1_to_JCh(sRGB1) - JCh[..., 1] = 0 - return np.clip(_JCh_to_sRGB1(JCh), 0, 1) - - -def show_cmap(ax: "Axes", rgb: np.ndarray) -> None: - # this is adapted from viscm 0.8 - ax.imshow(rgb[np.newaxis, ...], aspect="auto") - - -def get_rgb(cmap: Colormap) -> np.ndarray: - # this is adapted from viscm 0.8 - from matplotlib.colors import ListedColormap - - RGB: np.ndarray[Any, Any] - if isinstance(cmap, ListedColormap) and cmap.N >= 100: - RGB = np.asarray(cmap.colors)[:, :3] - else: - x = np.linspace(0, 1, 155) - RGB = cmap(x)[:, :3] - return RGB - - -def create_cmap_overview( - *, - subset: Optional[Iterable[str]] = None, - filename: Optional[str] = None, - with_grayscale: bool = False, -) -> "Figure": - # the name of this function is inspired from the cmasher library - # but the actual content comes from yt - """ - Displays the colormaps available to cmyt. Note, most functions can use - both the matplotlib and the native cmyt colormaps; however, there are - some special functions existing within image_writer.py (e.g. write_image() - write_bitmap(), etc.), which cannot access the matplotlib - colormaps. - - In addition to the colormaps listed, one can access the reverse of each - colormap by appending a "_r" to any map. - - To only see certain colormaps, use the subset keyword argument. - - Parameters - ---------- - - subset : list of strings, optional - A list of colormap names to render. - By default, show all cmyt colormaps, skipping their reversed ("_r") versions. - - filename : str, optional - If filename is set, save the resulting image to a file. - Otherwise, the image is displayed as a interactive matplotlib window. - - with_grayscale: bool - Whether to display a grayscale version of each colorbar on top of the - colorful version. This flag requires matplotlib 3.0 or greater. - Defaults to False. - """ - import matplotlib.pyplot as plt - - cmaps = sorted(prefix_name(_) for _ in (subset or cmyt_cmaps)) - if not cmaps: - raise ValueError(f"Received invalid or empty subset: {subset}") - - # scale the image size by the number of cmaps - fig, axes = plt.subplots(nrows=len(cmaps), figsize=(6, 2.6 * len(cmaps) / 10.0)) - - for name, ax in zip(cmaps, axes): - RGBs = [get_rgb(plt.get_cmap(name))] - _axes = [ax] - if with_grayscale: - RGBs.append(to_grayscale(RGBs[0])) - _axes.append(ax.inset_axes([0, 1, 0.999999, 0.3])) - - for rgb, _ax in zip(RGBs, _axes): - _ax.axis("off") - show_cmap(_ax, rgb) - ax.text( - ax.get_xlim()[1] * 1.02, 0, name.removeprefix(_CMYT_PREFIX), fontsize=10 - ) - - fig.tight_layout(h_pad=0.2) - fig.subplots_adjust(top=0.9, bottom=0.05, right=0.85, left=0.05) - if filename is not None: - fig.savefig(os.fspath(filename), dpi=200) - - return fig diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmyt-1.4.0/cmyt.egg-info/PKG-INFO new/cmyt-2.0.0/cmyt.egg-info/PKG-INFO --- old/cmyt-1.4.0/cmyt.egg-info/PKG-INFO 2023-09-17 08:54:09.000000000 +0200 +++ new/cmyt-2.0.0/cmyt.egg-info/PKG-INFO 2023-10-04 08:37:44.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: cmyt -Version: 1.4.0 +Version: 2.0.0 Summary: A collection of Matplotlib colormaps from the yt project Author-email: The yt project <yt-...@python.org> License: BSD 3-Clause diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmyt-1.4.0/cmyt.egg-info/SOURCES.txt new/cmyt-2.0.0/cmyt.egg-info/SOURCES.txt --- old/cmyt-1.4.0/cmyt.egg-info/SOURCES.txt 2023-09-17 08:54:09.000000000 +0200 +++ new/cmyt-2.0.0/cmyt.egg-info/SOURCES.txt 2023-10-04 08:37:44.000000000 +0200 @@ -2,8 +2,8 @@ README.md pyproject.toml cmyt/__init__.py +cmyt/_utils.py cmyt/cm.py -cmyt/utils.py cmyt.egg-info/PKG-INFO cmyt.egg-info/SOURCES.txt cmyt.egg-info/dependency_links.txt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmyt-1.4.0/pyproject.toml new/cmyt-2.0.0/pyproject.toml --- old/cmyt-1.4.0/pyproject.toml 2023-09-17 08:54:00.000000000 +0200 +++ new/cmyt-2.0.0/pyproject.toml 2023-10-04 08:37:32.000000000 +0200 @@ -88,9 +88,7 @@ [tool.pytest.ini_options] filterwarnings = [ "error", - # already patched (but not released) upstream: - # https://github.com/dateutil/dateutil/pull/1285 - 'ignore:datetime.datetime.utcfromtimestamp\(\) is deprecated and scheduled for removal in a future version:DeprecationWarning', + 'ignore:datetime\.datetime\.utcfromtimestamp\(\) is deprecated:DeprecationWarning', # https://github.com/dateutil/dateutil/pull/1285 ] addopts = "--doctest-modules" testpaths = ["tests"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmyt-1.4.0/tests/test_integration.py new/cmyt-2.0.0/tests/test_integration.py --- old/cmyt-1.4.0/tests/test_integration.py 2023-09-17 08:54:00.000000000 +0200 +++ new/cmyt-2.0.0/tests/test_integration.py 2023-10-04 08:37:32.000000000 +0200 @@ -3,7 +3,7 @@ import pytest import cmyt -from cmyt.utils import cmyt_cmaps, prefix_name +from cmyt._utils import cmyt_cmaps, prefix_name mpl_compare = pytest.mark.mpl_image_compare( savefig_kwargs={"bbox_inches": "tight"}, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmyt-1.4.0/tests/test_utils.py new/cmyt-2.0.0/tests/test_utils.py --- old/cmyt-1.4.0/tests/test_utils.py 2023-09-17 08:54:00.000000000 +0200 +++ new/cmyt-2.0.0/tests/test_utils.py 2023-10-04 08:37:32.000000000 +0200 @@ -1,7 +1,7 @@ import pytest import cmyt # noqa: F401 -from cmyt.utils import create_cmap_overview +from cmyt._utils import create_cmap_overview mpl_compare = pytest.mark.mpl_image_compare( savefig_kwargs={"bbox_inches": "tight"},