diff --git a/pkgs/development/python-modules/jupyter-book/default.nix b/pkgs/development/python-modules/jupyter-book/default.nix index 395afa5664cd..47e36e157eb1 100644 --- a/pkgs/development/python-modules/jupyter-book/default.nix +++ b/pkgs/development/python-modules/jupyter-book/default.nix @@ -1,7 +1,7 @@ { lib, buildPythonPackage, - fetchPypi, + fetchFromGitHub, pythonOlder, flit-core, click, @@ -22,6 +22,12 @@ sphinx-togglebutton, sphinxcontrib-bibtex, sphinx-multitoc-numbering, + pytestCheckHook, + texsoup, + jupytext, + pytest-regressions, + pytest-xdist, + sphinx-inline-tabs, }: buildPythonPackage rec { @@ -31,15 +37,18 @@ buildPythonPackage rec { disabled = pythonOlder "3.9"; - src = fetchPypi { - inherit version; - pname = "jupyter_book"; - hash = "sha256-rRXuSanf7Hc6HTBJ2sOFY4KqL5txRKGAEUduZcEbX0Y="; + src = fetchFromGitHub { + owner = "jupyter-book"; + repo = "jupyter-book"; + rev = "refs/tags/v${version}"; + hash = "sha256-NlCMfkfvquonqf7FdaJ7AC9ebM7VSifn+zM7gWh32LQ="; }; - nativeBuildInputs = [ flit-core ]; + build-system = [ flit-core ]; - propagatedBuildInputs = [ + pythonRelaxDeps = [ "myst-parser" ]; + + dependencies = [ click jinja2 jsonschema @@ -65,10 +74,44 @@ buildPythonPackage rec { "jupyter_book.cli.main" ]; + nativeCheckInputs = [ + jupytext + pytest-regressions + pytest-xdist + pytestCheckHook + sphinx-inline-tabs + texsoup + ]; + + preCheck = '' + export HOME=$TMPDIR + ''; + + disabledTests = [ + # touch the network + "test_create_from_cookiecutter" + # flaky? + "test_execution_timeout" + # require texlive + "test_toc" + "test_toc_latex_parts" + "test_toc_latex_urllink" + # WARNING: Executing notebook failed: CellExecutionError [mystnb.exec] + "test_build_dirhtml_from_template" + "test_build_from_template" + "test_build_page" + "test_build_singlehtml_from_template" + ]; + + disabledTestPaths = [ + # require texlive + "tests/test_pdf.py" + ]; + meta = with lib; { description = "Build a book with Jupyter Notebooks and Sphinx"; homepage = "https://jupyterbook.org/"; - changelog = "https://github.com/executablebooks/jupyter-book/blob/v${version}/CHANGELOG.md"; + changelog = "https://github.com/jupyter-book/jupyter-book/blob/${src.rev}/CHANGELOG.md"; license = licenses.bsd3; maintainers = teams.jupyter.members; mainProgram = "jupyter-book";