Skip to content

Commit 783d649

Browse files
committed
💚 don't require ruff during type-checking
1 parent 741779a commit 783d649

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

‎tool/_ruff.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
import subprocess
22
from pathlib import Path
3+
from typing import TYPE_CHECKING
34

4-
# see https://github.com/astral-sh/ruff/pull/18224
5-
from ruff.__main__ import ( # type: ignore[import-untyped] # pyright: ignore[reportMissingTypeStubs]
6-
find_ruff_bin, # noqa: PLC2701
7-
)
5+
if TYPE_CHECKING:
6+
# ruff should be optional during type-checking
7+
def find_ruff_bin() -> str: ...
8+
9+
else:
10+
# see https://github.com/astral-sh/ruff/pull/18224
11+
from ruff.__main__ import ( # type: ignore[import-untyped]
12+
find_ruff_bin, # noqa: PLC2701
13+
)
814

915

1016
def ruff_format(source: str) -> str:

0 commit comments

Comments
 (0)