Open benblank opened 1 month ago
interesting. i dont think pyright supports partially extending stubs like this, but yeah definitely shouldn't be reporting errors with non-existent file paths
To be fair, I'm not sure anything supports partial stubs like this; I just forgot the step where I should have uninstalled the site-packages
types before writing my own. 😅
I wouldn't have created the issue at all, but reporting errors in files which actually don't exist seemed confusing enough that it probably shouldn't happen even when I'm doing something silly like this.
I wanted to extend the TypeShed types for the
defusedxml
package, as they seem to be incomplete. However, types for the same package being present in bothsite-packages
andstubPath
seems to confuse basedpyright such that any errors present in thesite-packages
type stubs are reported as though the files were located understubPath
, even when no such files exist.Steps to reproduce
python -m venv .venv
. .venv/bin/activate
pip install basedpyright types-defusedxml
mkdir typings/defusedxml
touch typings/defusedxml/__init__.py
basedpyright
Renaming
typings/defusedxml
totypings/defusedxml-foo
prevents the errors, as does renamingtypings
or changing thestubPath
setting. Changing theinclude
setting to omittypings
works, but omitting.venv
doesn't. Similarly, changingexclude
to containtypings
works, but including.venv
doesn't.I didn't see a way to use PyPI packages with https://basedpyright.com or https://pyright-play.net, so I don't have a playground example of the problem.
Terminal output