Skip to content

Commit fe6b682

Browse files
veatchmsullivan
authored andcommitted
Link to Stub files page and clarify that file with .pyi extension is stub file (#7198)
1 parent 831f1cd commit fe6b682

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

docs/source/installed_packages.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ Making PEP 561 compatible packages
4242

4343
PEP 561 notes three main ways to distribute type information. The first is a
4444
package that has only inline type annotations in the code itself. The second is
45-
a package that ships stub files with type information alongside the runtime
46-
code. The third method, also known as a "stub only package" is a package that
47-
ships type information for a package separately as stub files.
45+
a package that ships :ref:`stub files <stub-files>` with type information
46+
alongside the runtime code. The third method, also known as a "stub only
47+
package" is a package that ships type information for a package separately as
48+
stub files.
4849

4950
If you would like to publish a library package to a package repository (e.g.
5051
PyPI) for either internal or external use in type checking, packages that
@@ -105,8 +106,9 @@ the setup.py might look like:
105106
packages=["package_b"]
106107
)
107108
108-
In this example, both ``lib.py`` and ``lib.pyi`` exist. At runtime, the Python
109-
interpreter will use ``lib.py``, but mypy will use ``lib.pyi`` instead.
109+
In this example, both ``lib.py`` and the ``lib.pyi`` stub file exist. At
110+
runtime, the Python interpreter will use ``lib.py``, but mypy will use
111+
``lib.pyi`` instead.
110112

111113
If the package is stub-only (not imported at runtime), the package should have
112114
a prefix of the runtime package name and a suffix of ``-stubs``.

0 commit comments

Comments
 (0)