Skip to content
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
11 changes: 11 additions & 0 deletions docs/guides/writing_stubs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ stubs serve more as a starting point.

For more details, see `pyright docs <https://github.com/microsoft/pyright/blob/main/docs/type-stubs.md#generating-type-stubs-from-command-line>`__.

pyrefly
-------

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.

.. code-block:: console

pyrefly stubgen path/to/directory/

For more details, see `pyrefly docs <https://pyrefly.org/en/docs/stubgen/>`__.

monkeytype
----------

Expand Down
4 changes: 3 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Development Environments
* `PyCharm <https://www.jetbrains.com/pycharm/>`_, an IDE that supports
type stubs both for type checking and code completion.
* `Visual Studio Code <https://code.visualstudio.com/>`_, a code editor that
supports type checking using mypy, pyright, or the
supports type checking using mypy, pyrefly, pyright, ty, Zuban, or the
`Pylance <https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance>`_
extension.

Expand All @@ -130,3 +130,5 @@ Type-Hint and Stub Integration
a thin wrapper around ``ApplyTypeAnnotationsVisitor`` from
`libCST <https://libcst.readthedocs.io/en/latest/>`_ that integrates .pyi
signatures as inline type-hints in Python source code.
* `pyrefly infer <https://pyrefly.org/en/docs/autotype/>`_, a sub-command of Pyrefly which
inserts the types that Pyrefly infers as inline type-hints.
12 changes: 12 additions & 0 deletions docs/reference/quality.rst
Original file line number Diff line number Diff line change
Expand Up @@ -221,3 +221,15 @@ Mypy reports
Mypy offers several options for generating reports on its analysis.
See `the mypy documentation on report generation
<https://mypy.readthedocs.io/en/stable/command_line.html#report-generation>`_ for details.


Pyrefly coverage
----------------

Pyrefly offers a sub-command for measuring and checking type coverage.

- ``pyrefly coverage check`` fails when coverage is below a threshold, useful as a CI gate.
- ``pyrefly coverage report`` emits a JSON report with per-module statistics.

See `the Pyrefly docs on measuring type coverage
<https://pyrefly.org/en/docs/report/>`_ for details.