1{ lib
2, buildPythonPackage
3, fetchPypi
4, pythonOlder
5, jupyter-packaging
6, ipywidgets
7, numpy
8, pillow
9}:
10
11buildPythonPackage rec {
12 pname = "ipycanvas";
13 version = "0.13.1";
14 format = "pyproject";
15
16 disabled = pythonOlder "3.7";
17
18 src = fetchPypi {
19 inherit pname version;
20 hash = "sha256-+cOUBoG8ODgzkPjEbqXYRF1uEcbaZITDfYnfWuHawTE=";
21 };
22
23 # We relax dependencies here instead of pulling in a patch because upstream
24 # has released a new version using hatch-jupyter-builder, but it is not yet
25 # trivial to upgrade to that.
26 #
27 postPatch = ''
28 substituteInPlace pyproject.toml \
29 --replace '"jupyterlab==3.*",' "" \
30 --replace 'jupyter_packaging~=' 'jupyter_packaging>='
31 '';
32
33 nativeBuildInputs = [ jupyter-packaging ];
34
35 propagatedBuildInputs = [ ipywidgets numpy pillow ];
36
37 doCheck = false; # tests are in Typescript and require `npx` and `chromium`
38 pythonImportsCheck = [ "ipycanvas" ];
39
40 meta = with lib; {
41 description = "Expose the browser's Canvas API to IPython";
42 homepage = "https://ipycanvas.readthedocs.io";
43 changelog = "https://github.com/jupyter-widgets-contrib/ipycanvas/releases/tag/${version}";
44 license = licenses.bsd3;
45 maintainers = with maintainers; [ bcdarwin ];
46 };
47}