From 24e24b18f90396e9a38504a0adc3be50f9217d90 Mon Sep 17 00:00:00 2001 From: Nicholas Gates Date: Tue, 24 Apr 2018 10:45:48 +0100 Subject: [PATCH 1/4] Upgrade Jedi to 0.12.0 --- pyls/workspace.py | 13 ++----------- setup.py | 2 +- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/pyls/workspace.py b/pyls/workspace.py index 3cce8575..e46ccc18 100644 --- a/pyls/workspace.py +++ b/pyls/workspace.py @@ -265,14 +265,5 @@ def jedi_script(self, position=None): return jedi.Script(**kwargs) def sys_path(self): - # Copy our extra sys path - path = list(self._extra_sys_path) - - # Check to see if we're in a virtualenv - if 'VIRTUAL_ENV' in os.environ: - log.info("Using virtualenv %s", os.environ['VIRTUAL_ENV']) - path.extend(jedi.evaluate.sys_path.get_venv_path(os.environ['VIRTUAL_ENV'])) - else: - path.extend(sys.path) - - return path + environment = jedi.api.environment.get_default_environment() + return environment.get_sys_path() diff --git a/setup.py b/setup.py index ad994a5e..111a7045 100755 --- a/setup.py +++ b/setup.py @@ -35,7 +35,7 @@ 'configparser; python_version<"3.0"', 'future>=0.14.0', 'futures; python_version<"3.2"', - 'jedi>=0.10,<0.12', + 'jedi>=0.12', 'pluggy' ], From 5f37910bae9d1cbe3e1aaab8cb60d7fd514ae774 Mon Sep 17 00:00:00 2001 From: Nicholas Gates Date: Tue, 24 Apr 2018 10:49:06 +0100 Subject: [PATCH 2/4] Upgrade Jedi to 0.12.0 --- pyls/workspace.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pyls/workspace.py b/pyls/workspace.py index e46ccc18..e8f083ca 100644 --- a/pyls/workspace.py +++ b/pyls/workspace.py @@ -265,5 +265,11 @@ def jedi_script(self, position=None): return jedi.Script(**kwargs) def sys_path(self): + # Copy our extra sys path + path = list(self._extra_sys_path) + + # TODO(gatesn): #339 - make better use of jedi environments, they seem pretty powerful environment = jedi.api.environment.get_default_environment() - return environment.get_sys_path() + path.extend(environment.get_sys_path()) + + return path From 474e8a45ab8eb30436102de18a8dd20c50e585d2 Mon Sep 17 00:00:00 2001 From: Nicholas Gates Date: Tue, 24 Apr 2018 15:55:55 +0100 Subject: [PATCH 3/4] Remove sys path test, behaviour is different now --- test/test_document.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/test/test_document.py b/test/test_document.py index 34905415..11408349 100644 --- a/test/test_document.py +++ b/test/test_document.py @@ -42,14 +42,6 @@ def test_word_at_position(doc): assert doc.word_at_position({'line': 4, 'character': 0}) == '' -def test_document_sys_path(doc): - """Test the document's sys path is updated.""" - assert 'foo' not in doc.sys_path() - sys.path.append('foo') - # Check that the new sys path is included in the doc's sys path - assert 'foo' in doc.sys_path() - - def test_document_empty_edit(): doc = Document('file:///uri', u'') doc.apply_change({ From f0461d34aa1aea0e2b0666319ec70934326dada6 Mon Sep 17 00:00:00 2001 From: Nicholas Gates Date: Tue, 24 Apr 2018 16:01:25 +0100 Subject: [PATCH 4/4] Remove sys path test, behaviour is different now --- pyls/workspace.py | 1 - test/test_document.py | 1 - 2 files changed, 2 deletions(-) diff --git a/pyls/workspace.py b/pyls/workspace.py index e8f083ca..edb9528f 100644 --- a/pyls/workspace.py +++ b/pyls/workspace.py @@ -3,7 +3,6 @@ import logging import os import re -import sys import imp import pkgutil diff --git a/test/test_document.py b/test/test_document.py index 11408349..4fd4ea2f 100644 --- a/test/test_document.py +++ b/test/test_document.py @@ -1,5 +1,4 @@ # Copyright 2017 Palantir Technologies, Inc. -import sys from test.fixtures import DOC_URI, DOC from pyls.workspace import Document