1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 pytestCheckHook,
6 pkg-config,
7 setuptools,
8 libjpeg,
9 libpng,
10 libtiff,
11 libwebp,
12 numpy,
13}:
14
15buildPythonPackage rec {
16 pname = "imread";
17 version = "0.7.6";
18 pyproject = true;
19
20 src = fetchPypi {
21 inherit pname version;
22 hash = "sha256-ULPXCJyGJQTCKyVu9R/kWFGzRhbbFMDr/FU2AByZYBU=";
23 };
24
25 build-system = [ setuptools ];
26
27 nativeBuildInputs = [ pkg-config ];
28
29 buildInputs = [
30 libjpeg
31 libpng
32 libtiff
33 libwebp
34 ];
35
36 dependencies = [ numpy ];
37
38 nativeCheckInputs = [ pytestCheckHook ];
39
40 pytestFlags = [
41 # verbose build outputs needed to debug hard-to-reproduce hydra failures
42 "-v"
43 "--pyargs"
44 "imread"
45 ];
46
47 pythonImportsCheck = [ "imread" ];
48
49 preCheck = ''
50 cd $TMPDIR
51 export HOME=$TMPDIR
52 export OMP_NUM_THREADS=1
53 '';
54
55 meta = with lib; {
56 description = "Python package to load images as numpy arrays";
57 homepage = "https://imread.readthedocs.io/";
58 changelog = "https://github.com/luispedro/imread/blob/v${version}/ChangeLog";
59 maintainers = with maintainers; [ luispedro ];
60 license = licenses.mit;
61 platforms = platforms.unix;
62 };
63}