A project I am working on is structured with all its packages under a src folder in the project/workspace directory.
I am using a local virtualenv for development (.venv/bin/python), and the package is installed in editable mode, meaning it should be available in sys.path for that Python interpreter.
However, Visual Studio Code fails to resolve any of the imports from these packages, throwing unresolved-import errors and missing autocompletes.
Autocomplete instead suggests importing src.mypackage, instead of simply mypackage.
I have tried various variations of python.autoComplete.extraPaths: ["${workspaceFolder}/src"], ["src"], ["./src"], restarting the language server after each change, but none appear to work.
I have attempted with the beta `downloadChannel as well, to no avail.
The Output tab prints the following:
Starting Microsoft Python language server.
[...]
[Info - 1:45:13 PM] Python search paths:
[...]
[Info - 1:45:13 PM] /Users/rye/Documents/my-project/.venv/lib/python3.7/site-packages
[Info - 1:45:13 PM] /Users/rye/Documents/my-project/src
[Info - 1:45:13 PM] Configuration search paths:
[Info - 1:45:13 PM] /Users/rye/Documents/my-project/src
[Info - 1:45:13 PM] Microsoft Python Language Server version 0.2.62.0
This seems to suggest that the language server has detected the folder both in the Python installation's sys.path, as well as the configured python.autoComplete.extraPaths
How do I get the language server to resolve my imports properly?
A project I am working on is structured with all its packages under a
srcfolder in the project/workspace directory.I am using a local virtualenv for development (
.venv/bin/python), and the package is installed in editable mode, meaning it should be available insys.pathfor that Python interpreter.However, Visual Studio Code fails to resolve any of the imports from these packages, throwing
unresolved-importerrors and missing autocompletes.Autocomplete instead suggests importing
src.mypackage, instead of simplymypackage.I have tried various variations of
python.autoComplete.extraPaths:["${workspaceFolder}/src"],["src"],["./src"], restarting the language server after each change, but none appear to work.I have attempted with the beta `downloadChannel as well, to no avail.
The Output tab prints the following:
This seems to suggest that the language server has detected the folder both in the Python installation's
sys.path, as well as the configuredpython.autoComplete.extraPathsHow do I get the language server to resolve my imports properly?