From 8aab3f78ade739bc49ec2604fd125a9689cc8316 Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Mon, 21 Feb 2022 21:16:07 +1300 Subject: [PATCH 01/11] Update intersection filtering in "colour.colorimetry.closest_spectral_locus_wavelength" definition. Closes #915. --- colour/colorimetry/dominant.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/colour/colorimetry/dominant.py b/colour/colorimetry/dominant.py index 122ee0fc7d..c6b3c60b2a 100644 --- a/colour/colorimetry/dominant.py +++ b/colour/colorimetry/dominant.py @@ -125,7 +125,9 @@ def closest_spectral_locus_wavelength( np.concatenate((xy_n, xy_e), -1), np.hstack([xy_s, np.roll(xy_s, 1, axis=0)]), ).xy - xy_wl = xy_wl[~np.isnan(xy_wl).any(axis=-1)] + # Extracting the first intersection per-wavelength. + xy_wl = np.sort(xy_wl, 1)[:, 0, :] + if not len(xy_wl): raise ValueError( f"No closest spectral locus wavelength index and coordinates " From cb5677eff75f00238ee34409121ae8f0ba01f89e Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Tue, 22 Feb 2022 20:59:28 +1300 Subject: [PATCH 02/11] Fix incorrect "setup.py" "extra_require" attribute. References #945 --- setup.py | 1 - tasks.py | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 2283bc691a..5c27fd42f6 100644 --- a/setup.py +++ b/setup.py @@ -139,7 +139,6 @@ ] extras_require = { - ':extra == "read-the-docs"': ["numpy>=1.19,<2"], "development": [ "biblib-simple", "black", diff --git a/tasks.py b/tasks.py index 873f92db3b..88c633da64 100644 --- a/tasks.py +++ b/tasks.py @@ -458,6 +458,7 @@ def sub_callable(match): ), source, ) + source = re.sub('{.*extra == "read-the-docs".*', "{", source) source = re.sub( "setup_kwargs = {(.*)}.*setup\\(\\*\\*setup_kwargs\\)", sub_callable, From 1b5bd5ead7065d003b7aaba9bc35d23b79d9ea5c Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Wed, 23 Feb 2022 20:10:10 +1300 Subject: [PATCH 03/11] Use "poetry.core" build backend. References #945. --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e05218d2f7..30a5644016 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -160,5 +160,5 @@ convention = "numpy" add-ignore = "D104,D200,D202,D205,D301,D400" [build-system] -requires = [ "poetry>=0.12" ] -build-backend = "poetry.masonry.api" +requires = ["poetry_core>=1.0.0"] +build-backend = "poetry.core.masonry.api" From a32b884cd38eefa7623168071e76bc061439a9f6 Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Thu, 24 Feb 2022 10:59:19 +1300 Subject: [PATCH 04/11] Mock "numpy.typing" import. Closes #946. --- colour/hints/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/colour/hints/__init__.py b/colour/hints/__init__.py index 65201b1a40..bfcdfd72df 100644 --- a/colour/hints/__init__.py +++ b/colour/hints/__init__.py @@ -10,7 +10,14 @@ from __future__ import annotations import numpy as np -import numpy.typing as npt + +# TODO: Drop mocking when minimal "Numpy" version is 1.20.x. +try: + import numpy.typing as npt +except ImportError: # pragma: no cover + from unittest import mock + + npt = mock.MagicMock() import re from types import ModuleType from typing import ( From aa2a70a1328cde597ea9e14aa09b6b64fb483f17 Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Thu, 24 Feb 2022 11:14:49 +1300 Subject: [PATCH 05/11] Handle "npt._NestedSequence" "AttributeError" exception with "Numpy" 1.2.0.x. References #946. --- colour/hints/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/colour/hints/__init__.py b/colour/hints/__init__.py index bfcdfd72df..832ff3eebd 100644 --- a/colour/hints/__init__.py +++ b/colour/hints/__init__.py @@ -170,7 +170,12 @@ # TODO: Revisit to use Protocol. Dataclass = Any -NestedSequence = npt._NestedSequence +# TODO: Drop mocking when minimal "Numpy" version is 1.21.x. +try: + NestedSequence = npt._NestedSequence +except AttributeError: + NestedSequence = Any # type: ignore[assignment, misc] + ArrayLike = npt.ArrayLike IntegerOrArrayLike = Union[Integer, ArrayLike] From e44216252ed82f92fd35b33634c83f7cb47a800b Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Sat, 26 Feb 2022 07:31:04 +1300 Subject: [PATCH 06/11] Fix incorrect "Numpy" require in "pyproject.toml" file. --- pyproject.toml | 1 - tasks.py | 1 - 2 files changed, 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 30a5644016..f292e2e20c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -130,7 +130,6 @@ plotting = [ "matplotlib" ] read-the-docs = [ "matplotlib", "networkx", - "numpy", "pydata-sphinx-theme", "pygraphviz", "sphinxcontrib-bibtex", diff --git a/tasks.py b/tasks.py index 88c633da64..873f92db3b 100644 --- a/tasks.py +++ b/tasks.py @@ -458,7 +458,6 @@ def sub_callable(match): ), source, ) - source = re.sub('{.*extra == "read-the-docs".*', "{", source) source = re.sub( "setup_kwargs = {(.*)}.*setup\\(\\*\\*setup_kwargs\\)", sub_callable, From 5131e15664ce6f979ffb54c77eef3b5520a39eea Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Sat, 26 Feb 2022 11:54:10 +1300 Subject: [PATCH 07/11] Update "requirements.txt" file. --- requirements.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/requirements.txt b/requirements.txt index cdf455995b..c798f36fa3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,7 +17,7 @@ cfgv==3.3.1 charset-normalizer==2.0.12 click==8.0.4 colorama==0.4.4 -coverage==6.3.1 +coverage==6.3.2 coveralls==3.3.1 cycler==0.11.0 debugpy==1.5.1 @@ -31,7 +31,7 @@ executing==0.8.2 filelock==3.6.0 flake8==4.0.1 flynt==0.76 -identify==2.4.10 +identify==2.4.11 idna==3.3 imageio==2.16.0 imagesize==1.3.0 @@ -39,7 +39,7 @@ importlib-metadata==4.11.1 iniconfig==1.1.1 invoke==1.6.0 ipykernel==6.9.1 -ipython==8.0.1 +ipython==8.1.0 ipython-genutils==0.2.0 ipywidgets==7.6.5 jedi==0.18.1 @@ -111,12 +111,12 @@ QtPy==2.0.1 readme-renderer==32.0 requests==2.27.1 requests-toolbelt==0.9.1 -restructuredtext-lint==1.3.2 +restructuredtext-lint==1.4.0 rfc3986==2.0.0 scikit-learn==1.0.2 scipy==1.8.0 Send2Trash==1.8.0 -setuptools==59.6.0 +setuptools==60.5.0 six==1.16.0 snowballstemmer==2.2.0 soupsieve==2.3.1 @@ -130,7 +130,7 @@ sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 stack-data==0.2.0 terminado==0.13.1 -testpath==0.5.0 +testpath==0.6.0 threadpoolctl==3.1.0 tokenize-rt==4.2.1 toml==0.10.2 @@ -138,14 +138,14 @@ tomli==2.0.1 tornado==6.1 tqdm==4.62.3 traitlets==5.1.1 -trimesh==3.10.0 +trimesh==3.10.2 twine==3.8.0 types-setuptools==57.4.9 typing_extensions==4.1.1 urllib3==1.26.8 -virtualenv==20.13.1 +virtualenv==20.13.2 wcwidth==0.2.5 webencodings==0.5.1 -wheel==0.37.0 +wheel==0.37.1 widgetsnbextension==3.5.2 zipp==3.7.0 From c8de2b080f030291470c26fedd6311c2ddd4ffd1 Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Sat, 26 Feb 2022 11:54:37 +1300 Subject: [PATCH 08/11] Update "setup.py" file. --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 5c27fd42f6..de9c0bd03d 100644 --- a/setup.py +++ b/setup.py @@ -134,6 +134,7 @@ install_requires = [ "imageio>=2,<3", + "numpy>=1.19,<2", "scipy>=1.5,<2", "typing-extensions>=4,<5", ] From 072a9c0976d1ca904dc8a6f29cfe98d25f406d15 Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Sat, 26 Feb 2022 11:54:48 +1300 Subject: [PATCH 09/11] Update "TODO.rst" file. --- TODO.rst | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/TODO.rst b/TODO.rst index 293d561b32..f871a5c86b 100644 --- a/TODO.rst +++ b/TODO.rst @@ -167,11 +167,13 @@ TODO - colour/hints/__init__.py - - Line 45 : # TODO: Drop "typing_extensions" when "Google Colab" uses Python >= 3.8. - - Line 160 : # TODO: Use "typing.Literal" when minimal Python version is raised to 3.8. - - Line 163 : # TODO: Revisit to use Protocol. - - Line 180 : # TODO: Use "numpy.typing.NDArray" when minimal Numpy version is raised to 1.21. - - Line 187 : # TODO: Drop when minimal Python is raised to 3.9. + - Line 14 : # TODO: Drop mocking when minimal "Numpy" version is 1.20.x. + - Line 52 : # TODO: Drop "typing_extensions" when "Google Colab" uses Python >= 3.8. + - Line 167 : # TODO: Use "typing.Literal" when minimal Python version is raised to 3.8. + - Line 170 : # TODO: Revisit to use Protocol. + - Line 173 : # TODO: Drop mocking when minimal "Numpy" version is 1.21.x. + - Line 192 : # TODO: Use "numpy.typing.NDArray" when minimal Numpy version is raised to 1.21. + - Line 199 : # TODO: Drop when minimal Python is raised to 3.9. - colour/algebra/interpolation.py From 147db3c3885e3cf132b3e584d1f3fc6131c87e39 Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Sat, 26 Feb 2022 12:13:27 +1300 Subject: [PATCH 10/11] Raise package version to 0.4.1. --- colour/__init__.py | 2 +- pyproject.toml | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/colour/__init__.py b/colour/__init__.py index 637734a4b7..97966d9a92 100644 --- a/colour/__init__.py +++ b/colour/__init__.py @@ -850,7 +850,7 @@ def __getattr__(self, attribute) -> Any: __major_version__ = "0" __minor_version__ = "4" -__change_version__ = "0" +__change_version__ = "1" __version__ = ".".join( (__major_version__, __minor_version__, __change_version__) ) diff --git a/pyproject.toml b/pyproject.toml index f292e2e20c..4eb3b429d6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "colour" -version = "0.4.0" +version = "0.4.1" description = "Colour Science for Python" license = "BSD-3-Clause" authors = [ "Colour Developers " ] diff --git a/setup.py b/setup.py index de9c0bd03d..46610f0281 100644 --- a/setup.py +++ b/setup.py @@ -183,7 +183,7 @@ setup( name="colour-science", - version="0.4.0", + version="0.4.1", description="Colour Science for Python", long_description=codecs.open("README.rst", encoding="utf8").read(), author="Colour Developers", From 7590561ce737e21b72e08b19c35815b0f09475f1 Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Sat, 26 Feb 2022 12:15:13 +1300 Subject: [PATCH 11/11] Update "zenodo" DOI badge. --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index d4267c2122..7d11b68cae 100644 --- a/README.rst +++ b/README.rst @@ -21,8 +21,8 @@ .. |version| image:: https://img.shields.io/pypi/v/colour-science.svg?style=flat-square :target: https://pypi.org/project/colour-science :alt: Package Version -.. |zenodo| image:: https://img.shields.io/badge/DOI-10.5281/zenodo.4445350-blue.svg?style=flat-square - :target: https://dx.doi.org/10.5281/zenodo.4445350 +.. |zenodo| image:: https://img.shields.io/badge/DOI-10.5281/zenodo.6288658-blue.svg?style=flat-square + :target: https://dx.doi.org/10.5281/zenodo.6288658 :alt: DOI .. end-badges