Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Sphinx 7.x #16460

Merged
merged 1 commit into from
Nov 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Support Sphinx 7.x
Adjust many links to docs.python.org so that intersphinx can connect
them to local file for offline use.
  • Loading branch information
mr-c committed Nov 11, 2023
commit 1ef5927df08d4eaa41faba666df48cfaa6f0e98f
2 changes: 1 addition & 1 deletion docs/requirements-docs.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sphinx>=4.2.0,<5.0.0
sphinx>=5.1.0
furo>=2022.3.4
5 changes: 2 additions & 3 deletions docs/source/class_basics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ effect at runtime:
Abstract base classes and multiple inheritance
**********************************************

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

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

.. code-block:: python
Expand Down
6 changes: 2 additions & 4 deletions docs/source/config_file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,8 @@ section of the command line docs.
Crafting a single regular expression that excludes multiple files while remaining
human-readable can be a challenge. The above example demonstrates one approach.
``(?x)`` enables the ``VERBOSE`` flag for the subsequent regular expression, which
`ignores most whitespace and supports comments`__. The above is equivalent to:
``(^one\.py$|two\.pyi$|^three\.)``.

.. __: https://docs.python.org/3/library/re.html#re.X
:py:data:`ignores most whitespace and supports comments <re.VERBOSE>`.
The above is equivalent to: ``(^one\.py$|two\.pyi$|^three\.)``.

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

Expand Down
3 changes: 1 addition & 2 deletions docs/source/error_code_list2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,7 @@ that only existed during type-checking.
In runtime it fails with expected ``NameError``,
which can cause real problem in production, hidden from mypy.

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

Now users can actually import ``reveal_type`` to make the runtime code safe.
Expand Down
3 changes: 1 addition & 2 deletions docs/source/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,7 @@ Mypy can also understand how to work with types from libraries that you use.

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

.. code-block:: python

Expand Down
5 changes: 3 additions & 2 deletions docs/source/html_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
from sphinx.addnodes import document
from sphinx.application import Sphinx
from sphinx.builders.html import StandaloneHTMLBuilder
from sphinx.environment import BuildEnvironment


class MypyHTMLBuilder(StandaloneHTMLBuilder):
def __init__(self, app: Sphinx) -> None:
super().__init__(app)
def __init__(self, app: Sphinx, env: BuildEnvironment) -> None:
super().__init__(app, env)
self._ref_to_doc = {}

def write_doc(self, docname: str, doctree: document) -> None:
Expand Down
2 changes: 1 addition & 1 deletion docs/source/more_types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ Typing async/await

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

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