1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 pytestCheckHook,
6 pythonOlder,
7 hatch-jupyter-builder,
8 hatchling,
9 importlib-metadata,
10 ipywidgets,
11 psygnal,
12 typing-extensions,
13 watchfiles,
14}:
15
16buildPythonPackage rec {
17 pname = "anywidget";
18 version = "0.9.13";
19 pyproject = true;
20
21 disabled = pythonOlder "3.7";
22
23 src = fetchPypi {
24 inherit pname version;
25 hash = "sha256-xlVFW/UfghgusjxZR9N8xB8LH/rK9+K3YxR6IzLLPwc=";
26 };
27
28 # We do not need the jupyterlab build dependency, because we do not need to
29 # build any JS components; these are present already in the PyPI artifact.
30 #
31 postPatch = ''
32 substituteInPlace pyproject.toml \
33 --replace '"jupyterlab==3.*"' ""
34 '';
35
36 build-system = [
37 hatch-jupyter-builder
38 hatchling
39 ];
40
41 dependencies = [
42 ipywidgets
43 psygnal
44 typing-extensions
45 ] ++ lib.optional (pythonOlder "3.8") importlib-metadata;
46
47 nativeCheckInputs = [
48 pytestCheckHook
49 watchfiles
50 ];
51
52 disabledTests = [
53 # requires package.json
54 "test_version"
55 ];
56
57 pythonImportsCheck = [ "anywidget" ];
58
59 meta = with lib; {
60 description = "Custom jupyter widgets made easy";
61 homepage = "https://github.com/manzt/anywidget";
62 changelog = "https://github.com/manzt/anywidget/releases/tag/anywidget%40${version}";
63 license = licenses.mit;
64 maintainers = with maintainers; [ natsukium ];
65 };
66}