Commit Graph
20743 Commits
Author SHA1 Message Date
Dimitri Papadopoulos Orfanos 5bec029bfd Import `Sequence from collections.abc` (#12252) 2024-04-11 19:03:04 +01:00
Adam Turner 72760ad5f3 Ensure that `[theme] and [options] are tables in theme.toml` 2024-04-11 19:01:17 +01:00
Adam Turner 44a42d53af Add basic tests for `_ConfigFile` 2024-04-11 19:01:17 +01:00
Adam Turner fba5d2af6c Convert `theme.conf to theme.toml` (part 2) 2024-04-11 19:01:17 +01:00
Adam Turner e29e5fed36 Convert `theme.conf to theme.toml` (part 1) 2024-04-11 19:01:17 +01:00
Adam Turner 254bfe4f4e Add `theme.toml` migration tool 2024-04-11 19:01:17 +01:00
Adam Turner 8976fa4498 Support `theme.toml` 2024-04-11 19:01:17 +01:00
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 ChanandBénédikt Tran 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 AddisonandBénédikt Tran 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 AddisonandBénédikt Tran 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 AddisonandBénédikt Tran 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 AddisonandWilliam Lachance 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
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 AddisonandBénédikt Tran 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 KouheiandChris Sewell 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
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 SewellandBénédikt Tran 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
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