Title: Unresolved import with packages under "src" when installed as editable · Issue #1013 · microsoft/python-language-server · GitHub
Open Graph Title: Unresolved import with packages under "src" when installed as editable · Issue #1013 · microsoft/python-language-server
X Title: Unresolved import with packages under "src" when installed as editable · Issue #1013 · microsoft/python-language-server
Description: 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...
Open Graph Description: 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 packag...
X Description: 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 packag...
Opengraph URL: https://github.com/microsoft/python-language-server/issues/1013
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Unresolved import with packages under \"src\" when installed as editable","articleBody":"A project I am working on is structured with all its packages under a `src` folder in the project/workspace directory.\r\n\r\nI 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.\r\n\r\nHowever, Visual Studio Code fails to resolve any of the imports from these packages, throwing `unresolved-import` errors and missing autocompletes.\r\n\r\nAutocomplete instead suggests importing `src.mypackage`, instead of simply `mypackage`.\r\n\r\nI have tried various variations of `python.autoComplete.extraPaths`: `[\"${workspaceFolder}/src\"]`, `[\"src\"]`, `[\"./src\"]`, restarting the language server after each change, but none appear to work.\r\n\r\nI have attempted with the beta `downloadChannel as well, to no avail.\r\n\r\nThe Output tab prints the following:\r\n\r\n```\r\nStarting Microsoft Python language server.\r\n[...]\r\n[Info - 1:45:13 PM] Python search paths:\r\n[...]\r\n[Info - 1:45:13 PM] /Users/rye/Documents/my-project/.venv/lib/python3.7/site-packages\r\n[Info - 1:45:13 PM] /Users/rye/Documents/my-project/src\r\n[Info - 1:45:13 PM] Configuration search paths:\r\n[Info - 1:45:13 PM] /Users/rye/Documents/my-project/src\r\n[Info - 1:45:13 PM] Microsoft Python Language Server version 0.2.62.0\r\n```\r\n\r\nThis 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`\r\n\r\nHow do I get the language server to resolve my imports properly?","author":{"url":"https://github.com/eirikrye","@type":"Person","name":"eirikrye"},"datePublished":"2019-04-25T11:52:50Z","url":"https://github.com/microsoft/python-language-server/issues/1013"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:91d64d58-4144-0d1d-fc68-d1c58287274a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AD4C:329923:72BC19:9B1078:6AFE6865 |
| html-safe-nonce | 62ae3b9e2c61ed458cbcb018e61b11143ac413f27a6e47165a7687e04fa02644 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRDRDOjMyOTkyMzo3MkJDMTk6OUIxMDc4OjZBRkU2ODY1IiwidmlzaXRvcl9pZCI6IjI0OTE3ODM2MTcxMTAyMzkzMzMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 64e36daa946a7de549913a31d30f636f558366b3bf1a8791ca0c747863938738 |
| hovercard-subject-tag | issue:437158190 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/python-language-server/1013/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f8f1c96dfb17524d4a2d5d18977eabbcc1cb11ffdc8678313e914461dca73441/microsoft/python-language-server/issues/1013 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f8f1c96dfb17524d4a2d5d18977eabbcc1cb11ffdc8678313e914461dca73441/microsoft/python-language-server/issues/1013 |
| og:image:alt | 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 packag... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | eirikrye |
| hostname | github.com |
| expected-hostname | github.com |
| None | b3c0f155eafc27e60db6e254d1ffff0e072e9ab3b4018a5ee518797c19d89f86 |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/python-language-server git https://github.com/microsoft/python-language-server.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 145901977 |
| octolytics-dimension-repository_nwo | microsoft/python-language-server |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 145901977 |
| octolytics-dimension-repository_network_root_nwo | microsoft/python-language-server |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4a10310af51a1bfffbedc4fd81cb582acf0cb0ff |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width