1{
2 lib,
3 buildPythonPackage,
4 fetchpatch,
5 fetchPypi,
6 pythonOlder,
7 pythonRelaxDepsHook,
8 altair,
9 ipytablewidgets,
10 ipywidgets,
11 jupyter,
12 jupyter-core,
13 jupyterlab,
14 pandas,
15 poetry-core,
16 pytestCheckHook,
17}:
18
19buildPythonPackage rec {
20 pname = "vega";
21 version = "4.0.0";
22 format = "pyproject";
23
24 disabled = pythonOlder "3.8";
25
26 src = fetchPypi {
27 inherit pname version;
28 hash = "sha256-v1/8taHdN1n9+gy7L+g/wAJ2x9FwYCaxZiEdFqLct1Y=";
29 };
30
31 patches = [
32 # https://github.com/vega/ipyvega/pull/507
33 (fetchpatch {
34 name = "replace-poetry-with-poetry-core.patch";
35 url = "https://github.com/vega/ipyvega/commit/1a5028ee5d54e24b9650b66685f54c42b72c7899.patch";
36 hash = "sha256-W8UmMit7DJGKCM9+/OSRLTuRvC0ZR42AP/b/frVEvsk=";
37 })
38 ];
39
40 nativeBuildInputs = [
41 poetry-core
42 pythonRelaxDepsHook
43 ];
44
45 pythonRelaxDeps = [ "pandas" ];
46
47 propagatedBuildInputs = [
48 ipytablewidgets
49 jupyter
50 jupyter-core
51 pandas
52 ];
53
54 passthru.optional-dependencies = {
55 widget = [ ipywidgets ];
56 jupyterlab = [ jupyterlab ];
57 };
58
59 nativeCheckInputs = [
60 altair
61 pytestCheckHook
62 ];
63
64 disabledTestPaths = [
65 # these tests are broken with jupyter-notebook >= 7
66 "vega/tests/test_entrypoint.py"
67 ];
68
69 pythonImportsCheck = [ "vega" ];
70
71 meta = with lib; {
72 description = "An IPython/Jupyter widget for Vega and Vega-Lite";
73 longDescription = ''
74 To use this you have to enter a nix-shell with vega. Then run:
75
76 jupyter nbextension install --user --py vega
77 jupyter nbextension enable --user vega
78 '';
79 homepage = "https://github.com/vega/ipyvega";
80 license = licenses.bsd3;
81 maintainers = with maintainers; [ teh ];
82 };
83}