1{ lib
2, stdenv
3, buildPythonPackage
4, pythonOlder
5, fetchFromGitHub
6, isPyPy
7
8# nativeBuildInputs
9, flit-core
10
11# propagatedBuildInputs
12, babel
13, alabaster
14, docutils
15, imagesize
16, importlib-metadata
17, jinja2
18, packaging
19, pygments
20, requests
21, snowballstemmer
22, sphinxcontrib-apidoc
23, sphinxcontrib-applehelp
24, sphinxcontrib-devhelp
25, sphinxcontrib-htmlhelp
26, sphinxcontrib-jsmath
27, sphinxcontrib-qthelp
28, sphinxcontrib-serializinghtml
29, sphinxcontrib-websupport
30
31# check phase
32, cython
33, filelock
34, html5lib
35, pytestCheckHook
36}:
37
38buildPythonPackage rec {
39 pname = "sphinx";
40 version = "7.2.6";
41 format = "pyproject";
42 disabled = pythonOlder "3.9";
43
44 src = fetchFromGitHub {
45 owner = "sphinx-doc";
46 repo = "sphinx";
47 rev = "refs/tags/v${version}";
48 postFetch = ''
49 # Change ä to æ in file names, since ä can be encoded multiple ways on different
50 # filesystems, leading to different hashes on different platforms.
51 cd "$out";
52 mv tests/roots/test-images/{testimäge,testimæge}.png
53 sed -i 's/testimäge/testimæge/g' tests/{test_build*.py,roots/test-images/index.rst}
54 '';
55 hash = "sha256-IjpRGeGpGfzrEvwIKtuu2l1S74w8W+AbqDOGnWwtRck=";
56 };
57
58 nativeBuildInputs = [
59 flit-core
60 ];
61
62 propagatedBuildInputs = [
63 alabaster
64 babel
65 docutils
66 imagesize
67 jinja2
68 packaging
69 pygments
70 requests
71 snowballstemmer
72 sphinxcontrib-applehelp
73 sphinxcontrib-devhelp
74 sphinxcontrib-htmlhelp
75 sphinxcontrib-jsmath
76 sphinxcontrib-qthelp
77 sphinxcontrib-serializinghtml
78 # extra[docs]
79 sphinxcontrib-websupport
80
81 # extra plugins which are otherwise not found by sphinx-build
82 sphinxcontrib-apidoc
83 ] ++ lib.optionals (pythonOlder "3.10") [
84 importlib-metadata
85 ];
86
87 __darwinAllowLocalNetworking = true;
88
89 nativeCheckInputs = [
90 cython
91 filelock
92 html5lib
93 pytestCheckHook
94 ];
95
96 preCheck = ''
97 export HOME=$TMPDIR
98 '';
99
100 disabledTests = [
101 # requires network access
102 "test_latex_images"
103 ] ++ lib.optionals isPyPy [
104 # PyPy has not __builtins__ which get asserted
105 # https://doc.pypy.org/en/latest/cpython_differences.html#miscellaneous
106 "test_autosummary_generate_content_for_module"
107 "test_autosummary_generate_content_for_module_skipped"
108 # internals are asserted which are sightly different in PyPy
109 "test_autodoc_inherited_members_None"
110 "test_automethod_for_builtin"
111 "test_builtin_function"
112 "test_cython"
113 "test_isattributedescriptor"
114 "test_methoddescriptor"
115 "test_partialfunction"
116 ];
117
118 meta = {
119 description = "Python documentation generator";
120 longDescription = ''
121 Sphinx makes it easy to create intelligent and beautiful documentation.
122
123 Here are some of Sphinx’s major features:
124 - Output formats: HTML (including Windows HTML Help), LaTeX (for printable
125 PDF versions), ePub, Texinfo, manual pages, plain text
126 - Extensive cross-references: semantic markup and automatic links for
127 functions, classes, citations, glossary terms and similar pieces of
128 information
129 - Hierarchical structure: easy definition of a document tree, with
130 automatic links to siblings, parents and children
131 - Automatic indices: general index as well as a language-specific module
132 indices
133 - Code handling: automatic highlighting using the Pygments highlighter
134 - Extensions: automatic testing of code snippets, inclusion of docstrings
135 from Python modules (API docs) via built-in extensions, and much more
136 functionality via third-party extensions.
137 - Themes: modify the look and feel of outputs via creating themes, and
138 re-use many third-party themes.
139 - Contributed extensions: dozens of extensions contributed by users; most
140 of them installable from PyPI.
141
142 Sphinx uses the reStructuredText markup language by default, and can read
143 MyST markdown via third-party extensions. Both of these are powerful and
144 straightforward to use, and have functionality for complex documentation
145 and publishing workflows. They both build upon Docutils to parse and write
146 documents.
147 '';
148 homepage = "https://www.sphinx-doc.org";
149 changelog = "https://www.sphinx-doc.org/en/master/changes.html";
150 license = lib.licenses.bsd3;
151 maintainers = lib.teams.sphinx.members;
152 };
153}