Commit Graph

20736 Commits

Author SHA1 Message Date
Adam Turner
a5d7cce7f5 Fix `_ConfigFile` handling of sequence types 2024-04-11 19:01:17 +01:00
Dimitri Papadopoulos Orfanos
6caf4ee17e
Reduce size of PNG files in the tutorial (#12245) 2024-04-11 16:26:06 +01:00
Adam Turner
6fd8b30043
Parse `theme.conf to a new _ConfigFile` type (#12254) 2024-04-10 00:10:26 +01:00
Dimitri Papadopoulos Orfanos
dbedb52782
Apply the FURB142 Ruff rule (#12240) 2024-04-09 18:48:24 +01:00
Dimitri Papadopoulos Orfanos
be9b9349cc
Use the proper type for Pytest's "minversion" option (#12244)
Numbers (integer or decimal) are permitted, but strings are preferred
2024-04-09 18:46:32 +01:00
Adam Turner
9ebfadbcad Create subsection for theme configuration 2024-04-09 18:34:55 +01:00
Adam Turner
e3f0aa9307 Ensure raw strings are used for regular expression patterns 2024-04-09 18:33:42 +01:00
Dimitri Papadopoulos Orfanos
63e7ee6de1
[docs] Fix a typo newly found by codespell (#12243) 2024-04-09 09:42:01 +02:00
Adam Turner
3421e5382a
Narrow `Generator[T, None, None] types to Iterator[T]` (#12241) 2024-04-09 03:26:44 +01:00
Eric Norige
413e740dca
🐛 Fix singlehtml target uris to be same-document references (#11970)
Before this change, target_uris would be generated as `index.html#foo`. 
This makes it difficult to rename the generated document and can require reloading the document when following a link.

After this change, they are just `#foo`, which avoids the above problems.
2024-04-08 00:08:30 +02:00
Bénédikt Tran
c7c02002e5
[search] fix an undefined local variable (#12235) 2024-04-06 20:12:53 +02: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
Nok Lam Chan
17a84a6443
[doc] clarify units for `linkcheck_rate_limit_timeout` (#12225)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

This normalizes the description of the configuration value so that its default value's unit is the same as the internal one (i.e., seconds).
2024-04-05 11:51:02 +02:00
James Addison
4b7a2c3f05
[search] refactor `Search.query` into separate functions (#12229)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-04-05 11:20:04 +02:00
James Addison
de1c4d7faa
[typo] fix `language_data.js_t` (#12228)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-04-04 19:24:58 +02:00
Nicolas Peugnet
600d3d3ada
[i18n] fix non-translated formatted string in the search page (#12215) 2024-04-04 17:57:39 +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
Bénédikt Tran
cb8a28dd7e
[mypy] add stubs for color functions (#12217) 2024-04-01 13:45:47 +02:00
Bénédikt Tran
f5fc408e2a
[ruff] expand exclusion list (#12218) 2024-04-01 13:35:53 +02:00
Bénédikt Tran
d5baa46d85
[mypy] use explicit exclusion fpr test files (#12199)
This explicitly excludes test files instead of ignoring errors by test modules.
2024-03-28 09:11:56 +01: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
Bénédikt Tran
2e05fd2ffe
[cleanup] remove deprecated objects and improve deprecation private interface (#12185)
This removes the deprecated objects that should have been removed in 7.x.
2024-03-25 12:45:45 +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
f44ff30673
[doc] cleanup references and update external URLs (#12182) 2024-03-25 11:39:05 +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
Jakob Lykke Andersen
9e239729d4
C, fix debug functionality (#12194) 2024-03-24 14:44:19 +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
danieleades
22cee42094
[lint] use `types-docutils instead of docutils-stubs for docutils` type annotations (#12012)
Co-authored-by: daniel.eades <daniel.eades@seebyte.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-03-23 21:09:18 +01:00
James Addison
42a0d73160
[lint] follow PEP 8 for module-level dunder names (#12180)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-03-23 19:21:22 +01:00
James Addison
4b3c4abe0d
[cleanup] add `confval role to entry for linkcheck_allow_unauthorized` (#12177) 2024-03-23 17:40:50 +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
Hugo van Kemenade
b1548d0aa4
CI: Print detailed Python version (#12176)
Print additional python version information for CI jobs
2024-03-22 18:10:35 +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
Sutou Kouhei
982679eeee
[autosummary] fix suffix detection (#12149)
Fix a bug whereby the wrong file extension may be used,
when multiple suffixes are specified in the `source_suffix` configuration.

Co-authored-by: Chris Sewell <chrisj_sewell@hotmail.com>
2024-03-22 11:27:56 +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
Chris Sewell
d59b158371
👌 Make ExtensionMetadata type public and use it in internal extensions (#12153)
This type alias has now been fully documented for public consumption.

This will be beneficial to the sphinx ecosystem,
to aide/encourage extension developers to provide the correct metadata.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-03-21 16:19:26 +01:00
Chris Sewell
ace9d97500
👌 Improve signature and type annotations for SphinxLoggerAdapter.warning (#12154)
This commit overrides the  `SphinxLoggerAdapter.warning` method,
to provide documentation and type annotations specific to logging sphinx warnings.
This should aide sphinx core/extension developers in creating good warnings.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: danieleades <33452915+danieleades@users.noreply.github.com>
2024-03-21 15:41:22 +01:00
James Addison
d7c94d1696
[cleanup] test utils: more concise BaseHTTPRequestHandler references. (#12158) 2024-03-21 15:08:49 +01:00
Chris Sewell
b45fee696f
🔧 Sync make doclinter with CI check (#12156)
Unignore files in `make doclinter` command, fix the resulting issues, and use this command in the CI job
2024-03-21 13:12:06 +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
d908886c03
📚 add tip about running karma js tests on mac (#12140)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-03-20 21:55:34 +01:00
Chris Sewell
2d6f73ed68
🔧 Ruff format select sphinx modules with minimal diffs (#12146)
This comit removes select sphinx top-level modules from the `ruff format` exclude list.
They were selected based on the fact that they have the least diffs when formatted,
are not believe to introduce changes that would adversely affect any existing PRs.
2024-03-20 21:28:10 +01:00