Commit Graph

43 Commits

Author SHA1 Message Date
Adam Turner
57a63ea603
Use more precise last-modified times for files (#12661) 2024-07-23 14:52:31 +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
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
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
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
Adam Turner
2bd973e719
autodoc: Fix warnings with dataclasses in `Annotated` metadata (#12622) 2024-07-20 11:28:03 +01:00
Adam Turner
e61f56950d
Do not add the module prefix when generating autosummary documents (#12609) 2024-07-17 21:42:21 +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
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
M Bussonnier
6e3a191185
Bump Ruff to 0.5.1 (#12530) 2024-07-10 14:13:10 +01: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
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
Chris Sewell
3496de62b7
🧪 Fix python 3.13 tests (#12373) 2024-05-15 06:28:40 +02: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
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
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
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
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
448cb9931d
🔧 CI: fix Python 3.13 tests (#12210) 2024-03-27 12:45:24 +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
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
da0733b338
[autodoc] fix rendering of enumerations inheriting from mixin and data types (#11596) 2024-03-21 12:36:36 +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
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
c86e90842f
[autodoc] add support for singledispatchmethod class methods (#11284) 2024-03-14 12:26:35 +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
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
5523c9bbe4
[tests] reflect changes to Enum signature in Python 3.13 (#12054) 2024-03-08 11:58:04 +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
Michael Goerz
265ffeedbd
[intersphinx] allow case-insensitive match of label-refs through intersphinx (#12033) 2024-03-02 12:39:51 +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
b587eb243a
Fix `:paramtype:` reference targets (#11964) 2024-02-14 00:04:49 +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
Adam Turner
38ac67bd6c Use long `re` flags 2024-01-19 02:28:06 +00:00
Adam Turner
462404cb25 Organise tests into directories 2024-01-17 03:56:35 +00:00