From c8d72dbf9d66f2ede1d542aba483e2013720c549 Mon Sep 17 00:00:00 2001 From: Danny Yang Date: Fri, 7 Aug 2026 22:50:12 -0400 Subject: [PATCH 1/4] Add pyrefly stubgen to stubs guide --- docs/guides/writing_stubs.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/guides/writing_stubs.rst b/docs/guides/writing_stubs.rst index 9f46a94d7..3039e8160 100644 --- a/docs/guides/writing_stubs.rst +++ b/docs/guides/writing_stubs.rst @@ -40,6 +40,17 @@ stubs serve more as a starting point. For more details, see `pyright docs `__. +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 `__. + monkeytype ---------- From ff3337ab7835a555fd6b2631faf01cade98ca031 Mon Sep 17 00:00:00 2001 From: Danny Yang Date: Fri, 7 Aug 2026 22:54:28 -0400 Subject: [PATCH 2/4] Add pyrefly infer to docs --- docs/index.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index 35857a09c..93f773ac5 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -105,7 +105,7 @@ Development Environments * `PyCharm `_, an IDE that supports type stubs both for type checking and code completion. * `Visual Studio Code `_, a code editor that - supports type checking using mypy, pyright, or the + supports type checking using mypy, pyrefly, pyright, ty, Zuban, or the `Pylance `_ extension. @@ -130,3 +130,5 @@ Type-Hint and Stub Integration a thin wrapper around ``ApplyTypeAnnotationsVisitor`` from `libCST `_ that integrates .pyi signatures as inline type-hints in Python source code. +* `pyrefly infer `_, a sub-command of Pyrefly which + inserts the types that Pyrefly infers as inline type-hints. From 358924a98867b7eb84fcf410449e40e31468dbf9 Mon Sep 17 00:00:00 2001 From: Danny Yang Date: Fri, 7 Aug 2026 22:58:03 -0400 Subject: [PATCH 3/4] Add pyrefly coverage to annotation quality docs --- docs/reference/quality.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/reference/quality.rst b/docs/reference/quality.rst index c8fed8332..5d6c8df31 100644 --- a/docs/reference/quality.rst +++ b/docs/reference/quality.rst @@ -221,3 +221,13 @@ Mypy reports Mypy offers several options for generating reports on its analysis. See `the mypy documentation on 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 +`_ for details. From f5ee873a76c3fab27c84c126795bb8183afb1366 Mon Sep 17 00:00:00 2001 From: Danny Yang Date: Fri, 7 Aug 2026 22:58:21 -0400 Subject: [PATCH 4/4] spacing --- docs/reference/quality.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/reference/quality.rst b/docs/reference/quality.rst index 5d6c8df31..19918fcb4 100644 --- a/docs/reference/quality.rst +++ b/docs/reference/quality.rst @@ -227,7 +227,9 @@ 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 `_ for details.