Commit 86fa2a0
committed
Make pylint respect libraries installed into VIRTUAL_ENV
Jedi respects VIRTUAL_ENV environment variable at finding out
libraries. Therefore, (virtualenv) runtime for pyls/jedi can be
separated from one for the target workspace.
On the other hand, pylint does not respect VIRTUAL_ENV, and might
cause unintentional "import-error" (E0401) for libraries installed in
such virtualenv, even though jedi can recognize them.
In order to make pylint respect libraries installed into VIRTUAL_ENV,
this commit uses Document.sys_path() instead of sys.path of current
pyls process, at spawning pylint. Document.sys_path() should respect
VIRTUAL_ENV, (original) PYTHONPATH, and so on, because it uses
Environment.get_sys_path() of jedi.
This commit chooses changing pyls instead of pylint, because pylint
uses "astroid" library to find out libraries imported in the target
file, and making astroid respect VIRTUAL_ENV seems very difficult (at
least, not so easy).1 parent 2cc8080 commit 86fa2a0
1 file changed
+11
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
19 | 26 | | |
20 | 27 | | |
21 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
22 | 32 | | |
23 | 33 | | |
24 | 34 | | |
| |||
33 | 43 | | |
34 | 44 | | |
35 | 45 | | |
36 | | - | |
| 46 | + | |
37 | 47 | | |
38 | 48 | | |
39 | 49 | | |
| |||
0 commit comments