Skip to content

Commit a7c53d3

Browse files
authored
Support Sphinx 7.x (#16460)
This is needed for the Debian package of mypy, as we package the docs and we have upgraded to Sphinx 7.2.6 from 5.3.0 for the next release. Thanks! Bonus: Adjust many links to docs.python.org so that intersphinx can connect them to local file for offline use.
1 parent c68bd7a commit a7c53d3

File tree

7 files changed

+11
-15
lines changed

7 files changed

+11
-15
lines changed

docs/requirements-docs.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
sphinx>=4.2.0,<5.0.0
1+
sphinx>=5.1.0
22
furo>=2022.3.4

docs/source/class_basics.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ effect at runtime:
263263
Abstract base classes and multiple inheritance
264264
**********************************************
265265

266-
Mypy supports Python :doc:`abstract base classes <library/abc>` (ABCs). Abstract classes
266+
Mypy supports Python :doc:`abstract base classes <python:library/abc>` (ABCs). Abstract classes
267267
have at least one abstract method or property that must be implemented
268268
by any *concrete* (non-abstract) subclass. You can define abstract base
269269
classes using the :py:class:`abc.ABCMeta` metaclass and the :py:func:`@abc.abstractmethod <abc.abstractmethod>`
@@ -371,8 +371,7 @@ property or an instance variable.
371371
Slots
372372
*****
373373

374-
When a class has explicitly defined
375-
`__slots__ <https://docs.python.org/3/reference/datamodel.html#slots>`_,
374+
When a class has explicitly defined :std:term:`__slots__`,
376375
mypy will check that all attributes assigned to are members of ``__slots__``:
377376

378377
.. code-block:: python

docs/source/config_file.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,8 @@ section of the command line docs.
238238
Crafting a single regular expression that excludes multiple files while remaining
239239
human-readable can be a challenge. The above example demonstrates one approach.
240240
``(?x)`` enables the ``VERBOSE`` flag for the subsequent regular expression, which
241-
`ignores most whitespace and supports comments`__. The above is equivalent to:
242-
``(^one\.py$|two\.pyi$|^three\.)``.
243-
244-
.. __: https://docs.python.org/3/library/re.html#re.X
241+
:py:data:`ignores most whitespace and supports comments <re.VERBOSE>`.
242+
The above is equivalent to: ``(^one\.py$|two\.pyi$|^three\.)``.
245243

246244
For more details, see :option:`--exclude <mypy --exclude>`.
247245

docs/source/error_code_list2.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,8 +524,7 @@ that only existed during type-checking.
524524
In runtime it fails with expected ``NameError``,
525525
which can cause real problem in production, hidden from mypy.
526526

527-
But, in Python3.11 ``reveal_type``
528-
`was added to typing.py <https://docs.python.org/3/library/typing.html#typing.reveal_type>`_.
527+
But, in Python3.11 :py:func:`typing.reveal_type` was added.
529528
``typing_extensions`` ported this helper to all supported Python versions.
530529

531530
Now users can actually import ``reveal_type`` to make the runtime code safe.

docs/source/getting_started.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,7 @@ Mypy can also understand how to work with types from libraries that you use.
256256

257257
For instance, mypy comes out of the box with an intimate knowledge of the
258258
Python standard library. For example, here is a function which uses the
259-
``Path`` object from the
260-
`pathlib standard library module <https://docs.python.org/3/library/pathlib.html>`_:
259+
``Path`` object from the :doc:`pathlib standard library module <python:library/pathlib>`:
261260

262261
.. code-block:: python
263262

docs/source/html_builder.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
from sphinx.addnodes import document
1010
from sphinx.application import Sphinx
1111
from sphinx.builders.html import StandaloneHTMLBuilder
12+
from sphinx.environment import BuildEnvironment
1213

1314

1415
class MypyHTMLBuilder(StandaloneHTMLBuilder):
15-
def __init__(self, app: Sphinx) -> None:
16-
super().__init__(app)
16+
def __init__(self, app: Sphinx, env: BuildEnvironment) -> None:
17+
super().__init__(app, env)
1718
self._ref_to_doc = {}
1819

1920
def write_doc(self, docname: str, doctree: document) -> None:

docs/source/more_types.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ Typing async/await
829829

830830
Mypy lets you type coroutines that use the ``async/await`` syntax.
831831
For more information regarding coroutines, see :pep:`492` and the
832-
`asyncio documentation <https://docs.python.org/3/library/asyncio.html>`_.
832+
`asyncio documentation <python:library/asyncio>`_.
833833

834834
Functions defined using ``async def`` are typed similar to normal functions.
835835
The return type annotation should be the same as the type of the value you

0 commit comments

Comments
 (0)