pyright icon indicating copy to clipboard operation
pyright copied to clipboard

Adding exclude to [tool.pyright] makes pyright run forever

Open Felix-Blom-SV opened this issue 1 year ago • 2 comments

Describe the bug I added exclude and it runs forever without doing anyting. Removed it and it works just fine yet. Even if it might not be correct syntax, the forever running shouldn't be intended.

[tool.pyright]
venvPath = "."
venv = ".venv"
typeCheckingMode = "basic"
useLibraryCodeForTypes = true
stubPath = "."
exclude = ["myfile"]

Felix-Blom-SV avatar Jul 10 '25 09:07 Felix-Blom-SV

possibly because .venv is not excluded. it is excluded by '**/.*' pattern in defaultExcludes by default, but defaultExcludes is not used when exclude option is manually specified.

https://github.com/microsoft/pyright/blob/8b02aa84ec916697e76d5ee69299a89d555ec98c/packages/pyright-internal/src/analyzer/service.ts#L800-L815

pinterior avatar Jul 10 '25 12:07 pinterior

Yes, if you provide no "exclude", pyright will auto-exclude several directories including local virtual environments. If you provide an "exclude", pyright no longer auto-excludes directories. It assumes you are taking control over the specific directories you want to exclude. Refer to the documentation for exclude for more details.

erictraut avatar Jul 10 '25 14:07 erictraut