python3Packages.scikitimage: 0.18.1 -> 0.18.3 (#137038)

This commit is contained in:
Alexander Kiselyov
2021-11-12 17:17:20 +01:00
committed by GitHub
parent 3eb0440e13
commit 72b193e7c1
2 changed files with 70 additions and 9 deletions
@@ -0,0 +1,17 @@
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')
@@ -1,6 +1,7 @@
{ lib
, fetchPypi
, fetchFromGitHub
, buildPythonPackage
, python
, cython
, numpy
, scipy
@@ -11,20 +12,26 @@
, pywavelets
, dask
, cloudpickle
, pytest
, imageio
, tifffile
, pytestCheckHook
}:
buildPythonPackage rec {
let
installedPackageRoot = "${builtins.placeholder "out"}/${python.sitePackages}";
in buildPythonPackage rec {
pname = "scikit-image";
version = "0.18.3";
src = fetchPypi {
inherit pname version;
sha256 = "ecae99f93f4c5e9b1bf34959f4dc596c41f2f6b2fc407d9d9ddf85aebd3137ca";
src = fetchFromGitHub {
owner = pname;
repo = pname;
rev = "v${version}";
sha256 = "0a2h3bw5rkk23k4r04qc9maccg00nddssd7lfsps8nhp5agk1vyh";
};
patches = [ ./add-testing-data.patch ];
nativeBuildInputs = [ cython ];
propagatedBuildInputs = [
@@ -41,14 +48,51 @@ buildPythonPackage rec {
tifffile
];
checkInputs = [ pytest ];
checkInputs = [ pytestCheckHook ];
# No tests in archive
doCheck = false;
# (1) The package has cythonized modules, whose .so libs will appear only in the wheel, i.e. in nix store;
# (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;
# (3) Therefore, tests should be run on the installed package in nix store.
# See e.g. https://discourse.nixos.org/t/cant-import-cythonized-modules-at-checkphase/14207 on why the following is needed.
preCheck = ''
rm -r skimage
'';
disabledTestPaths = [
# 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).
"${installedPackageRoot}/skimage/filters/rank/tests/test_rank.py"
];
pytestFlagsArray = [ "${installedPackageRoot}" "--pyargs" "skimage" ] ++ builtins.map (testid: "--deselect=" + testid) [
# These tests require network access
"skimage/data/test_data.py::test_skin"
"skimage/data/tests/test_data.py::test_skin"
"skimage/io/tests/test_io.py::test_imread_http_url"
"skimage/restoration/tests/test_rolling_ball.py::test_ndim"
];
# Check cythonized modules
pythonImportsCheck = [
"skimage"
"skimage._shared"
"skimage.draw"
"skimage.feature"
"skimage.restoration"
"skimage.filters"
"skimage.future.graph"
"skimage.graph"
"skimage.io"
"skimage.measure"
"skimage.morphology"
"skimage.transform"
"skimage.util"
"skimage.segmentation"
];
meta = {
description = "Image processing routines for SciPy";
homepage = "https://scikit-image.org";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ yl3dy ];
};
}