1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6 pytestCheckHook,
7 pytest-cov-stub,
8 lxml,
9 matplotlib,
10 networkx,
11 pandas,
12 requests,
13 setuptools,
14}:
15
16buildPythonPackage rec {
17 pname = "pyxnat";
18 version = "1.6.3";
19 pyproject = true;
20
21 disabled = pythonOlder "3.8";
22
23 # PyPI dist missing test configuration files:
24 src = fetchFromGitHub {
25 owner = "pyxnat";
26 repo = "pyxnat";
27 tag = version;
28 hash = "sha256-peyQQ1fc+0O1I9LztYSgk2VBC17Y3UlOZGR2WSYKVTk=";
29 };
30
31 build-system = [ setuptools ];
32
33 propagatedBuildInputs = [
34 lxml
35 requests
36 ];
37
38 # pathlib is installed part of python38+ w/o an external package
39 prePatch = ''
40 substituteInPlace setup.py --replace-fail "pathlib>=1.0" ""
41 '';
42
43 nativeCheckInputs = [
44 pytestCheckHook
45 pytest-cov-stub
46 matplotlib
47 networkx
48 pandas
49 ];
50 preCheck = ''
51 export PYXNAT_SKIP_NETWORK_TESTS=1
52 '';
53 enabledTestPaths = [ "pyxnat" ];
54 disabledTestPaths = [
55 # require a running local XNAT instance e.g. in a docker container:
56 "pyxnat/tests/attributes_test.py"
57 "pyxnat/tests/custom_variables_test.py"
58 "pyxnat/tests/interfaces_test.py"
59 "pyxnat/tests/pipelines_test.py"
60 "pyxnat/tests/provenance_test.py"
61 "pyxnat/tests/prearchive_test.py"
62 "pyxnat/tests/repr_test.py"
63 "pyxnat/tests/resources_test.py"
64 "pyxnat/tests/search_test.py"
65 "pyxnat/tests/sessionmirror_test.py"
66 "pyxnat/tests/test_resource_functions.py"
67 "pyxnat/tests/user_and_project_management_test.py"
68 ];
69 disabledTests = [
70 # try to access network even though PYXNAT_SKIP_NETWORK_TESTS is set:
71 "test_inspector_structure"
72 "test_project_manager"
73 ];
74
75 pythonImportsCheck = [ "pyxnat" ];
76
77 meta = with lib; {
78 homepage = "https://pyxnat.github.io/pyxnat";
79 description = "Python API to XNAT";
80 mainProgram = "sessionmirror.py";
81 changelog = "https://github.com/pyxnat/pyxnat/releases/tag/${src.tag}";
82 license = licenses.bsd3;
83 maintainers = with maintainers; [ bcdarwin ];
84 };
85}