summaryrefslogtreecommitdiffstats
path: root/pkgs/development/python-modules/bqplot/default.nix
blob: 590614e4d5866b4a9e496cf0819c826139aa2d19 (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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,

  # nativeBuildInputs
  nodejs,
  yarn-berry_3,

  # build-system
  jupyter-packaging,
  jupyterlab,
  setuptools,

  # dependencies
  bqscales,
  ipywidgets,
  numpy,
  pandas,
  traitlets,
  traittypes,

  # tests
  nbval,
  pytestCheckHook,
}:

buildPythonPackage (finalAttrs: {
  pname = "bqplot";
  version = "0.13.1";
  pyproject = true;
  __structuredAttrs = true;

  src = fetchFromGitHub {
    owner = "bqplot";
    repo = "bqplot";
    tag = finalAttrs.version;
    hash = "sha256-mYeQzmUa7WFDL8o6xsRD2bZ+3E9y4K/KyGE0zr0V4BA=";
  };

  yarnOfflineCache = yarn-berry_3.fetchYarnBerryDeps {
    src = "${finalAttrs.src}/js";
    hash = "sha256-/QSZoanK92pV8g3n92g2pK17XjNgyerSe4UCV1/stXY=";
  };

  nativeBuildInputs = [
    nodejs
    yarn-berry_3
    yarn-berry_3.yarnBerryConfigHook
  ];

  # The yarn workspace lives in `js/`, so the offline install has to run from there.
  dontYarnBerryInstallDeps = true;

  preBuild = ''
    pushd js
    yarnBerryConfigHook
    npm run build
    popd
  '';

  build-system = [
    jupyter-packaging
    jupyterlab
    setuptools
  ];

  dependencies = [
    bqscales
    ipywidgets
    numpy
    pandas
    traitlets
    traittypes
  ];

  nativeCheckInputs = [
    nbval
    pytestCheckHook
  ];

  enabledTestPaths = [ "tests/" ];

  pythonImportsCheck = [
    "bqplot"
    "bqplot.pyplot"
  ];

  meta = {
    description = "2D plotting library for Jupyter based on Grammar of Graphics";
    homepage = "https://bqplot.github.io/bqplot";
    downloadPage = "https://github.com/bqplot/bqplot";
    changelog = "https://github.com/bqplot/bqplot/releases/tag/${finalAttrs.src.tag}";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ bcdarwin ];
  };
})