Title: Improve configuration for search paths · Issue #6544 · microsoft/vscode-python · GitHub
Open Graph Title: Improve configuration for search paths · Issue #6544 · microsoft/vscode-python
X Title: Improve configuration for search paths · Issue #6544 · microsoft/vscode-python
Description: Parts of this question was already answered several times, so be patient when reading. :) Our usual workspace structure is: rootDir/: - project.vscode-workspace - sources/: - main.py - someSrcFile.py - ... - common/: - commFileOne.py - ....
Open Graph Description: Parts of this question was already answered several times, so be patient when reading. :) Our usual workspace structure is: rootDir/: - project.vscode-workspace - sources/: - main.py - someSrcFile....
X Description: Parts of this question was already answered several times, so be patient when reading. :) Our usual workspace structure is: rootDir/: - project.vscode-workspace - sources/: - main.py - someSrcFile....
Opengraph URL: https://github.com/microsoft/vscode-python/issues/6544
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Improve configuration for search paths ","articleBody":"Parts of this question was already answered several times, so be patient when reading. :)\r\nOur usual workspace structure is:\r\n```\r\nrootDir/:\r\n - project.vscode-workspace\r\n - sources/:\r\n - main.py\r\n - someSrcFile.py\r\n - ...\r\n - common/:\r\n - commFileOne.py\r\n - ...\r\n```\r\nNothing unusual here. \r\nThan, we have another folder with common python modules in remote location - this location is added by modules (inserting to `sys.path`). I will call this location _remoteDir_.\r\n```\r\n\u003csome remote location>\r\nremoteDir/:\r\n - remoteModule.py\r\n - ...\r\n```\r\nWhen running _main.py_ from VS Code, we specify launch configuration with cwd changed to _rootDir/sources_. It runs OK, files from _common_ and _remoteDir_ are accessible (since `sys.path` is manually modified).\r\n\r\nTo implement autocomplete (either Intellisense Python Language Server or JEDI) and Pylint, this directories are not seen by default - _.vscode-workspace_ file is not in _sources_ folder. I am aware of PYTHONPATH variable in _.env_ file - I added _sources_ and _remoteDir_ to PYTHONPATH variable and VS Code autocomplete and pylint works as expected.\r\n\r\n**The problem** is that this PYTHONPATH variable affects the code and is bound to this IDE, which I don't like - one could easily develop code with VS Code (which has specified PYTHONPATH) and forget to handle `sys.path`, not knowing that the code now can't be executed without this IDE and it's _.env_ settings. \r\nExample: A newbie come to our department, take prepared VS Code workspace and create a new module in _common_ folder, which must be executed also in standalone mode. In this module, he wants to use functions from _remoteDir_. Since PYTHONPATH is already set in _.env_, he doesn't know that he actually have to manually handle `sys.path` - autocomplete and pylint just works out of the box. Also, using VS Code, he can run _main.py_ or his new script without problems. But, if he (or someone else) run this script from a command line: `cd ./sources/common; python hisCommonFile.py`, this will fail. Why - because nothing specify PYTHONPATH variable, and he doesn't have `sys.path` handled properly. \r\n\r\n**The question is:** how to properly configure folder paths for autocomplete and pylint in VS Code, that wouldn't have any effect on how code is executed? I don't expect autocomplete and linter would interactively resolve modified `sys.path` - seems like there should be something similar to PYTHONPATH, but would be only applied to autocomplete/pylint VS Code tasks, not launch configurations.\r\n\r\nJust for a clarification: I know this might be a silly example. Our case is a little more complex than described above, but the problem is somewhat simillar - I miss `includeFolders=[]` in both autocomplete and pylint settings section, or better, some common settings. `autocomplete.extraPaths` only solve problems for autocomplete (if it is working, last time I was checking It didn't work properly), not pylint - again, duplicated settings.\r\n\r\n\r\n\r\n","author":{"url":"https://github.com/schperplata","@type":"Person","name":"schperplata"},"datePublished":"2019-07-11T07:52:57Z","url":"https://github.com/microsoft/vscode-python/issues/6544"}
| 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:24b39c29-b141-d497-3c66-121dfce442d1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E78C:37D9F:599CB6:79AB9B:6AFE5F8D |
| html-safe-nonce | f420e9aee99bbed68c1aa497893fd3dd26b15d5f371b4c616b1f8e5c2560dbde |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNzhDOjM3RDlGOjU5OUNCNjo3OUFCOUI6NkFGRTVGOEQiLCJ2aXNpdG9yX2lkIjoiNzYzMDAzMzE3NTc4MzAzODg2MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 736a9ab9ba9edb017192d44b359eebd56328a4df9229ca9104a1857708fa1285 |
| hovercard-subject-tag | issue:466724461 |
| 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/vscode-python/6544/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d0eed144355bff214c115490f94a7dd31718d635b3ed2404d1bee2845d4a1e05/microsoft/vscode-python/issues/6544 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d0eed144355bff214c115490f94a7dd31718d635b3ed2404d1bee2845d4a1e05/microsoft/vscode-python/issues/6544 |
| og:image:alt | Parts of this question was already answered several times, so be patient when reading. :) Our usual workspace structure is: rootDir/: - project.vscode-workspace - sources/: - main.py - someSrcFile.... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | schperplata |
| hostname | github.com |
| expected-hostname | github.com |
| None | b3c0f155eafc27e60db6e254d1ffff0e072e9ab3b4018a5ee518797c19d89f86 |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/vscode-python git https://github.com/microsoft/vscode-python.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 106462765 |
| octolytics-dimension-repository_nwo | microsoft/vscode-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | true |
| octolytics-dimension-repository_parent_id | 49946255 |
| octolytics-dimension-repository_parent_nwo | DonJayamanne/pythonVSCode |
| octolytics-dimension-repository_network_root_id | 49946255 |
| octolytics-dimension-repository_network_root_nwo | DonJayamanne/pythonVSCode |
| 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