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