summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pyxnat/default.nix
blob: 810aa7a736dc1afd984e21abd0e3666d6f589c79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  pytestCheckHook,
  pytest-cov-stub,
  lxml,
  matplotlib,
  networkx,
  pandas,
  requests,
  setuptools,
}:

buildPythonPackage rec {
  pname = "pyxnat";
  version = "1.6.4";
  pyproject = true;

  # PyPI dist missing test configuration files:
  src = fetchFromGitHub {
    owner = "pyxnat";
    repo = "pyxnat";
    tag = version;
    hash = "sha256-Dhidc5KOzx/S0sr4D7Oc8lvSDT0y8bGDNTAJy/6n8mA=";
  };

  build-system = [ setuptools ];

  propagatedBuildInputs = [
    lxml
    requests
  ];

  # pathlib is installed part of python38+ w/o an external package
  prePatch = ''
    substituteInPlace setup.py --replace-fail "pathlib>=1.0" ""
  '';

  nativeCheckInputs = [
    pytestCheckHook
    pytest-cov-stub
    matplotlib
    networkx
    pandas
  ];
  preCheck = ''
    export PYXNAT_SKIP_NETWORK_TESTS=1
  '';
  enabledTestPaths = [ "pyxnat" ];
  disabledTestPaths = [
    # require a running local XNAT instance e.g. in a docker container:
    "pyxnat/tests/attributes_test.py"
    "pyxnat/tests/custom_variables_test.py"
    "pyxnat/tests/interfaces_test.py"
    "pyxnat/tests/pipelines_test.py"
    "pyxnat/tests/provenance_test.py"
    "pyxnat/tests/prearchive_test.py"
    "pyxnat/tests/repr_test.py"
    "pyxnat/tests/resources_test.py"
    "pyxnat/tests/search_test.py"
    "pyxnat/tests/sessionmirror_test.py"
    "pyxnat/tests/test_resource_functions.py"
    "pyxnat/tests/user_and_project_management_test.py"
  ];
  disabledTests = [
    # try to access network even though PYXNAT_SKIP_NETWORK_TESTS is set:
    "test_inspector_structure"
    "test_project_manager"
  ];

  pythonImportsCheck = [ "pyxnat" ];

  meta = {
    homepage = "https://pyxnat.github.io/pyxnat";
    description = "Python API to XNAT";
    mainProgram = "sessionmirror.py";
    changelog = "https://github.com/pyxnat/pyxnat/releases/tag/${src.tag}";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ bcdarwin ];
  };
}