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