35 installedPackageRoot = "${builtins.placeholder "out"}/${python.sitePackages}";
36 self = buildPythonPackage rec {
37 pname = "scikit-image";
41 disabled = pythonOlder "3.8";
43 src = fetchFromGitHub {
44 owner = "scikit-image";
45 repo = "scikit-image";
46 rev = "refs/tags/v${version}";
47 hash = "sha256-zhW7P2ss7n9LXRXiBMsifxCGGKXgZFbGLl3K4u4xzfE=";
51 patchShebangs skimage/_build_utils/{version,cythoner}.py
53 substituteInPlace pyproject.toml \
54 --replace "numpy>=2.0.0rc1" "numpy"
67 propagatedBuildInputs = [
80 optional-dependencies = {
91 ] ++ dask.optional-dependencies.array;
94 # test suite is very cpu intensive, move to passthru.tests
101 # (1) The package has cythonized modules, whose .so libs will appear only in the wheel, i.e. in nix store;
102 # (2) To stop Python from importing the wrong directory, i.e. the one in the build dir, not the one in nix store, `skimage` dir should be removed or renamed;
103 # (3) Therefore, tests should be run on the installed package in nix store.
105 # See e.g. https://discourse.nixos.org/t/cant-import-cythonized-modules-at-checkphase/14207 on why the following is needed.
110 disabledTestPaths = [
111 # Requires network access (actually some data is loaded via `skimage._shared.testing.fetch` in the global scope, which calls `pytest.skip` when a network is unaccessible, leading to a pytest collection error).
112 "${installedPackageRoot}/skimage/filters/rank/tests/test_rank.py"
116 "${installedPackageRoot}"
120 ++ builtins.map (testid: "--deselect=" + testid) (
122 # These tests require network access
123 "skimage/data/test_data.py::test_skin"
124 "skimage/data/tests/test_data.py::test_skin"
125 "skimage/io/tests/test_io.py::test_imread_http_url"
126 "skimage/restoration/tests/test_rolling_ball.py::test_ndim"
128 ++ lib.optionals stdenv.hostPlatform.isDarwin [
129 # Matplotlib tests are broken inside darwin sandbox
130 "skimage/feature/tests/test_util.py::test_plot_matches"
131 "skimage/filters/tests/test_thresholding.py::TestSimpleImage::test_try_all_threshold"
132 "skimage/io/tests/test_mpl_imshow.py::"
133 # See https://github.com/scikit-image/scikit-image/issues/7061 and https://github.com/scikit-image/scikit-image/issues/7104
134 "skimage/measure/tests/test_fit.py"
136 ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
137 # https://github.com/scikit-image/scikit-image/issues/7104
138 "skimage/measure/tests/test_moments.py"
142 # Check cythonized modules
143 pythonImportsCheck = [
148 "skimage.restoration"
156 "skimage.segmentation"
160 all-tests = self.override { doCheck = true; };
164 description = "Image processing routines for SciPy";
165 homepage = "https://scikit-image.org";
166 changelog = "https://github.com/scikit-image/scikit-image/releases/tag/${lib.removePrefix "refs/tags/" src.rev}";
167 license = lib.licenses.bsd3;
168 maintainers = with lib.maintainers; [ yl3dy ];