Skip to content

Commit 596ad55

Browse files
authored
Merge branch '4.x' into 4.x
2 parents 423b10a + d788e78 commit 596ad55

File tree

189 files changed

+29384
-7025
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

189 files changed

+29384
-7025
lines changed

.github/ISSUE_TEMPLATE/bug-report.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ body:
1616
label: How to Reproduce
1717
description: Please provide steps to reproduce this bug.
1818
value: |
19-
<Paste your command-line here which cause the problem>
2019
```
2120
$ git clone https://github.com/.../some_project
2221
$ cd some_project

CHANGES

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,30 @@ Deprecated
1313
Features added
1414
--------------
1515

16+
* #9445: autodoc: Support class properties
17+
* #9479: autodoc: Emit a warning if target is a mocked object
18+
* #9447: html theme: Expose the version of Sphinx in the form of tuple as a
19+
template variable ``sphinx_version_tuple``
20+
* #9445: py domain: ``:py:property:`` directive supports ``:classmethod:``
21+
option to describe the class property
22+
1623
Bugs fixed
1724
----------
1825

26+
* #9487: autodoc: typehint for cached_property is not shown
27+
* #9509: autodoc: AttributeError is raised on failed resolving typehints
28+
* #9518: autodoc: autodoc_docstring_signature does not effect to ``__init__()``
29+
and ``__new__()``
30+
* #9481: autosummary: some warnings contain non-existing filenames
31+
* #9481: c domain: some warnings contain non-existing filenames
32+
* #9481: cpp domain: some warnings contain non-existing filenames
33+
* #9456: html search: abbreation marks are inserted to the search result if
34+
failed to fetch the content of the page
35+
1936
Testing
2037
--------
2138

22-
Release 4.1.2 (in development)
39+
Release 4.1.3 (in development)
2340
==============================
2441

2542
Dependencies
@@ -37,9 +54,31 @@ Features added
3754
Bugs fixed
3855
----------
3956

57+
* #9512: sphinx-build: crashed with the HEAD of Python 3.10
58+
4059
Testing
4160
--------
4261

62+
Release 4.1.2 (released Jul 27, 2021)
63+
=====================================
64+
65+
Incompatible changes
66+
--------------------
67+
68+
* #9435: linkcheck: Disable checking automatically generated anchors on
69+
github.com (ex. anchors in reST/Markdown documents)
70+
71+
Bugs fixed
72+
----------
73+
74+
* #9489: autodoc: Custom types using ``typing.NewType`` are not displayed well
75+
with the HEAD of 3.10
76+
* #9490: autodoc: Some objects under ``typing`` module are not displayed well
77+
with the HEAD of 3.10
78+
* #9436, #9471: autodoc: crashed if ``autodoc_class_signature = "separated"``
79+
* #9456: html search: html_copy_source can't control the search summaries
80+
* #9435: linkcheck: Failed to check anchors in github.com
81+
4382
Release 4.1.1 (released Jul 15, 2021)
4483
=====================================
4584

doc/latex.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,6 +1151,20 @@ Miscellany
11511151
Formerly, use of *fncychap* with other styles than ``Bjarne`` was
11521152
dysfunctional.
11531153

1154+
- Docutils :dudir:`container` directives are supported in LaTeX output: to
1155+
let a container class with name ``foo`` influence the final PDF via LaTeX,
1156+
it is only needed to define in the preamble an environment
1157+
``sphinxclassfoo``. A simple example would be:
1158+
1159+
.. code-block:: latex
1160+
1161+
\newenvironment{sphinxclassred}{\color{red}}{}
1162+
1163+
Currently the class names must contain only ascii characters and avoid
1164+
characters special to LaTeX such as ``\``.
1165+
1166+
.. versionadded:: 4.1.0
1167+
11541168
.. hint::
11551169

11561170
As an experimental feature, Sphinx can use user-defined template file for

doc/templating.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,16 @@ in the future.
372372

373373
.. data:: sphinx_version
374374

375-
The version of Sphinx used to build.
375+
The version of Sphinx used to build represented as a string for example "3.5.1".
376+
377+
.. data:: sphinx_version_tuple
378+
379+
The version of Sphinx used to build represented as a tuple of five elements.
380+
For Sphinx version 3.5.1 beta 3 this would be `(3, 5, 1, 'beta', 3)``.
381+
The fourth element can be one of: ``alpha``, ``beta``, ``rc``, ``final``.
382+
``final`` always has 0 as the last element.
383+
384+
.. versionadded:: 4.2
376385

377386
.. data:: style
378387

doc/tutorial/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ Sweet!
233233
.. note::
234234

235235
Generating a PDF using Sphinx can be done running ``make latexpdf``,
236-
provided that the system has a working :math:`\LaTeX` installation,
236+
provided that the system has a working LaTeX installation,
237237
as explained in the documentation of :class:`sphinx.builders.latex.LaTeXBuilder`.
238238
Although this is perfectly feasible, such installations are often big,
239239
and in general LaTeX requires careful configuration in some cases,

doc/usage/extensions/autodoc.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ inserting them into the page source under a suitable :rst:dir:`py:module`,
353353
autodata
354354
automethod
355355
autoattribute
356+
autoproperty
356357
357358
These work exactly like :rst:dir:`autoclass` etc.,
358359
but do not offer the options used for automatic member documentation.
@@ -422,6 +423,8 @@ inserting them into the page source under a suitable :rst:dir:`py:module`,
422423
option.
423424
.. versionchanged:: 2.0
424425
:rst:dir:`autodecorator` added.
426+
.. versionchanged:: 2.1
427+
:rst:dir:`autoproperty` added.
425428
.. versionchanged:: 3.4
426429
:rst:dir:`autodata` and :rst:dir:`autoattribute` now have a ``no-value``
427430
option.

doc/usage/restructuredtext/domains.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,13 @@ The following directives are provided for module and class contents:
329329
330330
Indicate the property is abstract.
331331
332+
.. rst:directive:option:: classmethod
333+
:type: no value
334+
335+
Indicate the property is a classmethod.
336+
337+
.. versionaddedd: 4.2
338+
332339
.. rst:directive:option:: type: type of the property
333340
:type: text
334341

sphinx/application.py

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def __init__(self, srcdir: str, confdir: Optional[str], outdir: str, doctreedir:
197197

198198
# notice for parallel build on macOS and py38+
199199
if sys.version_info > (3, 8) and platform.system() == 'Darwin' and parallel > 1:
200-
logger.info(bold(__("For security reason, parallel mode is disabled on macOS and "
200+
logger.info(bold(__("For security reasons, parallel mode is disabled on macOS and "
201201
"python3.8 and above. For more details, please read "
202202
"https://github.com/sphinx-doc/sphinx/issues/6803")))
203203

@@ -415,7 +415,7 @@ def connect(self, event: str, callback: Callable, priority: int = 500) -> int:
415415
:param event: The name of target event
416416
:param callback: Callback function for the event
417417
:param priority: The priority of the callback. The callbacks will be invoked
418-
in the order of *priority* in asending.
418+
in order of *priority* (ascending).
419419
:return: A listener ID. It can be used for :meth:`disconnect`.
420420
421421
.. versionchanged:: 3.0
@@ -493,7 +493,7 @@ def add_config_value(self, name: str, default: Any, rebuild: Union[bool, str],
493493
values accordingly.
494494
495495
496-
:param name: The name of configuration value. It is recommended to be prefixed
496+
:param name: The name of the configuration value. It is recommended to be prefixed
497497
with the extension name (ex. ``html_logo``, ``epub_title``)
498498
:param default: The default value of the configuration.
499499
:param rebuild: The condition of rebuild. It must be one of those values:
@@ -539,10 +539,10 @@ def set_translator(self, name: str, translator_class: Type[nodes.NodeVisitor],
539539
"""Register or override a Docutils translator class.
540540
541541
This is used to register a custom output translator or to replace a
542-
builtin translator. This allows extensions to use custom translator
542+
builtin translator. This allows extensions to use a custom translator
543543
and define custom nodes for the translator (see :meth:`add_node`).
544544
545-
:param name: The name of builder for the translator
545+
:param name: The name of the builder for the translator
546546
:param translator_class: A translator class
547547
:param override: If true, install the translator forcedly even if another translator
548548
is already installed as the same name
@@ -606,11 +606,11 @@ def add_enumerable_node(self, node: Type[Element], figtype: str,
606606
using :rst:role:`numref`.
607607
608608
:param node: A node class
609-
:param figtype: The type of enumerable nodes. Each figtypes have individual numbering
610-
sequences. As a system figtypes, ``figure``, ``table`` and
611-
``code-block`` are defined. It is able to add custom nodes to these
612-
default figtypes. It is also able to define new custom figtype if new
613-
figtype is given.
609+
:param figtype: The type of enumerable nodes. Each figtype has individual numbering
610+
sequences. As system figtypes, ``figure``, ``table`` and
611+
``code-block`` are defined. It is possible to add custom nodes to
612+
these default figtypes. It is also possible to define new custom
613+
figtype if a new figtype is given.
614614
:param title_getter: A getter function to obtain the title of node. It takes an
615615
instance of the enumerable node, and it must return its title as
616616
string. The title is used to the default title of references for
@@ -629,7 +629,7 @@ def add_enumerable_node(self, node: Type[Element], figtype: str,
629629
def add_directive(self, name: str, cls: Type[Directive], override: bool = False) -> None:
630630
"""Register a Docutils directive.
631631
632-
:param name: The name of directive
632+
:param name: The name of the directive
633633
:param cls: A directive class
634634
:param override: If true, install the directive forcedly even if another directive
635635
is already installed as the same name
@@ -755,9 +755,9 @@ def add_role_to_domain(self, domain: str, name: str, role: Union[RoleFunction, X
755755
Like :meth:`add_role`, but the role is added to the domain named
756756
*domain*.
757757
758-
:param domain: The name of target domain
759-
:param name: A name of role
760-
:param role: A role function
758+
:param domain: The name of the target domain
759+
:param name: The name of the role
760+
:param role: The role function
761761
:param override: If true, install the role forcedly even if another role is already
762762
installed as the same name
763763
@@ -773,8 +773,8 @@ def add_index_to_domain(self, domain: str, index: Type[Index], override: bool =
773773
774774
Add a custom *index* class to the domain named *domain*.
775775
776-
:param domain: The name of target domain
777-
:param index: A index class
776+
:param domain: The name of the target domain
777+
:param index: The index class
778778
:param override: If true, install the index forcedly even if another index is
779779
already installed as the same name
780780
@@ -942,8 +942,8 @@ def add_js_file(self, filename: str, priority: int = 500, **kwargs: Any) -> None
942942
Add *filename* to the list of JavaScript files that the default HTML
943943
template will include in order of *priority* (ascending). The filename
944944
must be relative to the HTML static path , or a full URI with scheme.
945-
If the priority of JavaScript file is the same as others, the JavaScript
946-
files will be included in order of the registration. If the keyword
945+
If the priority of the JavaScript file is the same as others, the JavaScript
946+
files will be included in order of registration. If the keyword
947947
argument ``body`` is given, its value will be added between the
948948
``<script>`` tags. Extra keyword arguments are included as attributes of
949949
the ``<script>`` tag.
@@ -971,7 +971,7 @@ def add_js_file(self, filename: str, priority: int = 500, **kwargs: Any) -> None
971971
* - 800
972972
- default priority for :confval:`html_js_files`
973973
974-
A JavaScript file can be added to the specific HTML page when on extension
974+
A JavaScript file can be added to the specific HTML page when an extension
975975
calls this method on :event:`html-page-context` event.
976976
977977
.. versionadded:: 0.5
@@ -993,8 +993,8 @@ def add_css_file(self, filename: str, priority: int = 500, **kwargs: Any) -> Non
993993
Add *filename* to the list of CSS files that the default HTML template
994994
will include in order of *priority* (ascending). The filename must be
995995
relative to the HTML static path, or a full URI with scheme. If the
996-
priority of CSS file is the same as others, the CSS files will be
997-
included in order of the registration. The keyword arguments are also
996+
priority of the CSS file is the same as others, the CSS files will be
997+
included in order of registration. The keyword arguments are also
998998
accepted for attributes of ``<link>`` tag.
999999
10001000
Example::
@@ -1022,15 +1022,15 @@ def add_css_file(self, filename: str, priority: int = 500, **kwargs: Any) -> Non
10221022
* - 800
10231023
- default priority for :confval:`html_css_files`
10241024
1025-
A CSS file can be added to the specific HTML page when on extension calls
1025+
A CSS file can be added to the specific HTML page when an extension calls
10261026
this method on :event:`html-page-context` event.
10271027
10281028
.. versionadded:: 1.0
10291029
10301030
.. versionchanged:: 1.6
10311031
Optional ``alternate`` and/or ``title`` attributes can be supplied
1032-
with the *alternate* (of boolean type) and *title* (a string)
1033-
arguments. The default is no title and *alternate* = ``False``. For
1032+
with the arguments *alternate* (a Boolean) and *title* (a string).
1033+
The default is no title and *alternate* = ``False``. For
10341034
more information, refer to the `documentation
10351035
<https://mdn.io/Web/CSS/Alternative_style_sheets>`__.
10361036
@@ -1051,7 +1051,7 @@ def add_latex_package(self, packagename: str, options: str = None,
10511051
r"""Register a package to include in the LaTeX source code.
10521052
10531053
Add *packagename* to the list of packages that LaTeX source code will
1054-
include. If you provide *options*, it will be taken to `\usepackage`
1054+
include. If you provide *options*, it will be taken to the `\usepackage`
10551055
declaration. If you set *after_hyperref* truthy, the package will be
10561056
loaded after ``hyperref`` package.
10571057
@@ -1087,7 +1087,7 @@ def add_autodocumenter(self, cls: Any, override: bool = False) -> None:
10871087
10881088
Add *cls* as a new documenter class for the :mod:`sphinx.ext.autodoc`
10891089
extension. It must be a subclass of
1090-
:class:`sphinx.ext.autodoc.Documenter`. This allows to auto-document
1090+
:class:`sphinx.ext.autodoc.Documenter`. This allows auto-documenting
10911091
new types of objects. See the source of the autodoc module for
10921092
examples on how to subclass :class:`Documenter`.
10931093
@@ -1140,10 +1140,10 @@ def add_source_suffix(self, suffix: str, filetype: str, override: bool = False)
11401140
"""Register a suffix of source files.
11411141
11421142
Same as :confval:`source_suffix`. The users can override this
1143-
using the setting.
1143+
using the config setting.
11441144
11451145
If *override* is True, the given *suffix* is forcedly installed even if
1146-
a same suffix is already installed.
1146+
the same suffix is already installed.
11471147
11481148
.. versionadded:: 1.8
11491149
"""
@@ -1204,8 +1204,8 @@ def add_html_math_renderer(self, name: str,
12041204
def add_message_catalog(self, catalog: str, locale_dir: str) -> None:
12051205
"""Register a message catalog.
12061206
1207-
:param catalog: A name of catalog
1208-
:param locale_dir: The base path of message catalog
1207+
:param catalog: The name of the catalog
1208+
:param locale_dir: The base path of the message catalog
12091209
12101210
For more details, see :func:`sphinx.locale.get_translation()`.
12111211
@@ -1216,7 +1216,7 @@ def add_message_catalog(self, catalog: str, locale_dir: str) -> None:
12161216

12171217
# ---- other methods -------------------------------------------------
12181218
def is_parallel_allowed(self, typ: str) -> bool:
1219-
"""Check parallel processing is allowed or not.
1219+
"""Check whether parallel processing is allowed or not.
12201220
12211221
:param typ: A type of processing; ``'read'`` or ``'write'``.
12221222
"""

sphinx/builders/html/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from docutils.utils import relative_path
2727

2828
from sphinx import __display_version__, package_dir
29+
from sphinx import version_info as sphinx_version
2930
from sphinx.application import Sphinx
3031
from sphinx.builders import Builder
3132
from sphinx.config import ENUM, Config
@@ -516,6 +517,7 @@ def prepare_writing(self, docnames: Set[str]) -> None:
516517
'language': self.config.language,
517518
'css_files': self.css_files,
518519
'sphinx_version': __display_version__,
520+
'sphinx_version_tuple': sphinx_version,
519521
'style': self._get_style_filename(),
520522
'rellinks': rellinks,
521523
'builder': self.name,

sphinx/builders/linkcheck.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,10 @@ def setup(app: Sphinx) -> Dict[str, Any]:
714714
app.add_event('linkcheck-process-uri')
715715

716716
app.connect('config-inited', compile_linkcheck_allowed_redirects, priority=800)
717-
app.connect('linkcheck-process-uri', rewrite_github_anchor)
717+
718+
# FIXME: Disable URL rewrite handler for github.com temporarily.
719+
# ref: https://github.com/sphinx-doc/sphinx/issues/9435
720+
# app.connect('linkcheck-process-uri', rewrite_github_anchor)
718721

719722
return {
720723
'version': 'builtin',

0 commit comments

Comments
 (0)