summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/plopp/default.nix
blob: 0971ed49002aa9f5696d3810a22d217869f3bfca (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  pythonAtLeast,

  # build-system
  setuptools,
  setuptools-scm,

  # dependencies
  lazy-loader,
  matplotlib,

  # tests
  pytestCheckHook,
  anywidget,
  graphviz,
  h5py,
  ipympl,
  ipywidgets,
  mpltoolbox,
  pandas,
  plotly,
  pooch,
  pyarrow,
  pythreejs,
  scipp,
  scipy,
  xarray,

  # tests data
  symlinkJoin,
  fetchurl,
}:

buildPythonPackage (finalAttrs: {
  pname = "plopp";
  version = "25.11.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "scipp";
    repo = "plopp";
    tag = finalAttrs.version;
    hash = "sha256-3vmHRPjv7iUd6ky7XzfdChpAI++ELh6vwmtELK7dwaE=";
  };

  build-system = [
    setuptools
    setuptools-scm
  ];

  dependencies = [
    lazy-loader
    matplotlib
  ];

  nativeCheckInputs = [
    pytestCheckHook
    anywidget
    graphviz
    h5py
    ipympl
    ipywidgets
    mpltoolbox
    pandas
    plotly
    pooch
    pyarrow
    pythreejs
    scipp
    scipy
    xarray
  ];

  disabledTests = lib.optionals (pythonAtLeast "3.14") [
    # RuntimeError: There is no current event loop in thread 'MainThread'
    "test_move_cut"
  ];

  env = {
    # See: https://github.com/scipp/plopp/blob/25.05.0/src/plopp/data/examples.py
    PLOPP_DATA_DIR =
      let
        # NOTE this might be changed by upstream in the future.
        _version = "1";
      in
      symlinkJoin {
        name = "plopp-test-data";
        paths =
          lib.mapAttrsToList
            (
              file: hash:
              fetchurl {
                url = "https://public.esss.dk/groups/scipp/plopp/${_version}/${file}";
                inherit hash;
                downloadToTemp = true;
                recursiveHash = true;
                postFetch = ''
                  mkdir -p $out/${_version}
                  mv $downloadedFile $out/${_version}/${file}
                '';
              }
            )
            {
              "nyc_taxi_data.h5" = "sha256-hso8ESM+uLRf4y2CW/7dpAmm/kysAfJY3b+5vz78w4Q=";
              "teapot.h5" = "sha256-i6hOw72ce1cBT6FMQTdCEKVe0WOMOjApKperGHoPW34=";
            };
      };
  };

  pythonImportsCheck = [
    "plopp"
  ];

  meta = {
    description = "Visualization library for scipp";
    homepage = "https://scipp.github.io/plopp/";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ doronbehar ];
  };
})