You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NOTE: This has only been tested with pyright as the type checker and a virtual environment created by poetry. It could be isolated to this combination of tools or it may affect other.
When type checking my project with pygls installed, pyright is unable to import dependencies. Example from running npx pyright --venv-path ./ --verbose
Could not import 'pydantic' in file '/path/to/project/project/utils/__init__.py'
Looking in stubPath '/path/to/project/typings'
Attempting to resolve stub package using root path '/path/to/project/typings'
Attempting to resolve using root path '/path/to/project/typings'
Looking in root directory of execution environment '/path/to/project'
Attempting to resolve stub package using root path '/path/to/project'
Attempting to resolve using root path '/path/to/project'
Looking in python search path '/path/to/project/.venv/lib/site-packages'
Attempting to resolve stub package using root path '/path/to/project/.venv/lib/site-packages'
Attempting to resolve using root path '/path/to/project/.venv/lib/site-packages'
Looking for typeshed stdlib path
Looking for typeshed stdlib path
Attempting to resolve using root path '/path/to/project/node_modules/pyright/dist/typeshed-fallback/stdlib'
Typeshed path not found
Looking for typeshed third-party path
Looking for typeshed stubs path
Typeshed path not found
Notable in this output is the search path .venv/lib/site-packages which only contains data files for pygls. The correct path for dependencies within this virtual environment is .venv/lib/python3.10/site-packages.
I believe the existence of .venv/lib/site-packages causes the correct path to not be used. Removal of pygls as a dependency resolves this issue as .venv/lib/site-packages is no longer created.
Here is the section of code causing .venv/lib/site-packages to be created:
## [1.0.2] - May 15th, 2023
### Changed
- Update typeguard to 3.x ([#327])
### Fixed
- Data files are no longer placed inside the wrong `site-packages` folder when installing `pygls` ([#232])
[#232]: openlawlibrary/pygls#232
When type checking my project with
pygls
installed,pyright
is unable to import dependencies. Example from runningnpx pyright --venv-path ./ --verbose
Notable in this output is the search path
.venv/lib/site-packages
which only contains data files forpygls
. The correct path for dependencies within this virtual environment is.venv/lib/python3.10/site-packages
.I believe the existence of
.venv/lib/site-packages
causes the correct path to not be used. Removal ofpygls
as a dependency resolves this issue as.venv/lib/site-packages
is no longer created.Here is the section of code causing
.venv/lib/site-packages
to be created:pygls/setup.cfg
Lines 53 to 56 in 75c9b15
I am using the following packages/tools:
poetry==1.1.13
used to manage dependencies and create a virtual environmentpygls==0.11.3
(installed as a dependency ofesbonio==0.11.2
)[email protected]
The text was updated successfully, but these errors were encountered: