Skip to content

Commit 179780a

Browse files
authored
[docs] Add references to relevant Pyrefly sub-commands in tooling sections (#2334)
1 parent 6a9f353 commit 179780a

3 files changed

Lines changed: 26 additions & 1 deletion

File tree

docs/guides/writing_stubs.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@ stubs serve more as a starting point.
4040
4141
For more details, see `pyright docs <https://github.com/microsoft/pyright/blob/main/docs/type-stubs.md#generating-type-stubs-from-command-line>`__.
4242

43+
pyrefly
44+
-------
45+
46+
Pyrefly also contains a tool to generate stubs. Unlike stubgen and pyright, this tool will aggressively infer types for un-annotated code, including function parameters, resulting in stubs that contain more non-``Any`` annotations.
47+
48+
.. code-block:: console
49+
50+
pyrefly stubgen path/to/directory/
51+
52+
For more details, see `pyrefly docs <https://pyrefly.org/en/docs/stubgen/>`__.
53+
4354
monkeytype
4455
----------
4556

docs/index.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Development Environments
105105
* `PyCharm <https://www.jetbrains.com/pycharm/>`_, an IDE that supports
106106
type stubs both for type checking and code completion.
107107
* `Visual Studio Code <https://code.visualstudio.com/>`_, a code editor that
108-
supports type checking using mypy, pyright, or the
108+
supports type checking using mypy, pyrefly, pyright, ty, Zuban, or the
109109
`Pylance <https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance>`_
110110
extension.
111111

@@ -130,3 +130,5 @@ Type-Hint and Stub Integration
130130
a thin wrapper around ``ApplyTypeAnnotationsVisitor`` from
131131
`libCST <https://libcst.readthedocs.io/en/latest/>`_ that integrates .pyi
132132
signatures as inline type-hints in Python source code.
133+
* `pyrefly infer <https://pyrefly.org/en/docs/autotype/>`_, a sub-command of Pyrefly which
134+
inserts the types that Pyrefly infers as inline type-hints.

docs/reference/quality.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,3 +221,15 @@ Mypy reports
221221
Mypy offers several options for generating reports on its analysis.
222222
See `the mypy documentation on report generation
223223
<https://mypy.readthedocs.io/en/stable/command_line.html#report-generation>`_ for details.
224+
225+
226+
Pyrefly coverage
227+
----------------
228+
229+
Pyrefly offers a sub-command for measuring and checking type coverage.
230+
231+
- ``pyrefly coverage check`` fails when coverage is below a threshold, useful as a CI gate.
232+
- ``pyrefly coverage report`` emits a JSON report with per-module statistics.
233+
234+
See `the Pyrefly docs on measuring type coverage
235+
<https://pyrefly.org/en/docs/report/>`_ for details.

0 commit comments

Comments
 (0)