Unverified Commit 2275ce45 authored by OTABI Tomoya's avatar OTABI Tomoya Committed by GitHub
Browse files

Merge pull request #249674 from natsukium/skimage/update

python310Packages.scikit-image: 0.19.3 -> 0.21.0
parents 2a242982 b8f14787
Loading
Loading
Loading
Loading
+0 −17
Original line number Diff line number Diff line
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')
+67 −18
Original line number Diff line number Diff line
@@ -3,53 +3,98 @@
, fetchFromGitHub
, buildPythonPackage
, python
, pythonOlder
, astropy
, cloudpickle
, cython
, pythran
, numpy
, scipy
, dask
, imageio
, lazy-loader
, matplotlib
, meson-python
, networkx
, six
, numpy
, packaging
, pillow
, pooch
, pyamg
, pytestCheckHook
, pythran
, pywavelets
, dask
, cloudpickle
, imageio
, scikit-learn
, scipy
, setuptools
, simpleitk
, six
, tifffile
, pytestCheckHook
, 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
    ];

    postPatch = ''
      patchShebangs skimage/_build_utils/{version,cythoner}.py
    '';

    nativeBuildInputs = [ cython pythran ];
    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 ];
    };
+30 −0
Original line number Diff line number Diff line
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(