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