Skip to content

Commit 52a59dc

Browse files
authored
Merge branch 'master' into latex_DUrole
2 parents 984fb3f + 334e69f commit 52a59dc

File tree

102 files changed

+1800
-609
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+1800
-609
lines changed

.flake8

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,6 @@ exclude =
3333
doc/usage/extensions/example*.py,
3434
per-file-ignores =
3535
doc/conf.py:W605
36+
sphinx/events.py:E704,
3637
tests/test_extensions/ext_napoleon_pep526_data_google.py:MLL001,
3738
tests/test_extensions/ext_napoleon_pep526_data_numpy.py:MLL001,

.github/workflows/builddoc.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,3 @@ jobs:
4444
--jobs=auto
4545
--show-traceback
4646
--fail-on-warning
47-
--keep-going

.github/workflows/lint.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,17 @@ jobs:
2424

2525
steps:
2626
- uses: actions/checkout@v4
27+
- name: Get Ruff version from pyproject.toml
28+
run: |
29+
RUFF_VERSION=$(awk -F'[="]' '/\[project\.optional-dependencies\]/ {p=1} /ruff/ {if (p) print $4}' pyproject.toml)
30+
echo "RUFF_VERSION=$RUFF_VERSION" >> $GITHUB_ENV
31+
2732
- name: Install Ruff
2833
run: >
29-
RUFF_VERSION=$(awk -F'[="]' '/\[project\.optional-dependencies\]/ {p=1} /ruff/ {if (p) print $4}' pyproject.toml)
3034
curl --no-progress-meter --location --fail
3135
--proto '=https' --tlsv1.2
32-
"https://astral.sh/ruff/${RUFF_VERSION}/install.sh"
36+
--write-out "%{stderr}Downloaded: %{url}\n"
37+
"https://astral.sh/ruff/$RUFF_VERSION/install.sh"
3338
| sh
3439
3540
- name: Lint with Ruff

.github/workflows/nodejs.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@ concurrency:
2323
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
2424
cancel-in-progress: true
2525

26+
env:
27+
FORCE_COLOR: "1"
28+
2629
jobs:
2730
build:
2831
runs-on: ubuntu-latest
2932
env:
30-
node-version: "16"
33+
node-version: "20"
3134

3235
steps:
3336
- uses: actions/checkout@v4
@@ -37,5 +40,4 @@ jobs:
3740
node-version: ${{ env.node-version }}
3841
cache: "npm"
3942
- run: npm install
40-
- name: Run headless test
41-
run: xvfb-run -a npm test
43+
- run: npm test

CHANGES.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ Features added
3030
output files.
3131
* #12474: Support type-dependent search result highlighting via CSS.
3232
Patch by Tim Hoffmann.
33+
* #12743: No longer exit on the first warning when
34+
:option:`--fail-on-warning <sphinx-build --fail-on-warning>` is used.
35+
Instead, exit with a non-zero status if any warnings were generated
36+
during the build.
37+
Patch by Adam Turner.
38+
* #12743: Add :option:`sphinx-build --exception-on-warning`,
39+
to raise an exception when warnings are emitted during the build.
40+
Patch by Adam Turner and Jeremy Maitin-Shepard.
3341

3442
Bugs fixed
3543
----------

doc/conf.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,19 +186,24 @@
186186
('js:func', 'number'),
187187
('js:func', 'string'),
188188
('py:attr', 'srcline'),
189+
('py:class', '_ConfigRebuild'), # sphinx.application.Sphinx.add_config_value
189190
('py:class', '_StrPath'), # sphinx.environment.BuildEnvironment.doc2path
190191
('py:class', 'Element'), # sphinx.domains.Domain
191192
('py:class', 'Documenter'), # sphinx.application.Sphinx.add_autodocumenter
192193
('py:class', 'IndexEntry'), # sphinx.domains.IndexEntry
194+
('py:class', 'Lexer'), # sphinx.application.Sphinx.add_lexer
193195
('py:class', 'Node'), # sphinx.domains.Domain
194196
('py:class', 'NullTranslations'), # gettext.NullTranslations
197+
('py:class', 'Path'), # sphinx.application.Sphinx.connect
195198
('py:class', 'RoleFunction'), # sphinx.domains.Domain
196199
('py:class', 'RSTState'), # sphinx.utils.parsing.nested_parse_to_nodes
197200
('py:class', 'Theme'), # sphinx.application.TemplateBridge
198201
('py:class', 'SearchLanguage'), # sphinx.application.Sphinx.add_search_language
199202
('py:class', 'StringList'), # sphinx.utils.parsing.nested_parse_to_nodes
200203
('py:class', 'system_message'), # sphinx.utils.docutils.SphinxDirective
201204
('py:class', 'TitleGetter'), # sphinx.domains.Domain
205+
('py:class', 'todo_node'), # sphinx.application.Sphinx.connect
206+
('py:class', 'Transform'), # sphinx.application.Sphinx.add_transform
202207
('py:class', 'XRefRole'), # sphinx.domains.Domain
203208
('py:class', 'docutils.nodes.Element'),
204209
('py:class', 'docutils.nodes.Node'),
@@ -210,6 +215,7 @@
210215
('py:class', 'docutils.parsers.rst.states.Inliner'),
211216
('py:class', 'docutils.transforms.Transform'),
212217
('py:class', 'nodes.NodeVisitor'),
218+
('py:class', 'nodes.TextElement'), # sphinx.application.Sphinx.connect
213219
('py:class', 'nodes.document'),
214220
('py:class', 'nodes.reference'),
215221
('py:class', 'pygments.lexer.Lexer'),

doc/extdev/event_callbacks.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,10 @@ Here is a more detailed list of these events.
107107

108108
:param app: :class:`.Sphinx`
109109
:param env: :class:`.BuildEnvironment`
110-
:param added: ``set[str]``
111-
:param changed: ``set[str]``
112-
:param removed: ``set[str]``
113-
:returns: ``list[str]`` of additional docnames to re-read
110+
:param added: ``Set[str]``
111+
:param changed: ``Set[str]``
112+
:param removed: ``Set[str]``
113+
:returns: ``Sequence[str]`` of additional docnames to re-read
114114

115115
Emitted when the environment determines which source files have changed and
116116
should be re-read.

doc/internals/contributing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ To build the documentation, run the following command:
263263

264264
.. code-block:: shell
265265
266-
sphinx-build -M html ./doc ./build/sphinx --fail-on-warning --keep-going
266+
sphinx-build -M html ./doc ./build/sphinx --fail-on-warning
267267
268268
This will parse the Sphinx documentation's source files and generate HTML for
269269
you to preview in :file:`build/sphinx/html`.

doc/man/sphinx-build.rst

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Options
4343
the source and output directories, before any other options are passed.
4444
For example::
4545

46-
sphinx-build -M html ./source ./build --fail-on-warning --keep-going
46+
sphinx-build -M html ./source ./build --fail-on-warning
4747

4848
The *make-mode* provides the same build functionality as
4949
a default :ref:`Makefile or Make.bat <makefile_options>`,
@@ -253,20 +253,35 @@ Options
253253

254254
.. option:: -W, --fail-on-warning
255255

256-
Turn warnings into errors. This means that the build stops at the first
257-
warning and ``sphinx-build`` exits with exit status 1.
256+
Turn warnings into errors.
257+
This means that :program:`sphinx-build` exits with exit status 1
258+
if any warnings are generated during the build.
258259

259260
.. versionchanged:: 7.3
260261
Add ``--fail-on-warning`` long option.
262+
.. versionchanged:: 8.1
263+
:program:`sphinx-build` no longer exits on the first warning,
264+
but instead runs the entire build and exits with exit status 1
265+
if any warnings were generated.
266+
This behaviour was previously enabled with :option:`--keep-going`.
261267

262268
.. option:: --keep-going
263269

264-
Only applicable whilst using :option:`--fail-on-warning`,
265-
which by default exits :program:`sphinx-build` on the first warning.
270+
From Sphinx 8.1, :option:`!--keep-going` is always enabled.
271+
Previously, it was only applicable whilst using :option:`--fail-on-warning`,
272+
which by default exited :program:`sphinx-build` on the first warning.
266273
Using :option:`!--keep-going` runs :program:`!sphinx-build` to completion
267274
and exits with exit status 1 if errors are encountered.
268275

269276
.. versionadded:: 1.8
277+
.. versionchanged:: 8.1
278+
:program:`sphinx-build` no longer exits on the first warning,
279+
meaning that in effect :option:`!--fail-on-warning` is always enabled.
280+
The option is retained for compatibility, but may be removed at some
281+
later date.
282+
283+
.. xref RemovedInSphinx10Warning: deprecate this option in Sphinx 10
284+
or no earlier than 2026-01-01.
270285
271286
.. option:: -T, --show-traceback
272287

@@ -287,6 +302,13 @@ Options
287302
.. versionchanged:: 7.3
288303
Add ``--pdb`` long option.
289304

305+
.. option:: --exception-on-warning
306+
307+
Raise an exception when a warning is emitted during the build.
308+
This can be useful in combination with :option:`--pdb` to debug warnings.
309+
310+
.. versionadded:: 8.1
311+
290312
.. option:: -h, --help, --version
291313

292314
Display usage summary or Sphinx version.

doc/usage/extensions/autodoc.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,10 @@ There are also config values that you can set:
770770
If ``False`` is given, autodoc forcedly suppresses the error if the imported
771771
module emits warnings. By default, ``True``.
772772

773+
.. versionchanged:: 8.1
774+
This option now has no effect as :option:`!--fail-on-warning`
775+
no longer exits early.
776+
773777
.. confval:: autodoc_inherit_docstrings
774778

775779
This value controls the docstrings inheritance.

0 commit comments

Comments
 (0)