diff --git a/.github/actions/build-vsix/action.yml b/.github/actions/build-vsix/action.yml index 27d57cfca9de..b51d43f59675 100644 --- a/.github/actions/build-vsix/action.yml +++ b/.github/actions/build-vsix/action.yml @@ -54,6 +54,11 @@ runs: python ./pythonFiles/install_debugpy.py shell: bash + - name: Install Jedi LSP + run: | + python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/jedilsp --no-cache-dir --implementation py --platform any --abi none --no-deps --only-binary :all: --upgrade -r jedils_requirements.txt + shell: bash + - name: Run npm ci run: npm ci --prefer-offline shell: bash diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 13bda617f8c6..090acea9e168 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -117,7 +117,9 @@ jobs: python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy - name: Install Python 3 requirements - run: python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r requirements.txt + run: | + python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r requirements.txt + python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/jedilsp --no-cache-dir --implementation py --no-deps --upgrade -r ./jedils_requirements.txt if: startsWith(matrix.python, 3.) - name: Install test requirements diff --git a/.github/workflows/nightly-coverage.yml b/.github/workflows/nightly-coverage.yml index 5844582e8143..e64cdff6abeb 100644 --- a/.github/workflows/nightly-coverage.yml +++ b/.github/workflows/nightly-coverage.yml @@ -52,6 +52,7 @@ jobs: python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r requirements.txt --no-user # We need to have debugpy so that tests relying on it keep passing, but we don't need install_debugpy's logic in the test phase. python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy + python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/jedilsp --no-cache-dir --implementation py --no-deps --upgrade -r ./jedils_requirements.txt - name: Install test requirements run: python -m pip install --upgrade -r build/test-requirements.txt diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index fffa21721c9a..fb4fb0aa07a6 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -97,7 +97,9 @@ jobs: python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy - name: Install Python 3 requirements - run: python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r requirements.txt --no-user + run: | + python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r requirements.txt --no-user + python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/jedilsp --no-cache-dir --implementation py --no-deps --upgrade -r ./jedils_requirements.txt if: startsWith(matrix.python, 3.) - name: Install test requirements @@ -385,6 +387,7 @@ jobs: python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r requirements.txt --no-user # We need to have debugpy so that tests relying on it keep passing, but we don't need install_debugpy's logic in the test phase. python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy + python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/jedilsp --no-cache-dir --implementation py --no-deps --upgrade -r ./jedils_requirements.txt - name: Install test requirements run: python -m pip install --upgrade -r build/test-requirements.txt diff --git a/gulpfile.js b/gulpfile.js index f6a282d82b7e..e5b91a15b546 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -223,7 +223,7 @@ gulp.task('checkDependencies', gulp.series('checkNativeDependencies')); gulp.task('prePublishNonBundle', gulp.series('compile')); gulp.task('installPythonRequirements', async () => { - const args = [ + let args = [ '-m', 'pip', '--disable-pip-version-check', @@ -239,7 +239,37 @@ gulp.task('installPythonRequirements', async () => { '-r', './requirements.txt', ]; - const success = await spawnAsync(process.env.CI_PYTHON_PATH || 'python3', args, undefined, true) + let success = await spawnAsync(process.env.CI_PYTHON_PATH || 'python3', args, undefined, true) + .then(() => true) + .catch((ex) => { + console.error("Failed to install Python Libs using 'python3'", ex); + return false; + }); + if (!success) { + console.info("Failed to install Python Libs using 'python3', attempting to install using 'python'"); + await spawnAsync('python', args).catch((ex) => + console.error("Failed to install Python Libs using 'python'", ex), + ); + return; + } + + args = [ + '-m', + 'pip', + '--disable-pip-version-check', + 'install', + '--no-user', + '-t', + './pythonFiles/lib/jedilsp', + '--no-cache-dir', + '--implementation', + 'py', + '--no-deps', + '--upgrade', + '-r', + './jedils_requirements.txt', + ]; + success = await spawnAsync(process.env.CI_PYTHON_PATH || 'python3', args, undefined, true) .then(() => true) .catch((ex) => { console.error("Failed to install Python Libs using 'python3'", ex); diff --git a/jedils_requirements.in b/jedils_requirements.in new file mode 100644 index 000000000000..e9e0b856d052 --- /dev/null +++ b/jedils_requirements.in @@ -0,0 +1,14 @@ +# This file is used to generate requirements.txt. +# To update requirements.txt, run the following commands. +# Use Python 3.6 when creating the environment or using pip-tools +# 1) pip install pip-tools +# 2) pip-compile --generate-hashes jedils_requirements.in + +# We don't need to add Python version restrictions +# since we don't support anything older than 3.6 anymore, +# However, make sure to use Python 3.6 when running pip-compile, +# so that all Python 3.6-specific requirements are captured when generating requirements.txt. + +jedi-language-server>=0.34.3 +pygls>=0.10.3 +dataclasses==0.8;python_version<="3.6" diff --git a/jedils_requirements.txt b/jedils_requirements.txt new file mode 100644 index 000000000000..a10ac094b481 --- /dev/null +++ b/jedils_requirements.txt @@ -0,0 +1,79 @@ +# +# This file is autogenerated by pip-compile with python 3.6 +# To update, run: +# +# pip-compile --generate-hashes jedils_requirements.in +# +dataclasses==0.8 ; python_version <= "3.6" \ + --hash=sha256:0201d89fa866f68c8ebd9d08ee6ff50c0b255f8ec63a71c16fda7af82bb887bf \ + --hash=sha256:8479067f342acf957dc82ec415d355ab5edb7e7646b90dc6e2fd1d96ad084c97 + # via + # -r jedils_requirements.in + # pydantic +docstring-to-markdown==0.9 \ + --hash=sha256:0b810e6e16737d2d0ede6182f66f513f814a11fad1222e645fbc14acde78e171 \ + --hash=sha256:488b9f26339651edc7fc9386caeffd3924569072a8b67b727e253f83d5b18c59 + # via jedi-language-server +importlib-metadata==3.10.1 \ + --hash=sha256:2ec0faae539743ae6aaa84b49a169670a465f7f5d64e6add98388cc29fd1f2f6 \ + --hash=sha256:c9356b657de65c53744046fa8f7358afe0714a1af7d570c00c3835c2d724a7c1 + # via jedi-language-server +jedi==0.18.0 \ + --hash=sha256:18456d83f65f400ab0c2d3319e48520420ef43b23a086fdc05dff34132f0fb93 \ + --hash=sha256:92550a404bad8afed881a137ec9a461fed49eca661414be45059329614ed0707 + # via jedi-language-server +jedi-language-server==0.34.3 \ + --hash=sha256:103296591fdfe8a8dc6277f54d31ef4ddf41cee81e7af2cc04b2b1f66349cf6a \ + --hash=sha256:8356a208b877ba48bdbe7df8373716702446b47e39b925b0e10deed4d52bcb01 + # via -r jedils_requirements.in +parso==0.8.2 \ + --hash=sha256:12b83492c6239ce32ff5eed6d3639d6a536170723c6f3f1506869f1ace413398 \ + --hash=sha256:a8c4922db71e4fdb90e0d0bc6e50f9b273d3397925e5e60a717e719201778d22 + # via jedi +pydantic==1.8.2 \ + --hash=sha256:021ea0e4133e8c824775a0cfe098677acf6fa5a3cbf9206a376eed3fc09302cd \ + --hash=sha256:05ddfd37c1720c392f4e0d43c484217b7521558302e7069ce8d318438d297739 \ + --hash=sha256:05ef5246a7ffd2ce12a619cbb29f3307b7c4509307b1b49f456657b43529dc6f \ + --hash=sha256:10e5622224245941efc193ad1d159887872776df7a8fd592ed746aa25d071840 \ + --hash=sha256:18b5ea242dd3e62dbf89b2b0ec9ba6c7b5abaf6af85b95a97b00279f65845a23 \ + --hash=sha256:234a6c19f1c14e25e362cb05c68afb7f183eb931dd3cd4605eafff055ebbf287 \ + --hash=sha256:244ad78eeb388a43b0c927e74d3af78008e944074b7d0f4f696ddd5b2af43c62 \ + --hash=sha256:26464e57ccaafe72b7ad156fdaa4e9b9ef051f69e175dbbb463283000c05ab7b \ + --hash=sha256:41b542c0b3c42dc17da70554bc6f38cbc30d7066d2c2815a94499b5684582ecb \ + --hash=sha256:4a03cbbe743e9c7247ceae6f0d8898f7a64bb65800a45cbdc52d65e370570820 \ + --hash=sha256:4be75bebf676a5f0f87937c6ddb061fa39cbea067240d98e298508c1bda6f3f3 \ + --hash=sha256:54cd5121383f4a461ff7644c7ca20c0419d58052db70d8791eacbbe31528916b \ + --hash=sha256:589eb6cd6361e8ac341db97602eb7f354551482368a37f4fd086c0733548308e \ + --hash=sha256:8621559dcf5afacf0069ed194278f35c255dc1a1385c28b32dd6c110fd6531b3 \ + --hash=sha256:8b223557f9510cf0bfd8b01316bf6dd281cf41826607eada99662f5e4963f316 \ + --hash=sha256:99a9fc39470010c45c161a1dc584997f1feb13f689ecf645f59bb4ba623e586b \ + --hash=sha256:a7c6002203fe2c5a1b5cbb141bb85060cbff88c2d78eccbc72d97eb7022c43e4 \ + --hash=sha256:a83db7205f60c6a86f2c44a61791d993dff4b73135df1973ecd9eed5ea0bda20 \ + --hash=sha256:ac8eed4ca3bd3aadc58a13c2aa93cd8a884bcf21cb019f8cfecaae3b6ce3746e \ + --hash=sha256:e710876437bc07bd414ff453ac8ec63d219e7690128d925c6e82889d674bb505 \ + --hash=sha256:ea5cb40a3b23b3265f6325727ddfc45141b08ed665458be8c6285e7b85bd73a1 \ + --hash=sha256:fec866a0b59f372b7e776f2d7308511784dace622e0992a0b59ea3ccee0ae833 + # via + # jedi-language-server + # pygls +pygls==0.11.2 \ + --hash=sha256:1ade26fc9cf0d7c0700fa5430e8dc8411b1108d1eb21565adbe480b64f721a84 \ + --hash=sha256:5c5b1c8717a39b97462b197f6186c12d2e16455da00631cdaaca91d25736ffcd + # via + # -r jedils_requirements.in + # jedi-language-server +typeguard==2.12.1 \ + --hash=sha256:c2af8b9bdd7657f4bd27b45336e7930171aead796711bc4cfc99b4731bb9d051 \ + --hash=sha256:cc15ef2704c9909ef9c80e19c62fb8468c01f75aad12f651922acf4dbe822e02 + # via pygls +typing-extensions==3.10.0.0 \ + --hash=sha256:0ac0f89795dd19de6b97debb0c6af1c70987fd80a2d62d1958f7e56fcc31b497 \ + --hash=sha256:50b6f157849174217d0656f99dc82fe932884fb250826c18350e159ec6cdf342 \ + --hash=sha256:779383f6086d90c99ae41cf0ff39aac8a7937a9283ce0a414e5dd782f4c94a84 + # via + # importlib-metadata + # pydantic +zipp==3.5.0 \ + --hash=sha256:957cfda87797e389580cb8b9e3870841ca991e2125350677b2ca83a0e99390a3 \ + --hash=sha256:f5812b1e007e48cff63449a5e9f4e7ebea716b4111f9c4f9a645f91d579bf0c4 + # via importlib-metadata diff --git a/pythonFiles/run-jedi-language-server.py b/pythonFiles/run-jedi-language-server.py index cf1aaace196c..31095121409f 100644 --- a/pythonFiles/run-jedi-language-server.py +++ b/pythonFiles/run-jedi-language-server.py @@ -3,7 +3,7 @@ # Add the lib path to our sys path so jedi_language_server can find its references EXTENSION_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) -sys.path.insert(0, os.path.join(EXTENSION_ROOT, "pythonFiles", "lib", "python")) +sys.path.insert(0, os.path.join(EXTENSION_ROOT, "pythonFiles", "lib", "jedilsp")) from jedi_language_server.cli import cli diff --git a/requirements.in b/requirements.in index 57b5051b7ffb..685f9efaeff3 100644 --- a/requirements.in +++ b/requirements.in @@ -3,15 +3,5 @@ # 1) pip install pip-tools # 2) pip-compile --generate-hashes requirements.in -# We don't need to add Python version restrictions -# since we don't support anything older than 3.6 anymore, -# However, make sure to use Python 3.6 when running pip-compile, -# so that all Python 3.6-specific requirements are captured when generating requirements.txt. - # Sort Imports isort==5.9.3 - -# Jedi behind LSP -jedi-language-server>=0.34.3 -pygls>=0.10.3 -dataclasses==0.8;python_version<="3.6" diff --git a/requirements.txt b/requirements.txt index 6154c717891d..c1b0d066b57a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,80 +4,7 @@ # # pip-compile --generate-hashes requirements.in # -dataclasses==0.8 ; python_version <= "3.6" \ - --hash=sha256:0201d89fa866f68c8ebd9d08ee6ff50c0b255f8ec63a71c16fda7af82bb887bf \ - --hash=sha256:8479067f342acf957dc82ec415d355ab5edb7e7646b90dc6e2fd1d96ad084c97 - # via - # -r requirements.in - # pydantic -docstring-to-markdown==0.9 \ - --hash=sha256:0b810e6e16737d2d0ede6182f66f513f814a11fad1222e645fbc14acde78e171 \ - --hash=sha256:488b9f26339651edc7fc9386caeffd3924569072a8b67b727e253f83d5b18c59 - # via jedi-language-server -importlib-metadata==3.10.1 \ - --hash=sha256:2ec0faae539743ae6aaa84b49a169670a465f7f5d64e6add98388cc29fd1f2f6 \ - --hash=sha256:c9356b657de65c53744046fa8f7358afe0714a1af7d570c00c3835c2d724a7c1 - # via jedi-language-server isort==5.9.3 \ --hash=sha256:9c2ea1e62d871267b78307fe511c0838ba0da28698c5732d54e2790bf3ba9899 \ --hash=sha256:e17d6e2b81095c9db0a03a8025a957f334d6ea30b26f9ec70805411e5c7c81f2 # via -r requirements.in -jedi==0.18.0 \ - --hash=sha256:18456d83f65f400ab0c2d3319e48520420ef43b23a086fdc05dff34132f0fb93 \ - --hash=sha256:92550a404bad8afed881a137ec9a461fed49eca661414be45059329614ed0707 - # via jedi-language-server -jedi-language-server==0.34.3 \ - --hash=sha256:103296591fdfe8a8dc6277f54d31ef4ddf41cee81e7af2cc04b2b1f66349cf6a \ - --hash=sha256:8356a208b877ba48bdbe7df8373716702446b47e39b925b0e10deed4d52bcb01 - # via -r requirements.in -parso==0.8.2 \ - --hash=sha256:12b83492c6239ce32ff5eed6d3639d6a536170723c6f3f1506869f1ace413398 \ - --hash=sha256:a8c4922db71e4fdb90e0d0bc6e50f9b273d3397925e5e60a717e719201778d22 - # via jedi -pydantic==1.8.2 \ - --hash=sha256:021ea0e4133e8c824775a0cfe098677acf6fa5a3cbf9206a376eed3fc09302cd \ - --hash=sha256:05ddfd37c1720c392f4e0d43c484217b7521558302e7069ce8d318438d297739 \ - --hash=sha256:05ef5246a7ffd2ce12a619cbb29f3307b7c4509307b1b49f456657b43529dc6f \ - --hash=sha256:10e5622224245941efc193ad1d159887872776df7a8fd592ed746aa25d071840 \ - --hash=sha256:18b5ea242dd3e62dbf89b2b0ec9ba6c7b5abaf6af85b95a97b00279f65845a23 \ - --hash=sha256:234a6c19f1c14e25e362cb05c68afb7f183eb931dd3cd4605eafff055ebbf287 \ - --hash=sha256:244ad78eeb388a43b0c927e74d3af78008e944074b7d0f4f696ddd5b2af43c62 \ - --hash=sha256:26464e57ccaafe72b7ad156fdaa4e9b9ef051f69e175dbbb463283000c05ab7b \ - --hash=sha256:41b542c0b3c42dc17da70554bc6f38cbc30d7066d2c2815a94499b5684582ecb \ - --hash=sha256:4a03cbbe743e9c7247ceae6f0d8898f7a64bb65800a45cbdc52d65e370570820 \ - --hash=sha256:4be75bebf676a5f0f87937c6ddb061fa39cbea067240d98e298508c1bda6f3f3 \ - --hash=sha256:54cd5121383f4a461ff7644c7ca20c0419d58052db70d8791eacbbe31528916b \ - --hash=sha256:589eb6cd6361e8ac341db97602eb7f354551482368a37f4fd086c0733548308e \ - --hash=sha256:8621559dcf5afacf0069ed194278f35c255dc1a1385c28b32dd6c110fd6531b3 \ - --hash=sha256:8b223557f9510cf0bfd8b01316bf6dd281cf41826607eada99662f5e4963f316 \ - --hash=sha256:99a9fc39470010c45c161a1dc584997f1feb13f689ecf645f59bb4ba623e586b \ - --hash=sha256:a7c6002203fe2c5a1b5cbb141bb85060cbff88c2d78eccbc72d97eb7022c43e4 \ - --hash=sha256:a83db7205f60c6a86f2c44a61791d993dff4b73135df1973ecd9eed5ea0bda20 \ - --hash=sha256:ac8eed4ca3bd3aadc58a13c2aa93cd8a884bcf21cb019f8cfecaae3b6ce3746e \ - --hash=sha256:e710876437bc07bd414ff453ac8ec63d219e7690128d925c6e82889d674bb505 \ - --hash=sha256:ea5cb40a3b23b3265f6325727ddfc45141b08ed665458be8c6285e7b85bd73a1 \ - --hash=sha256:fec866a0b59f372b7e776f2d7308511784dace622e0992a0b59ea3ccee0ae833 - # via - # jedi-language-server - # pygls -pygls==0.11.2 \ - --hash=sha256:1ade26fc9cf0d7c0700fa5430e8dc8411b1108d1eb21565adbe480b64f721a84 \ - --hash=sha256:5c5b1c8717a39b97462b197f6186c12d2e16455da00631cdaaca91d25736ffcd - # via - # -r requirements.in - # jedi-language-server -typeguard==2.12.1 \ - --hash=sha256:c2af8b9bdd7657f4bd27b45336e7930171aead796711bc4cfc99b4731bb9d051 \ - --hash=sha256:cc15ef2704c9909ef9c80e19c62fb8468c01f75aad12f651922acf4dbe822e02 - # via pygls -typing-extensions==3.10.0.2 \ - --hash=sha256:49f75d16ff11f1cd258e1b988ccff82a3ca5570217d7ad8c5f48205dd99a677e \ - --hash=sha256:d8226d10bc02a29bcc81df19a26e56a9647f8b0a6d4a83924139f4a8b01f17b7 \ - --hash=sha256:f1d25edafde516b146ecd0613dabcc61409817af4766fbbcfb8d1ad4ec441a34 - # via - # importlib-metadata - # pydantic -zipp==3.5.0 \ - --hash=sha256:957cfda87797e389580cb8b9e3870841ca991e2125350677b2ca83a0e99390a3 \ - --hash=sha256:f5812b1e007e48cff63449a5e9f4e7ebea716b4111f9c4f9a645f91d579bf0c4 - # via importlib-metadata diff --git a/src/client/activation/jedi/manager.ts b/src/client/activation/jedi/manager.ts index 920804e039d3..91a6559f99a6 100644 --- a/src/client/activation/jedi/manager.ts +++ b/src/client/activation/jedi/manager.ts @@ -86,7 +86,10 @@ export class JediLanguageServerManager implements ILanguageServerManager { try { // Version is actually hardcoded in our requirements.txt. - const requirementsTxt = await fs.readFile(path.join(EXTENSION_ROOT_DIR, 'requirements.txt'), 'utf-8'); + const requirementsTxt = await fs.readFile( + path.join(EXTENSION_ROOT_DIR, 'jedils_requirements.txt'), + 'utf-8', + ); // Search using a regex in the text const match = /jedi-language-server==([0-9\.]*)/.exec(requirementsTxt);