Commit Graph

4884 Commits

Author SHA1 Message Date
Adam Dangoor
678704fde6
Fix CalledProcessError attribute access in tests (#12838) 2024-08-31 07:37:42 +01:00
Jean-François B.
447cd1ab1e
LaTeX: Fix #12735 about siglines with typing but no parameter list (#12737) 2024-08-24 21:48:51 +02:00
Bénédikt Tran
1852d0f087
intersphinx: Fix double forward slashes in inventory urls (#12807) 2024-08-22 10:11:12 +01:00
Jean-François B.
1c131dfffe
LaTeX: make contents, topic, and sidebar separately customizable (#12704)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-08-19 20:43:47 +02:00
Thomas Fanning
e0f2009346
LaTeX: Add math_numsep support to latex builder (#12652)
Co-authored-by: Jean-François B <2589111+jfbu@users.noreply.github.com>
2024-08-18 21:34:20 +02:00
Jean-François B.
4c7fe10a4b
LaTeX: fix mark-up when \DUrole is used with multiple classes (#12745) 2024-08-17 20:33:15 +02:00
Adam Turner
334e69fbb4
Test command line argument parsing (#12795) 2024-08-17 02:53:48 +01:00
Adam Turner
2e1415cf6c
Use `headlessFirefox` and update to Node 20 (#12794) 2024-08-16 23:18:24 +00:00
Adam Dangoor
ae8b37793d
Improve typing for `mocksvgconverter.py` (#12788)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-08-16 22:35:32 +01:00
Adam Turner
76ead8737d Bump Ruff to 0.6.0 2024-08-15 21:42:32 +01:00
Adam Turner
eb6ff0a258
Increase test independence by using the basic theme (#12776) 2024-08-14 20:45:33 +01:00
Adam Turner
fadb6b10cb
Stop exiting early with `--fail-on-warnings; add --exception-on-warning` (#12743)
Co-authored-by: Jeremy Maitin-Shepard <jbms@google.com>
2024-08-13 17:12:42 +01:00
Adam Turner
0b17bb1029
Always define the builder and `testroot when using the app` fixtureture (#12775) 2024-08-12 22:34:03 +01:00
Adam Turner
03b9134ee0
Short-circuit HTTP requests in tests (#12772) 2024-08-12 03:49:58 +01:00
James Addison
0bfaadf6c9
singlehtml: Use same-document hyperlinks for internal project references (#12551)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2024-08-11 22:43:48 +01:00
Jeremy Bowman
0cbdd98ffb
Correctly support custom gettext output templates (#12645)
Co-authored-by: Jeremy Bowman <jmbowman@alum.mit.edu>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2024-08-11 20:34:04 +01:00
Tim Hoffmann
646a5d7482
Support type-dependent search result highlighting via CSS (#12474)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
Co-authored-by: James Addison <55152140+jayaddison@users.noreply.github.com>
2024-08-11 20:22:21 +01:00
Adam Turner
d39ba32604
Add `sphinx.util._importer` (#12762) 2024-08-11 17:24:26 +01:00
James Addison
655d1c7213
intersphinx: Reduce log message severity when an ambiguous target resolves to a duplicate (#12587) 2024-08-11 17:22:37 +01:00
Adam Turner
ed7a980b34 Fix test formatting 2024-08-11 16:58:19 +01:00
James Addison
999baca135
Mention dynamically-evaluated templates whilst copying static files (#12726) 2024-08-11 16:37:41 +01:00
James Addison
3bab3248e5
HTML search: Add test coverage & introduce test module file suffix (#12759) 2024-08-11 15:13:14 +01:00
Adam Turner
d03156e078
Format `tests/` (#12760) 2024-08-11 14:58:56 +01:00
Adam Turner
620e434f65
Improve string concatenation (#12758)
Use implicit concatenation over ``+``, and combine some implicit concatenations
to a single string literal.
2024-08-11 00:39:35 +01:00
Adam Turner
18fbced7e0
Reduce the formatter's target line length to 88 (#12757) 2024-08-11 00:19:50 +01:00
James Addison
e3238260f6
Migrate JavaScript tests from Karma to the Jasmine framework (#12754) 2024-08-10 00:18:27 +01:00
Jean-François B.
586c0cd178
Revert "Mark `test_build_manpage` as XFAIL following changes in Docutils master" (#12734)
This reverts commit 1ed4ca7.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-08-07 16:04:07 +01:00
Chris Sewell
05cc39d9b2
[rst] Improve unreferenced footnote warnings (#12730)
The previous `UnreferencedFootnotesDetector` transform was untested and missed warnings for a number of cases.

This commit adds a test, to cover a reasonable range of scenarios,
then changes how the detection works to pass this test.

The transform now runs just after the docutils `Footnote` resolution transform
(changing its priority from 200 to 622)
then simply check for any footnotes without "back-references".
2024-08-05 10:28:13 +02:00
Shengyu Zhang
03d684fe9f
intersphinx: Handle a negative `intersphinx_cache_limit` (#12514)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-07-31 08:16:10 +01:00
Adam Turner
cee9efc0ab Use `classmethod` for a class method 2024-07-30 01:51:27 +01:00
Adam Turner
d0915ab25b Fix mypy 2024-07-30 01:12:28 +01:00
Adam Turner
865b513cf2 Patch `pygments.Formatter.__class_getitem__` in Pygments 2.17 2024-07-30 01:11:34 +01:00
Adam Turner
a4102a7507 Specify encoding to avoid EncodingWarning 2024-07-29 18:21:01 +01:00
Adam Turner
5f110f0fa0 Fix test failures following Alabaster's change in default sidebars 2024-07-26 23:16:18 +01:00
Adam Turner
b511537597
`_StrPath is dead; long live _StrPath` (#12690) 2024-07-26 17:33:55 +01:00
Adam Turner
46671f2e10
intersphinx: Add a type for project data (#12657) 2024-07-23 23:17:58 +01:00
danieleades
f09bc62969
Shrink mypy exclude list (#12669)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-07-23 22:19:15 +01:00
Adam Turner
7c4db269af
Normalise `sys.path` manipulation in tests (#12665) 2024-07-23 16:55:21 +01:00
Adam Turner
1c682bc3ba
Remove `_typing_internal_name` (#12664) 2024-07-23 16:10:10 +01:00
Adam Turner
1f2891530d
Use `app.status and app.warning` in tests (#12663) 2024-07-23 15:35:55 +01:00
Adam Turner
57a63ea603
Use more precise last-modified times for files (#12661) 2024-07-23 14:52:31 +01:00
Adam Turner
de15d61a46 Use pathlib in `sphinx.project` 2024-07-23 04:52:32 +01:00
Adam Turner
932e5c56db Fix repr of paths on Windows 2024-07-23 03:28:50 +01:00
danieleades
2f9a79c3b2
Disallow implicit re-export (#12653) 2024-07-23 02:38:45 +01:00
danieleades
58d4224227
Disallow untyped calls (#12640)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2024-07-23 02:22:58 +01:00
Adam Turner
3b009cd627
Mark type aliases with `TypeAlias` (#12658) 2024-07-23 01:21:29 +01:00
Bénédikt Tran
61daf1c27c
intersphinx: Fix cache handling (#12087)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
Co-authored-by: James Addison <55152140+jayaddison@users.noreply.github.com>
2024-07-22 23:09:11 +01:00
Adam Turner
f31dbabf20
Remove `_StrPath` (#12650) 2024-07-22 16:22:41 +01:00
Adam Turner
217f267822
Do not overwrite user-supplied data by default when copying (#12647) 2024-07-22 16:00:16 +01:00
Adam Turner
9e3f4521db
Drop support for Python 3.9 (#12633) 2024-07-22 15:05:15 +01:00
Adam Turner
e174df2762
Rename `normalize_intersphinx_mapping to validate_intersphinx_mapping` (#12643) 2024-07-22 13:32:44 +01:00
Bénédikt Tran
aacca3064e
Remove support for the Sphinx 0.5 `intersphinx_mapping` format (#12083)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2024-07-22 12:59:59 +01:00
James Addison
45f3cd6324
HTML Search: Remove unused function-call arguments in tests (#12628) 2024-07-20 23:32:25 +01:00
Chris Sewell
dabacdf5f8
Turn `show_warning_types` on by default (#12597)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2024-07-20 21:07:06 +01:00
James Addison
cc08854bc2
linkcheck: Update configuration defaults for Sphinx 8.0 (#12630)
- Links that respond with HTTP 401 (unauthorized) responses are now considered ``broken`` by default.
- Timeouts that occur when checking a link are now reported with a distinct `timeout` status code, instead of the previous ``broken``.
- The previous behaviours are still available and can be configured on an opt-in basis per-project using ``conf.py``.

Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2024-07-20 20:41:22 +01:00
danieleades
20507af3d7
Add missing type stubs (#12619)
Co-authored-by: Daniel Eades <daniel.eades@seebyte.com>
2024-07-20 19:54:49 +01:00
Adam Turner
af82d70c60 Raise `ThemeError` for invalid theme sections 2024-07-20 19:40:29 +01:00
Adam Turner
9f886cc878 Raise `ConfigError on invalid html_sidebars` values 2024-07-20 19:40:29 +01:00
Bénédikt Tran
6c486a575c
Fix detecting file changes for the overwritten file warning (#12627)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-07-20 14:31:53 +01:00
Adam Turner
2bd973e719
autodoc: Fix warnings with dataclasses in `Annotated` metadata (#12622) 2024-07-20 11:28:03 +01:00
Adam Turner
dd77f85149
Support callables in `Annotated` types (#12625) 2024-07-20 11:16:33 +01:00
Adam Turner
1ed4ca7e03 Mark `test_build_manpage` as XFAIL following changes in Docutils master 2024-07-20 11:03:16 +01:00
Adam Turner
587da413ca
Warn when files are overwritten in the build directory (#12612) 2024-07-19 08:20:48 +01:00
James Addison
f081136ebd
intersphinx: Reduce log severity for ambiguity detection during inventory loading (#12615) 2024-07-18 13:15:20 +01:00
Adam Turner
e61f56950d
Do not add the module prefix when generating autosummary documents (#12609) 2024-07-17 21:42:21 +01:00
James Addison
47757c4062
HTML search: Ensure that `checkRanking` fails when the final entry is not found (#12608)
The ``checkRanking`` function in our test suite has a bug; it's currently possible for the final item in the expected ranking list *not* to be found in the result-set, and yet for the function to pass.

**Expected Behaviour**
The ``checkRanking`` function should confirm that all of the items specified in the ``expectedRanking`` argument appear within the ``results`` argument, and in the list-iteration-order provided.  If they do not, then an assertion error should be raised, failing the test.

**Actual Behaviour**
If all items up until the final entry in the ``expectedRanking`` argument are found in the expected order, but the final entry itself is not found at all in the ``results``, then no assertion error is raised, and the test passes.
2024-07-17 16:29:55 +01:00
Jean-François B.
152b78318d
LaTeX: fix figures in seealso and seealso inside table cell (#12598)
This also fixes unreported issues unrelated to the 7.4.0 release:

- (now old style "lightbox") admonitions render badly in tabulary,
- "heavybox" admonitions (they are all now but warning et al. were already) cause PDF crash if in tabulary and rendered badly if in tabular or longtable.
- figure in a table cell is not properly separated from immediately preceding text.

Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2024-07-16 21:03:42 +01:00
Adam Turner
5edca97a2e
Warn when `html_sidebars` values are strings (#12600) 2024-07-16 20:48:49 +01:00
James Addison
cfd3645eb7
intersphinx: Don't warn about pure-duplicate ambiguous definitions when loading inventory entries (#12586) 2024-07-15 18:37:46 +01:00
Adam Turner
4bdef1b576 Remove old-styled `source_suffix` values in tests 2024-07-15 12:50:56 +01:00
Adam Turner
1c204e63a9
Increment the environment version to resolve C domain issues on incremental rebuilds (#12583) 2024-07-15 12:00:18 +01:00
Adam Turner
73dd9fcb9b
Restore support for `typing.ParamSpec` (#12581) 2024-07-15 11:00:13 +01:00
Adam Turner
18ac58bd53 Fix possibly-invalid HTML when a rubric node is manually created 2024-07-15 10:04:48 +01:00
Bénédikt Tran
2a30bb661f
Fix PEP 695 output for classes in the LaTeX builder (#12561) 2024-07-15 05:17:36 +01:00
Adam Turner
c4fb47310f
Remove `sphinx.environment` from the no-any-generics whitelist (#12575) 2024-07-15 03:49:24 +01:00
Chris Sewell
41b363dbff
[rst] Add level option to rubric directive (#12506)
This commit adds a `level` option to the `rubric` directive, which propagates a `level` attribute to the `rubric` node,
and allows renderers to select a specific heading level.

Logic for this attribute has been added to the HTML5 and LaTeX builder.
2024-07-14 05:52:58 +02:00
James Addison
35e7bfc347
linkcheck: Ignore URLs that respond with non-Unicode content (#12197) 2024-07-14 03:48:38 +01:00
Lingyu Hu
f0d8e2ef5e
Provide a better error message if the master document is not included in the project documents (#12011) 2024-07-14 03:22:39 +01:00
Jakob Lykke Andersen
e08f12f848
toctree: Use document nesting instead of domain nesting when adding domain objects (#12367)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-07-14 01:16:26 +01:00
David Stansby
159c26715b
Display `typing.Annotated` metadata in the Python domain (#11785)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2024-07-14 00:52:55 +01:00
Adam Turner
469a809ead
Increase minimum required dependency versions (#12556) 2024-07-13 08:59:24 +01:00
Trevor Bekolay
2c0943784c
Disallow module cycles in autosummary (#6792)
Consider the following piece of reST::

  .. automodule:: sphinx.ext.autosummary
     :members:

     .. autosummary::

        sphinx.ext.autosummary.Autosummary

This inserts an autosummary after the module docstring, but before
the members of the module. Without the change in this commit, this
would fail because `import_by_name` would attempt to import::

    sphinx.ext.autosummary.sphinx.ext.autosummary.Autosumary

because the prefix (from the parent) is `sphinx.ext.autosummary`,
and the name is `sphinx.ext.autosummary.Autosummary`, which is able
to be imported from `sphinx.ext.autosummary`, but is not the way
that anyone would want to refer to it.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-07-13 06:37:50 +01:00
James Addison
a6c2bdd371
Rename template files in Sphinx to use the `.jinja` extension (#12364) 2024-07-11 12:31:35 +01:00
Ashley Whetter
e38a60d3f2
Add `py:type` directive and role for documenting type aliases (#11989)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2024-07-11 12:15:54 +01:00
James Addison
91c5cd3abd
Improve relevance scoring in HTML search results (#12441)
Co-authored-by: Will Lachance <wlach@protonmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-07-11 11:55:40 +01:00
Stephen Finucane
6b37a6b2a2
Allow explicitly specifying modules in the coverage builder (#11592)
Currently there is no mechanism to identify totally undocumented modules
in the coverage builder, unlike with partially documented modules.
Resolve this by introducing a new ``coverage_modules`` config option.
This is a list of modules that should be documented somewhere
within the documentation tree. 
Any modules that are specified in the configuration value but 
are not documented anywhere will result in a warning. 
Likewise, any modules that are not in the config option but 
are documented somewhere will result in a warning.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2024-07-11 07:36:36 +01:00
Thomas Fanning
6cc1177d10
Allow configuring the separator used in numbering equations (#12523)
Co-authored-by: Thomas Fanning <tom@ferb.ne.anl.gov>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2024-07-10 22:23:38 +01:00
Adam Turner
82edc3d385
Rewrite `usage/configuration.rst` (#12537)
- Remove now-removed configuration values
- Use obvious 'unset' defaults for ``project`` and ``author``
- Prefer 'e.g.' to 'ex.'
- Allow non-list sequence types in various configuration values
- Add types and defaults to every confval directive
2024-07-10 21:43:14 +01:00
tuncbkose
bdd9140842
Remove custom SVG processing in the HTML builder (#12425)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2024-07-10 18:31:01 +00:00
James Addison
84c11b2f66
Improve JavaScript test fixture generation (#12531)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-07-10 19:00:34 +01:00
M Bussonnier
6e3a191185
Bump Ruff to 0.5.1 (#12530) 2024-07-10 14:13:10 +01:00
Tim Hoffmann
a95d716f7f
Add a class option to the toctree directive (#12524)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-07-10 11:07:49 +01:00
James Addison
c67ef51df9
Update MyPy for types-docutils 0.21.0.20240708 (#12522) 2024-07-09 20:59:49 +01:00
James Addison
7eb77f2372
HTML Search: omit anchor reference from document titles in the search index. (#12047) 2024-07-08 13:34:11 +02:00
James Addison
e63e2f3ccb
Update MyPy for types-docutils 0.21.0.20240704 (#12511)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2024-07-06 19:29:18 +01:00
Nicolas Peugnet
b23ac4f16e
Fix invalid genindex.html file produced with translated docs (#12495) 2024-07-04 03:00:28 +02:00
Bénédikt Tran
3209275a4a
Support `typing_extensions.Unpack` (#12258)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2024-07-03 03:03:41 +01:00
James Addison
778013f91a
Regression: restore extraction of data-URI images from source for builders whose output formats do not support them natively (#12344) 2024-07-03 02:16:43 +01:00
Adam Turner
24a0385997
Add `allow_section_headings` to SphinxDirective parsing methods (#12503) 2024-07-02 23:53:58 +01:00
Adam Turner
86c51f3bfa Bump Ruff to 0.5.0 2024-07-02 22:50:35 +01:00
Adam Turner
1887df0b5c
Add reStructuredText parsing functions to `SphinxDirective` (#12492) 2024-07-02 22:14:19 +01:00
James Addison
6b237d9a70
[linkcheck] Allow integer for linkcheck_rate_limit_timeout (#12470)
Eliminate type-related warnings when users configure a valid integer value for the `linkcheck_rate_limit_timeout` config setting.

Co-authored-by: Chris Sewell <chrisj_sewell@hotmail.com>
2024-06-24 17:26:24 +00:00
Chris Sewell
bc1a5c5c88
[autogen] Add --remove-old option (#12456)
A common "gotcha" of re-running `sphinx-autogen`, is that if there are changes it will not remove old files, leading to build errors for files not in a `toctree`

This commit introduces a `--remove-old` option to remove these files.

Note, a key detail here is that we don't want to simply clear the directory before running `sphinx-autogen`,
since this would lead to all files having a new `mtime`,
and then `sphinx-build` would rebuild all of them even if they have not changed.
So we must first collect the list of all correct files, then remove any not in the list.
2024-06-21 19:29:46 +02:00
Chris Sewell
d7e1bfeb4b
[apidoc] Add --remove-old option (#12448)
A common "gotcha" of re-running `sphinx-apidoc`, is that if the modules API changes it will not remove old files, leading to build errors for files not in a `toctree`

This commit introduces a `--remove-old` option to remove these files.

Note, a key detail here is that we don't want to simply clear the directory before running `sphinx-apidoc`,
since this would lead to all files having a new `mtime`,
and then `sphinx-build` would rebuild all of them even if they have not changed.
So we must first collect the list of all correct files, then remove any not in the list.

The commit also improves some typing of the code and replace `os.path` by `pathlib.Path` in most instances
2024-06-20 13:12:37 +02:00
Thomas Weißschuh
6471027d19
[themes]: Include project name in logo_alt by default (#12421)
The "alt" attribute of an `<img>` is required to convey all information.
Make it clear which logo is shown.
Also make it possible for users to override the logo_alt with a custom value.
2024-06-18 01:47:14 +02:00
Bénédikt Tran
581bcdd140
[config] correctly synchronize `root_doc and master_doc` (#12417) 2024-06-17 18:04:33 +02:00
Thomas Weißschuh
d5bdabdd80
themes: Don't duplicate "navigation" in aria-label (#12422)
The word "navigation" is not supposed to be included as part of the aria-label attribute:
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/navigation_role
2024-06-17 12:50:34 +02:00
James Addison
799ae16a01
Intersphinx: log warnings for ambiguous target resolutions. (#12329)
This commit adds detection of ambiguous ``std:label`` and ``std:term`` references (due to case-insensitivity)
during loading and resolution of Intersphinx targets,
and emits a warning if found.

Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
Co-authored-by: Chris Sewell <chrisj_sewell@hotmail.com>
2024-06-17 12:42:22 +02:00
James Addison
568e26c797
[tests] JavaScript: refactor test fixtures (#12102)
This PR allows to serve JavaScript test fixtures using a fixture-based logic as for Python tests.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-06-13 13:07:46 +02:00
Nicolas Peugnet
ac3f74a3e0
[tests] Add intl regression test for term not found warning (#12388)
Add test for term not found warning in test_intl to prevent future regressions
2024-05-19 12:14:13 +02:00
Chris Sewell
3496de62b7
🧪 Fix python 3.13 tests (#12373) 2024-05-15 06:28:40 +02:00
Hugo van Kemenade
c06f246124
sphinx.ext.extlinks: Add extlink-{name} CSS class to links (#12319) 2024-05-15 04:21:11 +02:00
James Addison
9467bf7849
[typehints] tests: enable mypy for linkcheck builder tests. (#12160) 2024-05-15 04:13:57 +02:00
Adam Turner
0d74c85e8c
Extract inner check functions in `test_domain_cpp` (#12336) 2024-04-29 02:07:56 +01:00
Adam Turner
938d3732f8
Collapse unions of `Literal types in stringify_annotation` (#12325) 2024-04-25 16:07:10 +01:00
Chris Sewell
49726c28f4 Split `sphinx.ext.intersphinx._load`
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2024-04-25 15:30:55 +01:00
Adam Turner
3b907a1caa Import INVENTORY_FILENAME from canonical location 2024-04-25 13:35:06 +01:00
Benjamin Cabé
a66546895e
Properly support WebP in the image converter (#12224)
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2024-04-25 03:43:45 +01:00
Adam Turner
50895827ba Mark `test_restify_Annotated` as an expected failure 2024-04-25 03:07:48 +01:00
Adam Turner
6b70620993 Add a test for `restify(Annotated[...])` 2024-04-24 23:16:22 +01:00
Adam Turner
173b5912e5 linkcheck: Fix test to use dynamic port numbers 2024-04-24 19:36:36 +01:00
Will Lachance
208f4bcb66
HTML Search: Fix removal of unwanted anchor content from search results (#12321) 2024-04-24 19:09:14 +01:00
James Addison
2008aa8c78
linkcheck: Store the original (unquoted) anchor (#12206) 2024-04-24 18:07:31 +00:00
James Addison
9ebc46a74f
Remove test result sharing between 'test_html5_output' and 'test_html5_download' (#12119) 2024-04-24 07:45:36 +01:00
James Addison
0806a00f05
Support `.jinja` for theme static templates (#11916)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-04-23 10:40:24 +01:00
Adam Turner
5a55856dd1
Properly format `collections.abc.Callable` (#12314) 2024-04-23 08:01:09 +00:00
Nicolas Peugnet
55ca37f684
Add more internationalisation tests (#12277)
- Add test for basic literal block & literalinclude translation
- Add gettext builder test for litteral blocks additional targets
- Add i18n test for xref roles in titles
- Add i18n tests for strange markup
2024-04-23 05:22:43 +01:00
Bénédikt Tran
48a345b7c5
Improve type hints for `sphinx.ext.autodoc.mock` (#12280)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2024-04-22 23:23:57 +01:00
Adam Turner
2361db5748 Enable more Ruff checks 2024-04-22 23:09:01 +01:00
Adam Turner
740b964d45 fixup! Elaborate a little more in the warning message for `config.cache` 2024-04-17 21:50:46 +01:00
Adam Turner
141f3ecdf3 Elaborate a little more in the warning message for `config.cache` 2024-04-17 21:24:11 +01:00
James Addison
943f6fbf9a
Fix test expectations for enum rendering on Python 3.12.3 (#12293)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-04-17 04:18:52 +01:00
Adam Turner
7bf847d2b9 Fix the valid types check for `Any in sphinx.config` 2024-04-17 02:27:21 +01:00
Adam Turner
09d05a0858 Don't render types with `Optional[...]`
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-04-15 01:35:47 +01:00
James Addison
67303920fe
Make the test suite connectivity-agnostic (#12095)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2024-04-12 23:32:12 +01:00
James Addison
532ad0306e
linkcheck: Make the new 'timeout' status opt-in (#12023)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-04-12 23:18:22 +01:00
Adam Turner
b30088d68f Bump Ruff to 0.3.7 2024-04-12 21:04:51 +01:00
Adam Turner
44a42d53af Add basic tests for `_ConfigFile` 2024-04-11 19:01:17 +01:00
Adam Turner
8976fa4498 Support `theme.toml` 2024-04-11 19:01:17 +01:00
Adam Turner
6fd8b30043
Parse `theme.conf to a new _ConfigFile` type (#12254) 2024-04-10 00:10:26 +01:00
Adam Turner
3421e5382a
Narrow `Generator[T, None, None] types to Iterator[T]` (#12241) 2024-04-09 03:26:44 +01:00
Bénédikt Tran
db4939f007
[misc] update wording of `versionadded to Added in [...]` (#12184)
Motivated by the community feedback, the wording of ``versionadded`` is changed 
from ``New in [...]`` to ``Added in [...]``.
2024-04-05 13:32:55 +02:00
Bénédikt Tran
f7a1397d6c
[console] enhance detection and elimination of known ANSI escape sequences (#12216)
This PR improves the logic for detecting and eliminating ANSI color codes and other escape sequences introduced by Sphinx. ANSI escape sequences that are not natively known to Sphinx are not eliminated (e.g., VT100-specific functions).
2024-04-04 12:35:38 +02:00
James Addison
df3cde65fa
[tests] linkcheck: bind each test HTTP server to a unique port per-testcase (#12126)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-04-04 11:25:53 +02:00
Chris Sewell
430866e029
👌 Add warning log for config values that cannot be cached (#12203)
As a user and/or extension developer, it can be a source of confusion when,
on performing a `sphinx-build` for a cached project, 
an unchanged configuration variable is always marked as changed (triggering a full rebuild).

This is often due to the variable being an unpicklable value,
which is silently omitted from the cache (i.e. the `environment.pickle`).

This commit introduces a specific warning for when a configuration variable is omitted from the cache,
allowing users to understand the root of the problem.
2024-03-27 12:59:24 +01:00
Chris Sewell
448cb9931d
🔧 CI: fix Python 3.13 tests (#12210) 2024-03-27 12:45:24 +01:00
James Addison
bfce4f54b0
[HTML search] include partially-matched document titles in search results (#12041)
Co-authored-by: William Lachance <wlach@protonmail.com>
2024-03-26 12:18:26 +01:00
Chris Sewell
04bd0df100
👌 Improve external role warnings (and revert object fallback) (#12193)
The key issue this commit seeks to address, is that existing tools / documentation often lead users to mistakenly use object types and not role names, a classic example being `function` not `func`

Previously, the warning message for using e.g. `` external:function`target` `` (with `py` as the default domain), would be:

```
WARNING: role for external cross-reference not found: function
```

This gives no information to the user on how to fix the issue, even though there is actually quite an easy fix

This commit adds logic to create more specific / helpful warning messages, e.g.

```
WARNING: role for external cross-reference not found in domains 'py', 'std': 'function' (perhaps you meant one of: 'py:func', 'py:obj')
```

This goes through the same original logic but, if the role is not found, it will look if the role name is actually an available object type on the domain(s), and then suggest its related roles.

This commit also reverts #12133, which provided a (silent) fallback to auto convert an object type to a role name.
2024-03-25 14:39:51 +01:00
James Addison
0ef96a7d52
[tests] fix flakiness of `test_linkcheck_exclude_documents` (#12189) 2024-03-25 11:48:03 +01:00
Bénédikt Tran
f26d492d6d
[config] protect `is_serializable` against circular references (#12196) 2024-03-25 11:19:02 +01:00
Bénédikt Tran
885818bb7f
[tests] move utilities and static data into dedicated modules and remove `html5lib` (#12173)
Since #12168, HTML files are now XML compliant, hence ``html5lib`` is no more needed as a testing dependencies.
2024-03-25 11:03:44 +01:00
Bénédikt Tran
f24eef7b6b
[cleanup] deprecate `sphinx.testing.util.strip_escseq in favor of sphinx.util.console.strip_colors` (#12186) 2024-03-24 00:43:54 +01:00
Bénédikt Tran
d91ba115bd
Verify that an asset file to be copied exists (#12183) 2024-03-23 14:57:32 +01:00
Chris Sewell
66fa790b3a
[tests] Add basic build test for all builtin themes (#12168)
Add `tests/test_theming/test_theming.py::test_theme_builds`, which is a parametrized test against all builtin sphinx HTML themes, that tests:

1. that the themes builds without warnings for a basic project, and
2. that all `.html` files it produces are valid XML (see https://html.spec.whatwg.org/)

https://pypi.org/project/defusedxml/ was added to the test dependencies, in order to safely parse the XML

This required one fix for `sphinx/themes/basic/search.html`, and one for `sphinx/themes/bizstyle/layout.html`

Also, `tests/test_theming` was removed from the `ruff format` exclude list
2024-03-22 12:57:34 +01:00
danieleades
6c92c5c0f3
[lint] bump ruff version (#12170)
Co-authored-by: daniel.eades <daniel.eades@seebyte.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-03-22 10:33:42 +01:00
James Addison
4eede5c534
[tests] Increase timeouts for linkcheck build tests. (#12166)
This is an attempt to resolve intermittent failures of the linkcheck tests currently occuring on the GitHub CI
2024-03-21 21:46:27 +01:00
James Addison
d7c94d1696
[cleanup] test utils: more concise BaseHTTPRequestHandler references. (#12158) 2024-03-21 15:08:49 +01:00
Bénédikt Tran
da0733b338
[autodoc] fix rendering of enumerations inheriting from mixin and data types (#11596) 2024-03-21 12:36:36 +01:00
James Addison
078a80a42d
[refactor] test utils: simplify signatures and remove from ruff exclusion list. (#12155)
Apply some small method-signature cleanups in `tests/utils.py`,
and remove it from the `ruff format` exclusion list.
2024-03-21 11:08:35 +01:00
James Addison
b7f708dc63
[tests] utils: refactor type-hint signatures. (#12144)
Consolidate the provision of a single `http_server` utility method, with `tls_enabled` as a boolean flag,
and rework type annotations to make them more understandable.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Chris Sewell <chrisj_sewell@hotmail.com>
2024-03-20 23:13:41 +01:00
Chris Sewell
565d4104d5
👌 Handle external references pointing to object types (#12133)
This commit fixes the issue of `objects.inv` denoting object names, whilst the `external` role only allows for role names. 

As an example, take the `objects.inv` for the sphinx documentation, which contains:

```
py:function
    compile                  : usage/domains/python.html#compile
```

A user might understandably expect that they could reference this using `` :external:py:function:`compile` ``, but actually this would previously error with:

```
WARNING: role for external cross-reference not found: py:function
```

this is because, `function` is the object type, yet `external` expects the related role name `func`.

It should not be necessary for the user to know about this distinction,
so in this commit, we add logic, to first look if the name relates to a role name (as previous, to not be back-breaking) but, if not, then also look if the name relates to an object that has a known role and, if so, use that.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-03-19 13:42:50 +01:00
Chris Sewell
b0f096f440
Add show_warning_types configuration variable (#12131)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-03-19 10:22:28 +01:00
James Addison
7894b5a269
[tests] linkcheck: add test coverage for behaviour of a locally-existing file. (#12128)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-03-18 18:36:22 +01:00
Bénédikt Tran
ff252861a7
[tests] add missing `@pytest.mark.sphinx` markers (#12125) 2024-03-18 11:16:15 +01:00
Bénédikt Tran
6ac2210109
[tests] use deduced `srcdir` instead of an explicit one (#12124) 2024-03-18 10:59:48 +01:00
James Addison
bf0bec3b4b
[search] filter script and style elements from search result summary text. (#12057)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-03-17 15:14:03 +01:00
danieleades
4f7318767c
[lint] extend FURB lints (#12088) 2024-03-17 12:06:39 +01:00
Bénédikt Tran
57e302ed74
[lint] run `mypy on tests/test_addnodes.py` (#12111) 2024-03-16 18:38:22 +01:00
Bénédikt Tran
b0ded2e624
[lint] run `mypy on test_application.py` (#12112) 2024-03-16 18:29:44 +01:00
Bénédikt Tran
2df5b0a8ab
[lint] whitelist all test files except configuration and utils in tests (#12109) 2024-03-16 18:06:58 +01:00
James Addison
5695b76f05
[tests] epub: skip the epubcheck test if Java or epubcheck itself are not found (#12098)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-03-15 12:02:41 +01:00
Bénédikt Tran
98d0cc8602
[tests] skip tests that need remote content if host is offline (#12091) 2024-03-14 15:33:24 +01:00
Bénédikt Tran
c86e90842f
[autodoc] add support for singledispatchmethod class methods (#11284) 2024-03-14 12:26:35 +01:00
Bénédikt Tran
dbb4da375f
[tests] correctly intercept or suppress warnings in tests (#12085) 2024-03-14 11:45:45 +01:00
danieleades
92380e60d1
[lint] add RUFF005 lint (#12068)
Co-authored-by: daniel.eades <daniel.eades@seebyte.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-03-14 11:26:30 +01:00
danieleades
fb91cb3f43
[lint] add FURB105 lint (#12069)
Co-authored-by: daniel.eades <daniel.eades@seebyte.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-03-14 11:05:40 +01:00
danieleades
d74a450213
[deps] bump ruff version (#12065)
Co-authored-by: daniel.eades <daniel.eades@seebyte.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-03-14 10:42:55 +01:00
James Addison
c6bd97ceae
Revert "tests: implement readiness check before yielding local-http(s) test servers" (#12078) 2024-03-14 09:01:17 +01:00
James Addison
5523c9bbe4
[tests] reflect changes to Enum signature in Python 3.13 (#12054) 2024-03-08 11:58:04 +01:00
James Addison
1bfddf81e0
[CI/CD] implement readiness check before yielding local-http(s) test servers (#12050)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-03-08 11:16:31 +01:00
Will Lachance
ae51974e21
[search] fix multiple term matching edge case (#11960) 2024-03-03 18:01:10 +01:00
Will Lachance
1e4f80d7a4
[search] fix partial matches overwriting full matches (#11958) 2024-03-03 15:18:07 +01:00
Ned Batchelder
a7df31cfc6
[render] do not use a dash if there's no description to introduce (#12035)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-03-03 10:46:11 +01:00
Bénédikt Tran
d8c301482d
[hotfix] fix a warning in #12036 (#12043) 2024-03-03 09:29:47 +00:00
Ned Batchelder
574519900e
[test] force rendering of ANSI colors for non-tty objects (#12036) 2024-03-02 17:36:41 +01:00
Michael Goerz
265ffeedbd
[intersphinx] allow case-insensitive match of label-refs through intersphinx (#12033) 2024-03-02 12:39:51 +01:00
Will Lachance
9a30ca7da1
[HTML search] use anchor for search preview (#11944) 2024-02-27 15:22:52 +01:00
James Addison
8aa5edd585
[config] copyright correction logic: handle year-to-year ranges without trailing authorship info (#11914) 2024-02-24 16:21:29 +01:00
Bénédikt Tran
707bfbd669
[gettext] fix flaky test on windows (#11940) 2024-02-24 13:34:52 +01:00
MatrixEditor
182053198d
Added support for `slice` objects in subscriptions (#11981)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-02-14 14:45:30 +01:00
Bénédikt Tran
08386826fb
Add tests for `:manpage:` inside a title (#11705) 2024-02-14 10:33:09 +01:00
Bénédikt Tran
b587eb243a
Fix `:paramtype:` reference targets (#11964) 2024-02-14 00:04:49 +01:00
Frank Dana
41ab0f9a41
[test] add py:currentmodule unit test (#11920) 2024-02-03 16:14:26 +01:00
j-carson
cd2bf0a7e5
#11917 - Fix rendering of inherited members for Python 3.9 (#11919)
Co-authored-by: j-carson <j-carson@fastmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-02-03 10:46:13 +01:00
danieleades
f9c8943889
Use `# NoQA` consistently (#11903)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2024-01-21 20:20:58 +00:00
Hugo van Kemenade
95b2cce9a0
Add a `versionremoved` directive (#11905)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-01-21 20:12:52 +00:00
James Addison
2418e007ce
Support unary subtraction in annotation parsing (#11904) 2024-01-21 14:31:04 +00:00
Adam Turner
360c7a8022 Load themes through iteration rather than recursion 2024-01-21 03:59:31 +00:00
Adam Turner
99dd0cb4c6 Refactor `sphinx.theming` to prepare for iterative loading 2024-01-21 03:59:31 +00:00
Adam Turner
0ca2ddf924 Make various theme-related objects private 2024-01-21 03:59:31 +00:00