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