Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 fetchurl, 4 buildPythonPackage, 5 pythonOlder, 6 fetchPypi, 7 hatchling, 8 beautifulsoup4, 9 bleach, 10 defusedxml, 11 jinja2, 12 jupyter-core, 13 jupyterlab-pygments, 14 markupsafe, 15 mistune, 16 nbclient, 17 packaging, 18 pandocfilters, 19 pygments, 20 tinycss2, 21 traitlets, 22 importlib-metadata, 23 flaky, 24 ipykernel, 25 ipywidgets, 26 pytestCheckHook, 27}: 28 29let 30 # see https://github.com/jupyter/nbconvert/issues/1896 31 style-css = fetchurl { 32 url = "https://cdn.jupyter.org/notebook/5.4.0/style/style.min.css"; 33 hash = "sha256-WGWmCfRDewRkvBIc1We2GQdOVAoFFaO4LyIvdk61HgE="; 34 }; 35in 36buildPythonPackage rec { 37 pname = "nbconvert"; 38 version = "7.16.4"; 39 pyproject = true; 40 41 disabled = pythonOlder "3.8"; 42 43 src = fetchPypi { 44 inherit pname version; 45 hash = "sha256-hsqRuiZrCkSNyW+mxbnZiv+r3ihns2MlhwNTaAf59/Q="; 46 }; 47 48 # Add $out/share/jupyter to the list of paths that are used to search for 49 # various exporter templates 50 patches = [ ./templates.patch ]; 51 52 postPatch = '' 53 substituteAllInPlace ./nbconvert/exporters/templateexporter.py 54 55 mkdir -p share/templates/classic/static 56 cp ${style-css} share/templates/classic/static/style.css 57 ''; 58 59 nativeBuildInputs = [ hatchling ]; 60 61 propagatedBuildInputs = [ 62 beautifulsoup4 63 bleach 64 defusedxml 65 jinja2 66 jupyter-core 67 jupyterlab-pygments 68 markupsafe 69 mistune 70 nbclient 71 packaging 72 pandocfilters 73 pygments 74 tinycss2 75 traitlets 76 ] ++ lib.optionals (pythonOlder "3.10") [ importlib-metadata ]; 77 78 preCheck = '' 79 export HOME=$(mktemp -d) 80 ''; 81 82 nativeCheckInputs = [ 83 flaky 84 ipykernel 85 ipywidgets 86 pytestCheckHook 87 ]; 88 89 disabledTests = [ 90 # Attempts network access (Failed to establish a new connection: [Errno -3] Temporary failure in name resolution) 91 "test_export" 92 "test_webpdf_with_chromium" 93 # ModuleNotFoundError: No module named 'nbconvert.tests' 94 "test_convert_full_qualified_name" 95 "test_post_processor" 96 ]; 97 98 # Some of the tests use localhost networking. 99 __darwinAllowLocalNetworking = true; 100 101 meta = { 102 description = "Converting Jupyter Notebooks"; 103 homepage = "https://github.com/jupyter/nbconvert"; 104 changelog = "https://github.com/jupyter/nbconvert/blob/v${version}/CHANGELOG.md"; 105 license = lib.licenses.bsd3; 106 maintainers = lib.teams.jupyter.members; 107 }; 108}