1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6
7 # build-system
8 hatchling,
9
10 # dependencies
11 deprecated,
12 matplotlib,
13 nibabel,
14 numpy,
15 packaging,
16 rich,
17 scipy,
18 simpleitk,
19 torch,
20 tqdm,
21 typer,
22
23 # tests
24 humanize,
25 parameterized,
26 pytestCheckHook,
27}:
28
29buildPythonPackage rec {
30 pname = "torchio";
31 version = "0.20.6";
32 pyproject = true;
33
34 src = fetchFromGitHub {
35 owner = "TorchIO-project";
36 repo = "torchio";
37 tag = "v${version}";
38 hash = "sha256-240MM9w0AdhaUp70JrkmKGQI1abrFrbfybCF4wYX8fg=";
39 };
40
41 build-system = [
42 hatchling
43 ];
44
45 dependencies = [
46 deprecated
47 humanize
48 nibabel
49 numpy
50 packaging
51 rich
52 scipy
53 simpleitk
54 torch
55 tqdm
56 typer
57 ];
58
59 nativeCheckInputs = [
60 matplotlib
61 parameterized
62 pytestCheckHook
63 ];
64
65 disabledTests =
66 [
67 # tries to download models:
68 "test_load_all"
69 ]
70 ++ lib.optionals stdenv.hostPlatform.isAarch64 [
71 # RuntimeError: DataLoader worker (pid(s) <...>) exited unexpectedly
72 "test_queue_multiprocessing"
73 ];
74
75 pythonImportsCheck = [
76 "torchio"
77 "torchio.data"
78 ];
79
80 meta = {
81 description = "Medical imaging toolkit for deep learning";
82 homepage = "https://torchio.readthedocs.io";
83 changelog = "https://github.com/TorchIO-project/torchio/blob/${src.tag}/CHANGELOG.md";
84 license = lib.licenses.asl20;
85 maintainers = [ lib.maintainers.bcdarwin ];
86 };
87}