summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/ipycanvas/default.nix
blob: f0efaffd1a4c808e8383de873eb0f2905c824776 (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
{
  lib,
  buildPythonPackage,
  fetchPypi,
  hatchling,
  ipywidgets,
  numpy,
  pillow,
}:

buildPythonPackage rec {
  pname = "ipycanvas";
  version = "0.14.2";
  pyproject = true;

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-OFNwRHcRlN2jFjbEEHh4RxZyp6y1hLfotRgrIpsXBtU=";
  };

  # We relax dependencies here instead of pulling in a patch because upstream
  # has released a new version using hatch-jupyter-builder, but it is not yet
  # trivial to upgrade to that.
  #
  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace-fail '"jupyterlab>=3,<5",' "" \
  '';

  build-system = [ hatchling ];

  env.HATCH_BUILD_NO_HOOKS = true;

  dependencies = [
    ipywidgets
    numpy
    pillow
  ];

  doCheck = false; # tests are in Typescript and require `npx` and `chromium`
  pythonImportsCheck = [ "ipycanvas" ];

  meta = {
    description = "Expose the browser's Canvas API to IPython";
    homepage = "https://ipycanvas.readthedocs.io";
    changelog = "https://github.com/jupyter-widgets-contrib/ipycanvas/releases/tag/${version}";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ bcdarwin ];
  };
}