Skip to content

Commit ec4ccb0

Browse files
authored
1 parent f7a7ed7 commit ec4ccb0

File tree

3 files changed

+48
-24
lines changed

3 files changed

+48
-24
lines changed

docs/requirements-docs.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
sphinx>=8.1.0
22
furo>=2022.3.4
33
myst-parser>=4.0.0
4+
sphinx_inline_tabs>=2023.04.21

docs/source/conf.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@
3535
# Add any Sphinx extension module names here, as strings. They can be
3636
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3737
# ones.
38-
extensions = ["sphinx.ext.intersphinx", "docs.source.html_builder", "myst_parser"]
38+
extensions = [
39+
"sphinx.ext.intersphinx",
40+
"sphinx_inline_tabs",
41+
"docs.source.html_builder",
42+
"myst_parser",
43+
]
3944

4045
# Add any paths that contain templates here, relative to this directory.
4146
templates_path = ["_templates"]

docs/source/running_mypy.rst

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -285,16 +285,22 @@ If you are getting this error, try to obtain type hints for the library you're u
285285
You can do this via setting the
286286
:option:`--follow-untyped-imports <mypy --follow-untyped-imports>`
287287
command line flag or :confval:`follow_untyped_imports` config file option to True.
288-
This option can be specified on a per-module basis as well::
288+
This option can be specified on a per-module basis as well:
289289

290-
# mypy.ini
291-
[mypy-untyped_package.*]
292-
follow_untyped_imports = True
290+
.. tab:: mypy.ini
293291

294-
# pyproject.toml
295-
[[tool.mypy.overrides]]
296-
module = ["untyped_package.*"]
297-
follow_untyped_imports = true
292+
.. code-block:: ini
293+
294+
[mypy-untyped_package.*]
295+
follow_untyped_imports = True
296+
297+
.. tab:: pyproject.toml
298+
299+
.. code-block:: toml
300+
301+
[[tool.mypy.overrides]]
302+
module = ["untyped_package.*"]
303+
follow_untyped_imports = true
298304
299305
If you are unable to find any existing type hints nor have time to write your
300306
own, you can instead *suppress* the errors.
@@ -312,16 +318,22 @@ not catch errors in its use.
312318
suppose your codebase
313319
makes heavy use of an (untyped) library named ``foobar``. You can silence
314320
all import errors associated with that library and that library alone by
315-
adding the following section to your config file::
321+
adding the following section to your config file:
322+
323+
.. tab:: mypy.ini
324+
325+
.. code-block:: ini
316326
317-
# mypy.ini
318-
[mypy-foobar.*]
319-
ignore_missing_imports = True
327+
[mypy-foobar.*]
328+
ignore_missing_imports = True
320329
321-
# pyproject.toml
322-
[[tool.mypy.overrides]]
323-
module = ["foobar.*"]
324-
ignore_missing_imports = true
330+
.. tab:: pyproject.toml
331+
332+
.. code-block:: toml
333+
334+
[[tool.mypy.overrides]]
335+
module = ["foobar.*"]
336+
ignore_missing_imports = true
325337
326338
Note: this option is equivalent to adding a ``# type: ignore`` to every
327339
import of ``foobar`` in your codebase. For more information, see the
@@ -334,15 +346,21 @@ not catch errors in its use.
334346
in your codebase, use :option:`--disable-error-code=import-untyped <mypy --ignore-missing-imports>`.
335347
See :ref:`code-import-untyped` for more details on this error code.
336348

337-
You can also set :confval:`disable_error_code`, like so::
349+
You can also set :confval:`disable_error_code`, like so:
350+
351+
.. tab:: mypy.ini
352+
353+
.. code-block:: ini
354+
355+
[mypy]
356+
disable_error_code = import-untyped
357+
358+
.. tab:: pyproject.toml
338359

339-
# mypy.ini
340-
[mypy]
341-
disable_error_code = import-untyped
360+
.. code-block:: ini
342361
343-
# pyproject.toml
344-
[tool.mypy]
345-
disable_error_code = ["import-untyped"]
362+
[tool.mypy]
363+
disable_error_code = ["import-untyped"]
346364
347365
You can also set the :option:`--ignore-missing-imports <mypy --ignore-missing-imports>`
348366
command line flag or set the :confval:`ignore_missing_imports` config file

0 commit comments

Comments
 (0)