anki-bin: 24.06.3 -> 24.11 (#360722)
[NixPkgs.git] / pkgs / development / python-modules / imageio / default.nix
blob8ce6d5d4f4ec7713577f7a67a31d377ae4492d82
2   lib,
3   stdenv,
4   buildPythonPackage,
5   fetchFromGitHub,
6   isPyPy,
7   substituteAll,
9   # build-system
10   setuptools,
12   # native dependencies
13   libGL,
15   # dependencies
16   numpy,
17   pillow,
19   # optional-dependencies
20   astropy,
21   av,
22   imageio-ffmpeg,
23   pillow-heif,
24   psutil,
25   tifffile,
27   # tests
28   pytestCheckHook,
29   fsspec,
32 buildPythonPackage rec {
33   pname = "imageio";
34   version = "2.36.0";
35   pyproject = true;
37   src = fetchFromGitHub {
38     owner = "imageio";
39     repo = "imageio";
40     rev = "refs/tags/v${version}";
41     hash = "sha256-dQrAVPXtDdibaxxfqW29qY7j5LyegvmI0Y7/btXmsyY=";
42   };
44   patches = lib.optionals (!stdenv.hostPlatform.isDarwin) [
45     (substituteAll {
46       src = ./libgl-path.patch;
47       libgl = "${libGL.out}/lib/libGL${stdenv.hostPlatform.extensions.sharedLibrary}";
48     })
49   ];
51   build-system = [ setuptools ];
53   dependencies = [
54     numpy
55     pillow
56   ];
58   optional-dependencies = {
59     bsdf = [ ];
60     dicom = [ ];
61     feisem = [ ];
62     ffmpeg = [
63       imageio-ffmpeg
64       psutil
65     ];
66     fits = lib.optionals (!isPyPy) [ astropy ];
67     freeimage = [ ];
68     lytro = [ ];
69     numpy = [ ];
70     pillow = [ ];
71     simpleitk = [ ];
72     spe = [ ];
73     swf = [ ];
74     tifffile = [ tifffile ];
75     pyav = [ av ];
76     heif = [ pillow-heif ];
77   };
79   nativeCheckInputs = [
80     fsspec
81     psutil
82     pytestCheckHook
83   ] ++ fsspec.optional-dependencies.github ++ lib.flatten (builtins.attrValues optional-dependencies);
85   pytestFlagsArray = [ "-m 'not needs_internet'" ];
87   preCheck = ''
88     export IMAGEIO_USERDIR="$TMP"
89     export HOME=$TMPDIR
90   '';
92   disabledTestPaths = [
93     # tries to fetch fixtures over the network
94     "tests/test_freeimage.py"
95     "tests/test_pillow.py"
96     "tests/test_spe.py"
97     "tests/test_swf.py"
98   ];
100   disabledTests =
101     [
102       # Pillow 11.0.0 compat
103       # https://github.com/imageio/imageio/issues/1104
104       "test_gif"
105     ]
106     ++ lib.optionals stdenv.hostPlatform.isDarwin [
107       # Segmentation fault
108       "test_bayer_write"
109       # RuntimeError: No valid H.264 encoder was found with the ffmpeg installation
110       "test_writer_file_properly_closed"
111       "test_writer_pixelformat_size_verbose"
112       "test_writer_ffmpeg_params"
113       "test_reverse_read"
114     ];
116   meta = {
117     description = "Library for reading and writing a wide range of image, video, scientific, and volumetric data formats";
118     homepage = "https://imageio.readthedocs.io";
119     changelog = "https://github.com/imageio/imageio/blob/v${version}/CHANGELOG.md";
120     license = lib.licenses.bsd2;
121     maintainers = with lib.maintainers; [ Luflosi ];
122   };