@@ -25,7 +25,12 @@ class Project:
25
25
name_override : str | None = None
26
26
27
27
mypy_cmd : str
28
- pyright_cmd : str | None
28
+
29
+ # Whether or not to run pyright on this project
30
+ disable_pyright : bool = False
31
+
32
+ # A list of explicit paths that are passed to the type checker (currently only used for pyright)
33
+ paths : list [str ] | None = None
29
34
30
35
install_cmd : str | None = None
31
36
deps : list [str ] | None = None
@@ -52,8 +57,8 @@ def __repr__(self) -> str:
52
57
result = f"Project(location={ self .location !r} , mypy_cmd={ self .mypy_cmd !r} "
53
58
if self .name_override :
54
59
result += f", name_override={ self .name_override !r} "
55
- if self .pyright_cmd :
56
- result += f", pyright_cmd ={ self .pyright_cmd !r} "
60
+ if self .paths :
61
+ result += f", paths ={ self .paths !r} "
57
62
if self .install_cmd :
58
63
result += f", install_cmd={ self .install_cmd !r} "
59
64
if self .deps :
@@ -245,8 +250,9 @@ async def run_mypy(
245
250
)
246
251
247
252
def get_pyright_cmd (self , pyright : Path , additional_flags : Sequence [str ] = ()) -> str :
248
- pyright_cmd = self .pyright_cmd or "{pyright}"
249
- assert "{pyright}" in pyright_cmd
253
+ paths = self .paths or []
254
+ pyright_cmd = "{pyright} " + " " .join (paths )
255
+
250
256
if additional_flags :
251
257
pyright_cmd += " " + " " .join (additional_flags )
252
258
pyright_cmd = pyright_cmd .format (pyright = pyright )
@@ -337,7 +343,7 @@ def from_location(cls, location: str) -> Project:
337
343
if header .startswith ("# flags:" ):
338
344
additional_flags = header [len ("# flags:" ) :]
339
345
return Project (
340
- location = location , mypy_cmd = f"{{mypy}} { location } { additional_flags } " , pyright_cmd = None
346
+ location = location , mypy_cmd = f"{{mypy}} { location } { additional_flags } " , paths = None
341
347
)
342
348
343
349
0 commit comments