1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6
7 # build-system
8 hatchling,
9
10 # dependencies
11 click,
12 jinja2,
13 jsonschema,
14 linkify-it-py,
15 myst-nb,
16 myst-parser,
17 pyyaml,
18 sphinx,
19 sphinx-comments,
20 sphinx-copybutton,
21 sphinx-external-toc,
22 sphinx-jupyterbook-latex,
23 sphinx-design,
24 sphinx-thebe,
25 sphinx-book-theme,
26 sphinx-togglebutton,
27 sphinxcontrib-bibtex,
28 sphinx-multitoc-numbering,
29
30 # tests
31 jupytext,
32 pytest-regressions,
33 pytest-xdist,
34 pytestCheckHook,
35 sphinx-inline-tabs,
36 texsoup,
37 writableTmpDirAsHomeHook,
38}:
39
40buildPythonPackage rec {
41 pname = "jupyter-book";
42 version = "1.0.4";
43 pyproject = true;
44
45 src = fetchFromGitHub {
46 owner = "jupyter-book";
47 repo = "jupyter-book";
48 tag = "v${version}";
49 hash = "sha256-04I9mzJMXCpvMiOeMD/Bg8FiymkRgHf/Yo9C1VcyTsw=";
50 };
51
52 build-system = [ hatchling ];
53
54 pythonRelaxDeps = [
55 "myst-parser"
56 "sphinx"
57 ];
58
59 dependencies = [
60 click
61 jinja2
62 jsonschema
63 linkify-it-py
64 myst-nb
65 myst-parser
66 pyyaml
67 sphinx
68 sphinx-comments
69 sphinx-copybutton
70 sphinx-external-toc
71 sphinx-jupyterbook-latex
72 sphinx-design
73 sphinx-thebe
74 sphinx-book-theme
75 sphinx-togglebutton
76 sphinxcontrib-bibtex
77 sphinx-multitoc-numbering
78 ];
79
80 pythonImportsCheck = [
81 "jupyter_book"
82 "jupyter_book.cli.main"
83 ];
84
85 nativeCheckInputs = [
86 jupytext
87 pytest-regressions
88 pytest-xdist
89 pytestCheckHook
90 sphinx-inline-tabs
91 texsoup
92 writableTmpDirAsHomeHook
93 ];
94
95 disabledTests = [
96 # touch the network
97 "test_create_from_cookiecutter"
98
99 # flaky?
100 "test_execution_timeout"
101
102 # require texlive
103 "test_toc"
104 "test_toc_latex_parts"
105 "test_toc_latex_urllink"
106
107 # AssertionError: assert 'There was an error in building your book' in '1'
108 "test_build_errors"
109
110 # WARNING: Executing notebook failed: CellExecutionError [mystnb.exec]
111 "test_build_dirhtml_from_template"
112 "test_build_from_template"
113 "test_build_page"
114 "test_build_singlehtml_from_template"
115
116 # pytest.PytestUnraisableExceptionWarning: Exception ignored in: <sqlite3.Connection object at 0x115dcc9a0>
117 # ResourceWarning: unclosed database in <sqlite3.Connection object at 0x115dcc9a0>
118 "test_clean_book"
119 "test_clean_html_latex"
120 "test_clean_latex"
121 ];
122
123 disabledTestPaths = [
124 # require texlive
125 "tests/test_pdf.py"
126 ];
127
128 __darwinAllowLocalNetworking = true;
129
130 meta = {
131 description = "Build a book with Jupyter Notebooks and Sphinx";
132 homepage = "https://jupyterbook.org/";
133 changelog = "https://github.com/jupyter-book/jupyter-book/blob/${src.rev}/CHANGELOG.md";
134 license = lib.licenses.bsd3;
135 teams = [ lib.teams.jupyter ];
136 mainProgram = "jupyter-book";
137 };
138}