From b8f147876cbec06749a7be7e907e2dad31954145 Mon Sep 17 00:00:00 2001 From: natsukium Date: Thu, 17 Aug 2023 12:15:23 +0900 Subject: [PATCH] python310Packages.scikit-image: 0.19.3 -> 0.21.0 Diff: https://github.com/scikit-image/scikit-image/compare/v0.19.3...v0.21.0 Changelog: https://github.com/scikit-image/scikit-image/releases/tag/v0.21.0 --- .../scikit-image/add-testing-data.patch | 17 ---- .../python-modules/scikit-image/default.nix | 91 ++++++++++++++----- .../suppress-deprecation-warning.patch | 30 ++++++ 3 files changed, 100 insertions(+), 38 deletions(-) delete mode 100644 pkgs/development/python-modules/scikit-image/add-testing-data.patch create mode 100644 pkgs/development/python-modules/scikit-image/suppress-deprecation-warning.patch diff --git a/pkgs/development/python-modules/scikit-image/add-testing-data.patch b/pkgs/development/python-modules/scikit-image/add-testing-data.patch deleted file mode 100644 index 60f9287f8b1c..000000000000 --- a/pkgs/development/python-modules/scikit-image/add-testing-data.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/skimage/data/setup.py b/skimage/data/setup.py -index 528e9c284ce..ba0e155559c 100644 ---- a/skimage/data/setup.py -+++ b/skimage/data/setup.py -@@ -11,7 +11,11 @@ def configuration(parent_package='', top_path=None): - # further notice. - # Testing data and additional datasets should only - # be made available via pooch -- config.add_data_files(*legacy_datasets) -+ # Nix patch: add ALL images to facilitate testing of a fully-built package -+ from pathlib import Path -+ config.add_data_files( -+ *(path.name for path in Path(__file__).parent.glob("*") if path.suffix != ".py") -+ ) - # It seems hard to create a consistent hash for README.txt since - # the line endings keep getting converted - config.add_data_files('README.txt') diff --git a/pkgs/development/python-modules/scikit-image/default.nix b/pkgs/development/python-modules/scikit-image/default.nix index 22c7387ff0d1..03eaf556050f 100644 --- a/pkgs/development/python-modules/scikit-image/default.nix +++ b/pkgs/development/python-modules/scikit-image/default.nix @@ -3,53 +3,98 @@ , fetchFromGitHub , buildPythonPackage , python -, cython -, pythran -, numpy -, scipy -, matplotlib -, networkx -, six -, pillow -, pywavelets -, dask +, pythonOlder +, astropy , cloudpickle +, cython +, dask , imageio -, tifffile +, lazy-loader +, matplotlib +, meson-python +, networkx +, numpy +, packaging +, pillow +, pooch +, pyamg , pytestCheckHook +, pythran +, pywavelets +, scikit-learn +, scipy +, setuptools +, simpleitk +, six +, tifffile +, wheel }: let installedPackageRoot = "${builtins.placeholder "out"}/${python.sitePackages}"; self = buildPythonPackage rec { pname = "scikit-image"; - version = "0.19.3"; + version = "0.21.0"; + format = "pyproject"; + + disabled = pythonOlder "3.8"; src = fetchFromGitHub { - owner = pname; - repo = pname; + owner = "scikit-image"; + repo = "scikit-image"; rev = "v${version}"; - hash = "sha256-zvXgZdvYycFbbMsBFSqMDzLanEtF9+JuVSQ3AM8/LQk="; + hash = "sha256-WJ2WNlcFCEtPr+bV/af6MoBBhbXDpOBEsJu4FmudoIo="; }; - patches = [ ./add-testing-data.patch ]; + patches = [ + # https://github.com/scikit-image/scikit-image/pull/7052 + # prepare a patch file because the commit contains additional changes + ./suppress-deprecation-warning.patch + ]; - nativeBuildInputs = [ cython pythran ]; + postPatch = '' + patchShebangs skimage/_build_utils/{version,cythoner}.py + ''; + + nativeBuildInputs = [ + cython + meson-python + numpy + packaging + pythran + setuptools + wheel + ]; propagatedBuildInputs = [ - cloudpickle - dask imageio + lazy-loader matplotlib networkx numpy + packaging pillow pywavelets scipy - six tifffile ]; + passthru.optional-dependencies = { + data = [ + pooch + ]; + optional = [ + astropy + cloudpickle + dask + matplotlib + pooch + pyamg + scikit-learn + simpleitk + ] ++ dask.optional-dependencies.array; + }; + # test suite is very cpu intensive, move to passthru.tests doCheck = false; nativeCheckInputs = [ pytestCheckHook ]; @@ -78,6 +123,10 @@ let "skimage/feature/tests/test_util.py::test_plot_matches" "skimage/filters/tests/test_thresholding.py::TestSimpleImage::test_try_all_threshold" "skimage/io/tests/test_mpl_imshow.py::" + ] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [ + # https://github.com/scikit-image/scikit-image/issues/7104 + "skimage/measure/tests/test_fit.py" + "skimage/measure/tests/test_moments.py" ]); # Check cythonized modules @@ -88,7 +137,6 @@ let "skimage.feature" "skimage.restoration" "skimage.filters" - "skimage.future.graph" "skimage.graph" "skimage.io" "skimage.measure" @@ -105,6 +153,7 @@ let meta = { description = "Image processing routines for SciPy"; homepage = "https://scikit-image.org"; + changelog = "https://github.com/scikit-image/scikit-image/releases/tag/${src.rev}"; license = lib.licenses.bsd3; maintainers = with lib.maintainers; [ yl3dy ]; }; diff --git a/pkgs/development/python-modules/scikit-image/suppress-deprecation-warning.patch b/pkgs/development/python-modules/scikit-image/suppress-deprecation-warning.patch new file mode 100644 index 000000000000..f51f1d9860a4 --- /dev/null +++ b/pkgs/development/python-modules/scikit-image/suppress-deprecation-warning.patch @@ -0,0 +1,30 @@ +diff --git a/skimage/exposure/tests/test_exposure.py b/skimage/exposure/tests/test_exposure.py +index ed8dd6bc8..8ec7d13bf 100644 +--- a/skimage/exposure/tests/test_exposure.py ++++ b/skimage/exposure/tests/test_exposure.py +@@ -368,19 +368,16 @@ def test_rescale_nan_warning(in_range, out_range): + ) + + # 2019/11/10 Passing NaN to np.clip raises a DeprecationWarning for +- # versions above 1.17 +- # TODO: Remove once NumPy removes this DeprecationWarning ++ # versions above 1.17, "|\A\Z" marks as optional warning ++ # TODO: Remove once NumPy 1.25.0 is minimal dependency + numpy_warning_1_17_plus = ( +- "Passing `np.nan` to mean no clipping in np.clip" ++ "|\\A\\ZPassing `np.nan` to mean no clipping in np.clip" + ) + +- if in_range == "image": +- exp_warn = [msg, numpy_warning_1_17_plus] +- else: +- exp_warn = [msg] ++ with expected_warnings([msg, numpy_warning_1_17_plus]): ++ result = exposure.rescale_intensity(image, in_range, out_range) + +- with expected_warnings(exp_warn): +- exposure.rescale_intensity(image, in_range, out_range) ++ assert np.all(np.isnan(result)) + + + @pytest.mark.parametrize(