Commit Graph

4890 Commits

Author SHA1 Message Date
Adam Turner
790bee64ce
intersphinx: Resolve implicit self-references (#13322)
When intersphinx_resolve_self was added, it only applied to the :external:<inv_name>:`blah` role.
This extends the functionality to implicit intersphinx references of the form :ref:`<inv_name>:blah`.
2025-02-09 22:29:04 +00:00
Adam Dangoor
03df8119b3
Remove mypy override for `tests.test_builders.test_build_html_copyright` (#13317) 2025-02-09 21:29:38 +00:00
Adam Turner
c4b3dcbaf9
Convert '0' and '1' to bool for config overrides (#13318) 2025-02-07 19:38:33 +00:00
Adam Dangoor
cef9d869dd
Remove type check overrides for `tests/test_builders/test_build_gettext.py` (#13299)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-02-07 15:13:56 +00:00
Adam Dangoor
0782273dec
Remove mypy overrides for two files in `tests/test_writers` (#13315) 2025-02-07 14:49:19 +00:00
Adam Dangoor
36e3f3250d
Remove mypy overrides for `tests/test_extensions/test_ext_autodoc_autodata.py` (#13314) 2025-02-07 14:47:00 +00:00
Adam Dangoor
e33b6ff82d
Remove mypy overrides for `tests/test_config` (#13313) 2025-02-07 14:45:25 +00:00
Adam Dangoor
d2627c44f3
Remove type check overrides for `tests/test_extensions/test_ext_githubpages.py` (#13306) 2025-02-07 14:43:27 +00:00
Adam Dangoor
6de28062fc
Remove type check overrides for `tests/test__cli/test__cli_util_errors.py` (#13305) 2025-02-07 14:42:11 +00:00
Adam Dangoor
7799dd1b8b
Remove type check overrides for `test_build_epub` (#13296) 2025-02-07 14:41:09 +00:00
Adam Turner
22e0f8944b Use pathlib in more places 2025-02-07 13:51:42 +00:00
pholica
766900e416
autodoc: Handle multiple inheritance correctly (#13136)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-02-03 01:46:35 +00:00
Bénédikt Tran
1b83e55809
autodoc: add support for `python_display_short_literal` (#12003)
Co-authored-by: James Addison <55152140+jayaddison@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-02-02 22:50:41 +00:00
Adam Turner
34519be296
Ignore test failures from broken Babel 2.17 on Windows (#13290) 2025-02-02 20:01:21 +00:00
Adam Turner
0d4425ce07
Use read-only test roots (#13285) 2025-01-31 18:04:36 +00:00
Adam Turner
17b8241585 Include test roots in `pytest_report_header()` 2025-01-31 17:22:51 +00:00
Tiger3018
af3bb3687c
Use warning types and sub-types in more places (#11677)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-01-29 19:22:44 +00:00
Chris Sewell
134bd7f1fb
Add `collapsible` option to admonition directives (#12507)
This PR adds the `collapsible` and option to the core admonition type directives, which are propagated to the nodes, e.g.

```restructuredtext
.. admonition:: title
   :collapsible:

   content

.. note:: content
   :collapsible: closed
```

For the HTML5 writer, this replaces the outer `div` with a `details` tag, and the title `p`  with a `summary` tag (with an `open` attribute if set), e.g.

```html
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>hallo</p>
</div>
```

changes to

```html
<details class="admonition note" open="open">
<summary class="admonition-title">Note</summary>
<p>hallo</p>
</details>
```

Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-01-29 18:06:57 +01:00
Adam Turner
5667050dd2
Improve the displayed signature for abstract methods (#13271) 2025-01-29 02:34:46 +00:00
Adam Turner
82e9182d43
Initial implementation of an `_Inventory` type (#13275) 2025-01-29 00:46:08 +00:00
Tim Hoffmann
5871ce266a
Add support for short signatures in autosummary (#13172)
This introduces a new ``:signatures:`` option to ``sphinx.ext.autosummary``.
Possible values are:

"long" (*default*):
  same as the current default

"short":
  format functions and classes as ``func()`` if they do not
  have arguments and ``func(…)`` if they do have arguments.

"none":
  replaces the pre-existing ``:nosignatures:`` (which becomes deprecated)

The new functionality here is the "short" option.
This allows to distinguish properties and attributes
from functions and classes without costing a lot of space
for a long signature.
2025-01-29 00:44:09 +00:00
Adam Turner
56e52fcdbe
Fix type error in mocking `_fetch_inventory` (#13274) 2025-01-29 00:04:46 +00:00
Jonny Saunders
18bb8bcef5
Implement :no-index-entry: for autodoc (#12233)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-01-28 02:01:31 +00:00
Adam Turner
7801540c08
Support `:no-index-entry: in .. {js,py}:module::` (#13272) 2025-01-28 01:33:28 +00:00
Adam Turner
705c1beb16
Convert _INVALID_BUILTIN_CLASSES to use strings instead of runtime objects (#13270)
This is a more flexible approach that does not require importing several modules and types into ``sphinx.util.typing``.
2025-01-27 19:17:00 +00:00
Adam Turner
7406d4222f
Move mypy test module exclusions to per-module ignores (#13265) 2025-01-26 19:41:15 +00:00
Adam Turner
42f300ee83
Rename the `:nowrap and :nosignatures:` directive options (#13264)
Rename the ``:nowrap`` and ``:nosignatures:`` directive options to
``:no-wrap`` and ``:no-signatures:``, for readability.
This mirrors changes already made to `:no-index`, `:no-index-entry`,
`:no-contents-entry`, and `:no-search` in Sphinx 7.2 and 7.3.
2025-01-23 04:30:46 +00:00
Adam Turner
ca2ab35d94
Add further types to `_INVALID_BUILTIN_CLASSES` (#13263) 2025-01-23 03:53:25 +00:00
Adam Turner
47bff3faea
Add new `types types to _INVALID_BUILTIN_CLASSES` (#13262) 2025-01-23 03:35:53 +00:00
Adam Turner
ea5fc5957a
Add `pathlib types to _INVALID_BUILTIN_CLASSES` (#13261) 2025-01-23 03:26:35 +00:00
Thomas Louf
1418339eb9
Allow configuration of trailing commas in multi-line signatures (#12975)
Stop outputting trailing commas for C and C++, as it is invalid syntax.

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>
Co-authored-by: Jakob Lykke Andersen <jakobandersen@users.noreply.github.com>
2025-01-21 20:08:18 +00:00
Adam Turner
fe06909e32
autodoc: Use type stub files when documenting native modules (#13253) 2025-01-21 19:36:55 +00:00
Bénédikt Tran
5b9fb9e060
autodoc: fix ordering of class and static methods for groupwise order (#13201)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-01-20 15:19:05 +00:00
Adam Turner
4b1d64d1e5 Use `app.build(force_all=True)` 2025-01-18 18:38:59 +00:00
Adam Turner
31de02cc52
Bump Ruff to 0.9.2 (#13250) 2025-01-18 00:35:09 +00:00
Adam Turner
e5131ba1bd
intersphinx: Create an `_InventoryItem` type (#13248) 2025-01-17 00:41:11 +00:00
Valentin Pratz
cfb47865d6
autosummary: Respect empty module `__all__` (#13187)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-01-16 23:36:31 +00:00
Takayuki SHIMIZUKAWA
099b91a9d9
Bump `ENV_VERSION for _CurrentDocument` (#13246)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-01-16 17:53:40 +00:00
Adam Turner
a56fdad70b
Use `sphinx._cli.util.colour in sphinx.util.console` (#13241) 2025-01-16 16:57:28 +00:00
Adam Turner
4fbcc2098e
intersphinx: Import names from proper places (#13244) 2025-01-15 21:41:34 +00:00
Adam Turner
c4daa95c09 Enable the entire D category in Ruff 2025-01-14 15:55:02 +00:00
Adam Turner
c66d3e85d1 Enable 11 more categories in Ruff
* flake8-builtins ('A')
* flake8-blind-except ('BLE')
* flake8-copyright ('CPY')
* eradicate ('ERA')
* flake8-boolean-trap ('FBT')
* flake8-fixme ('FIX')
* flake8-implicit-str-concat ('ISC')
* pep8-naming ('N')
* flake8-use-pathlib ('PTH')
* flake8-self ('SLF')
* tryceratops ('TRY')
2025-01-14 14:43:02 +00:00
Adam Turner
3521cb60cf Enable the entire TD category in Ruff 2025-01-14 12:52:43 +00:00
Adam Turner
cc8161a066 Move `sphinx.util re-exports to module __getattr__` 2025-01-14 01:01:52 +00:00
Adam Turner
66905d24e1 Use strict flake8-type-checking settings in Ruff 2025-01-13 21:56:36 +00:00
Adam Turner
f6d1665f84 Use frozensets for permitted types in `app.add_config_value()` 2025-01-13 21:18:17 +00:00
Bénédikt Tran
2a19d293b6
autodoc: fix detection of class methods implemented by extension modules (#13200)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-01-12 11:07:30 +00:00
Adam Turner
72ce43619c
Remove unneeded runtime typing imports (#13233) 2025-01-12 01:04:14 +00:00
Adam Turner
d29c2c1ff3
Implement key splitting in the `:kbd: role and remove KeyboardTransform` (#13227)
``KeyboardTransform.run`` takes 1.2% of the runtime of a build, but
is not be needed if ``:kbd:`` is converted to a proper role.

We implement key splitting in the ``:kbd:`` role, and return a sequence
of parsed nodes rather than a nested collection of roles with ``class="kbd compound"``.
2025-01-10 19:51:17 +00:00
Adam Turner
dec45eaf28 Bump Ruff to 0.9.0 2025-01-10 13:50:26 +00:00