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