Commit Graph

4619 Commits

Author SHA1 Message Date
James Addison
06c1339bb3 Ensure that `linkcheck_anchors` is properly respected (#11544)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-08-02 02:55:37 +01:00
Jean-François B
4958d2abf1 Fix flake8 E231 reported linting failure 2023-08-02 02:04:55 +01:00
Jean-François B
eb0499a696 Fix flake8 E231 reported linting failure 2023-07-30 15:00:55 +02:00
Adam Turner
629b862cde Spring-clean `sphinx.testing.utils` (#11534) 2023-07-28 23:24:13 +01:00
Adam Turner
1cfb68d8be Consistently name the object description options (#11533)
*  The directive option ``:noindex:`` was renamed to ``:no-index:``.
*  The directive option ``:noindexentry:`` was renamed to ``:no-index-entry:``.
*  The directive option ``:nocontentsentry:`` was renamed to ``:no-contents-entry:``.

The previous names are retained as aliases, but will be deprecated
and removed in a future version of Sphinx (9.0 or later).
2023-07-28 22:30:26 +01:00
latosha-maltba
97d2c5da2f Add the `:no-typesetting:` option for only creating targets (#10478)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2023-07-28 19:43:27 +01:00
Christoph Hasse
fca33a203d Add additional `stringify_annotation` tests (#11027) 2023-07-28 06:45:20 +01:00
benkrikler
762ed8540a Add line numbers in `sphinx.ext.viewdoc` (#6319)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2023-07-28 05:52:48 +01:00
Ralf Grubenmann
6178163cb1 Fix relative references in SVGs generated by `sphinx.ext.graphviz` (#11078)
Co-authored-by: Ralf Grubenmann <ralf.grubenmann@gmail.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2023-07-28 05:47:23 +01:00
Martin Liška
2c0b81d88b Refactor `test_attrgetter_using` (#11293)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2023-07-28 04:20:36 +01:00
Jorge Leitao
99f9209924 Add summary statistics to the coverage report (#5474)
The current implementation of ``sphinx.ext.coverage`` outputs which
methods,classes, and functions are documented.
This commit adds a short summary of this report in terms of
``documented objects / total number of objects``,
both per module and total.

The purpose of this is to support
a currently not mainstream but relevant use-case:
a coverage report on the number of objects that are documented.

By having the statistics on the report or on the stdout,
a regex expression can capture the coverage percentage
(e.g. ``re.search(r'TOTAL.*?([0-9.]{4,6}\%)', d).group(1)``)
and use it e.g. in another report, a status badge, etc.

Two options were added to the configuration to allow a table
to be printed in the report and/or to stdout.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-07-28 02:33:42 +01:00
Adam Turner
7cce00aa7d Refactor `sphinx.util.inspect` and tests (#11527) 2023-07-28 02:05:40 +01:00
Adam Turner
49d8304670 Start using `pathlib.Path and deprecate sphinx.testing.path` (#11526) 2023-07-28 00:39:12 +01:00
James Addison
467e94dc62 object inspection: produce deterministic descriptions for nested collection datastructures (#11312)
``util.inspect.object_description`` already attempts to sort collections, but this can fail.
This commit handles the failure case by using string-based object descriptions
as a fallback deterministic sort ordering, and protects against recursive collections.

Co-authored-by: Chris Lamb <lamby@debian.org>
Co-authored-by: Faidon Liambotis <paravoid@debian.org>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-07-27 22:45:51 +01:00
Adam Turner
a01e1a21ac Merge branch '7.1.x'
# Conflicts:
#	CHANGES
#	sphinx/__init__.py
#	sphinx/config.py
2023-07-27 21:38:35 +01:00
Adam Turner
8452300d54 Fix multi-line copyright when `SOURCE_DATE_EPOCH` is set (#11524)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2023-07-27 21:27:14 +01:00
Adam Turner
5cf3dce36e Deprecate `md5 and sha1 wrappers in sphinx.util` (#11512) 2023-07-25 02:29:28 +01:00
Adam Turner
ad61e41157 Drop support for Python 3.8 (#11511) 2023-07-25 02:07:23 +01:00
Adam Turner
066e0fabc6 Add translation progress information (#11509)
Co-authored-by: Manuel Kaufmann <humitos@gmail.com>
2023-07-24 20:19:31 +01:00
picnixz
82bc15aec3 Enable skipping anchor verification on a per-URL basis (#11489)
Add a new ``linkcheck_anchors_ignore_for_url`` configuration variable.

Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2023-07-24 12:15:42 +01:00
picnixz
480630c649 Support PEP 695 and PEP 696 syntax in the Python domain (#11444)
* Generic classes can be documented with ``.. py:class::`` using PEP 695 syntax:

  .. code:: rst

     .. py:class:: Sequence[T]

* Generic functions can be documented with ``.. py:function::`` using PEP 695 syntax:

  .. code:: rst

     .. py:function:: foo[T](x: T)

* Default values for type bounds are supported.

Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2023-07-23 23:22:40 +01:00
James Addison
450ad637ac Begin using session-based HTTP requests in the linkcheck builder (#11503)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2023-07-23 22:23:08 +01:00
Adam Turner
ae866b1289 Avoid deprecated `Node.traverse method in test_node_translated_attribute` 2023-07-23 21:33:15 +01:00
danieleades
4de540efb6 Enable mypy 'strict optional' for 19 modules (#11422)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2023-07-23 21:29:04 +01:00
Manuel Kaufmann
f4a47f1401 Keep the `translated` attribute on translated nodes (#11502)
This particular commit ensures that the ``translated`` attribute
is retained on translated nodes so that developers may use it
to improve the experience on translations.
This attribute can be useful to calculate
the translated percentage of a particular document,
to visually mark paragraphs as not translated,
and many other applications.
2023-07-23 21:00:24 +01:00
picnixz
12e7cff0b6 Allow using `rst_prolog` with a role in a document title (#11445)
Fix the field list field name recognition regular expression to avoid false positives,
as interpreted text roles may not be field name blocks.

Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2023-07-23 17:14:01 +01:00
James Addison
c583e0f9b0 Add client connection-pool contention coverage to the `linkcheck` tests (#11402)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-07-23 16:24:12 +01:00
James Addison
2b333265cb Add a connection-count measurement to the `linkcheck` tests (#11374) 2023-07-23 16:06:23 +01:00
Adam Turner
aabcda94cf Add more information for the `test_gettext_dont_rebuild_mo` test (#11500) 2023-07-23 00:32:27 +01:00
Adam Turner
d71c781187 Re-structure the `linkcheck` builder (#11499)
Re-organise and re-structure the ``linkcheck`` builder:

- All functions defined within functions are factored out into top-level functions or class methods
- Classes and methods have been re-arranged (Builder, PostTransform, Checker, Worker)
- TLS verification on ``sphinx.util.requests`` has been changed to not pass the ``Config`` object all the way down
- The ``Hyperlink`` object now stores the document path
- ``BuildEnvironment`` and ``Config`` objects are used to extract properties and are not stored as class attributes
2023-07-23 00:01:41 +01:00
James Addison
566e4e74a0 Use HTTP/1.1 in linkcheck test webservers (#11392) 2023-07-22 20:12:32 +01:00
James Addison
bef7fc2e45 Refactor HTTP handlers in `linkcheck` builder tests (#11426) 2023-07-20 22:20:53 +01:00
Adam Turner
ce140e8155 Introduce artificial delay into `test_gettext_dont_rebuild_mo` 2023-07-20 21:51:08 +01:00
James Addison
13720de50c Treat SSL failures as broken links in the linkcheck builder (#11431)
TLS operates at a lower layer than HTTP, and so if there is a TLS-related error from a host,
it seems unlikely that retrying with a different higher-layer protocol request
(HTTP GET instead of HTTP HEAD) could succeed.
We should not make additional HTTP requests that we do not believe will succeed.
2023-07-20 21:38:21 +01:00
James Addison
e45fb5e61b Reduce the lifetime of `response` in the linkcheck builder (#11432)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2023-07-20 21:14:00 +01:00
Adam Turner
d3c91f9512 Refactor `status_iterator` 2023-05-15 10:43:55 +01:00
Stefanie Molin
e09d02e440 Allow `copyright` to contain multiple entries (#10983)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-05-11 22:43:48 +01:00
TLouf
86b07d4a97 Allow multi-line object description signatures (#11011)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
Co-authored-by: Jean-François B <2589111+jfbu@users.noreply.github.com>
Co-authored-by: TLouf <loufthomas@gmail.com>
2023-05-11 14:28:57 +01:00
Adam Turner
ae206694e6 html builder: Append CRC32 checksum to asset URIs (#11415) 2023-05-11 05:19:31 +01:00
Adam Turner
706f5f9cc8 Warn on deprecated Python-specific index types (#11412) 2023-05-09 22:57:39 +01:00
James Addison
c9d0933e5d linkcheck: Use context managers for HTTP requests (#11318)
This closes HTTP responses when no content reads are required, as
when requests are made in streaming mode, ``requests`` doesn't know
whether the caller may intend to later read content from a streamed
HTTP response object and holds the socket open.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-05-09 17:09:35 +01:00
Adam Turner
ad473730a3 Remove HTML 4 support (#11385) 2023-04-28 11:32:12 +01:00
Adam Turner
3c4e78e236 Make `locale required in sphinx.util.i18n.format_date()` (#11366) 2023-04-27 01:30:40 +01:00
Adam Turner
973e8fb5cf Remove the deprecated `sphinx.ext.napoleon.iterators` module (#11364) 2023-04-27 01:27:07 +01:00
Adam Turner
2a9e805206 Remove the deprecated Setuptools integration (#11363) 2023-04-27 01:22:04 +01:00
Adam Turner
720f89d1d6 Update test for Alabaster version tuple 2023-04-26 17:24:02 +01:00
Adam Turner
d2aa91f63c Revert the default type of `nitpick_ignore[_regex] to list` 2023-04-25 11:31:57 +01:00
James Addison
59de8d5202 Revert "Support and prefer `.jinja to _t` for static templates (#11165)" (#11329)
This reverts commit 5d13215b58.
2023-04-23 19:06:44 +01:00
Adam Turner
aee3c0ab75 Partially revert "Disable localisation when SOURCE_DATE_EPOCH is set (#10949)" (#11343)
This keeps some of the added tests, and avoids a full revert of ``sphinx.locale``.
2023-04-21 19:04:26 +01:00
Martin Liška
186d596f33 Use `overwrite_file context manager in test_ext_autodoc_configs` (#11320)
The tests modify source files (e.g. index.rst) that are not restored
and thus another test could read an altered source file, it leading
to unexpected test results.

Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2023-04-21 02:44:11 +01:00