at master 2.4 kB view raw
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 traitlets, 21 importlib-metadata, 22 flaky, 23 ipykernel, 24 ipywidgets, 25 pytestCheckHook, 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 35buildPythonPackage rec { 36 pname = "nbconvert"; 37 version = "7.16.6"; 38 pyproject = true; 39 40 disabled = pythonOlder "3.8"; 41 42 src = fetchPypi { 43 inherit pname version; 44 hash = "sha256-V2p+N8ZIDae4Rl7vpmwXhEJDgWzhzMNyYzxrccPA9YI="; 45 }; 46 47 # Add $out/share/jupyter to the list of paths that are used to search for 48 # various exporter templates 49 patches = [ ./templates.patch ]; 50 51 postPatch = '' 52 substituteAllInPlace ./nbconvert/exporters/templateexporter.py 53 54 mkdir -p share/templates/classic/static 55 cp ${style-css} share/templates/classic/static/style.css 56 ''; 57 58 build-system = [ hatchling ]; 59 60 dependencies = [ 61 beautifulsoup4 62 bleach 63 defusedxml 64 jinja2 65 jupyter-core 66 jupyterlab-pygments 67 markupsafe 68 mistune 69 nbclient 70 packaging 71 pandocfilters 72 pygments 73 traitlets 74 ] 75 ++ bleach.optional-dependencies.css 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 pytestFlags = [ 90 "-Wignore::DeprecationWarning" 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://github.com/jupyter/nbconvert"; 108 changelog = "https://github.com/jupyter/nbconvert/blob/v${version}/CHANGELOG.md"; 109 license = lib.licenses.bsd3; 110 teams = [ lib.teams.jupyter ]; 111 }; 112}