Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ contact_links:
- name: 'Jupyter'
url: https://github.com/microsoft/vscode-jupyter/issues
about: 'For issues relating to the Jupyter extension (including the interactive window)'
- name: 'Debugpy'
url: https://github.com/microsoft/debugpy/issues
about: 'For issues relating to the debugpy debugger'
- name: 'Python Debugger'
url: https://github.com/microsoft/vscode-python-debugger/issues
about: 'For issues relating to the Python debugger'
- name: Help/Support
url: https://github.com/microsoft/vscode-python/discussions/categories/q-a
about: 'Having trouble with the extension? Need help getting something to work?'
3 changes: 1 addition & 2 deletions .github/actions/build-vsix/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@ runs:
with:
options: '-t ./python_files/lib/python --implementation py'

- name: Install debugpy and get-pip
- name: Get-pip
run: |
python -m pip --disable-pip-version-check install packaging
python ./python_files/install_debugpy.py
python ./python_files/download_get_pip.py
shell: bash

Expand Down
1 change: 0 additions & 1 deletion .github/actions/smoke-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ runs:
- name: pip install system test requirements
run: |
python -m pip install --upgrade -r build/test-requirements.txt
python -m pip --disable-pip-version-check install -t ./python_files/lib/python --implementation py --no-deps --upgrade --pre debugpy
shell: bash

# Bits from the VSIX are reused by smokeTest.ts to speed things up.
Expand Down
14 changes: 0 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ jobs:

- name: Install other Python requirements
run: |
python -m pip --disable-pip-version-check install -t ./python_files/lib/python --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy
python -m pip install --upgrade -r build/test-requirements.txt

- name: Run Pyright
Expand Down Expand Up @@ -195,11 +194,6 @@ jobs:
python ./python_files/download_get_pip.py
shell: bash

- name: Install debugpy
run: |
# 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 ./python_files/lib/python --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy

- name: Install core Python requirements
uses: brettcannon/pip-secure-install@v1
with:
Expand All @@ -217,14 +211,6 @@ jobs:
- name: Install test requirements
run: python -m pip install --upgrade -r build/test-requirements.txt

- name: Install debugpy wheels (Python ${{ matrix.python }})
run: |
python -m pip install wheel
python -m pip install -r build/build-install-requirements.txt
python ./python_files/install_debugpy.py
shell: bash
if: matrix.test-suite == 'debugger'

- name: Install functional test requirements
run: python -m pip install --upgrade -r ./build/functional-test-requirements.txt
if: matrix.test-suite == 'functional'
Expand Down
19 changes: 0 additions & 19 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ jobs:

- name: Install other Python requirements
run: |
python -m pip --disable-pip-version-check install -t ./python_files/lib/python --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy
python -m pip install --upgrade -r build/test-requirements.txt

- name: Run Pyright
Expand Down Expand Up @@ -176,11 +175,6 @@ jobs:
with:
python-version: ${{ matrix.python }}

- name: Install debugpy
run: |
# 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 ./python_files/lib/python --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy

- name: Download get-pip.py
run: |
python -m pip install wheel
Expand All @@ -203,14 +197,6 @@ jobs:
- name: Install test requirements
run: python -m pip install --upgrade -r build/test-requirements.txt

- name: Install debugpy wheels (Python ${{ matrix.python }})
run: |
python -m pip install wheel
python -m pip --disable-pip-version-check install -r build/build-install-requirements.txt
python ./python_files/install_debugpy.py
shell: bash
if: matrix.test-suite == 'debugger'

- name: Install functional test requirements
run: python -m pip install --upgrade -r ./build/functional-test-requirements.txt
if: matrix.test-suite == 'functional'
Expand Down Expand Up @@ -408,11 +394,6 @@ jobs:
requirements-file: './python_files/jedilsp_requirements/requirements.txt'
options: '-t ./python_files/lib/jedilsp --implementation py'

- name: Install debugpy
run: |
# 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 ./python_files/lib/python --implementation py --no-deps --upgrade --pre debugpy

- name: Install test requirements
run: python -m pip install --upgrade -r build/test-requirements.txt

Expand Down
3 changes: 1 addition & 2 deletions build/azure-pipeline.pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ extends:

- script: |
python -m pip --disable-pip-version-check install -r build/build-install-requirements.txt
python ./python_files/install_debugpy.py
python ./python_files/download_get_pip.py
displayName: Install debugpy and get-pip.py
displayName: Get-pip.py

- script: |
python -m pip install --no-deps --require-hashes --only-binary :all: -t ./python_files/lib/python --implementation py -r ./requirements.txt
Expand Down
3 changes: 1 addition & 2 deletions build/azure-pipeline.stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ extends:

- script: |
python -m pip --disable-pip-version-check install -r build/build-install-requirements.txt
python ./python_files/install_debugpy.py
python ./python_files/download_get_pip.py
displayName: Install debugpy and get-pip.py
displayName: Get-pip.py

- script: |
python -m pip install --no-deps --require-hashes --only-binary :all: -t ./python_files/lib/python --implementation py -r ./requirements.txt
Expand Down
7 changes: 0 additions & 7 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,6 @@ def install_python_libs(session: nox.Session):

session.install("packaging")

# Install debugger
session.run(
"python",
"./python_files/install_debugpy.py",
env={"PYTHONPATH": "./python_files/lib/temp"},
)

# Download get-pip script
session.run(
"python",
Expand Down
66 changes: 0 additions & 66 deletions python_files/install_debugpy.py

This file was deleted.

2 changes: 0 additions & 2 deletions python_files/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@ extraPaths = ['lib/python', 'lib/jedilsp']
ignore = [
# Ignore all pre-existing code with issues
'get-pip.py',
'install_debugpy.py',
'tensorboard_launcher.py',
'testlauncher.py',
'visualstudio_py_testlauncher.py',
'testing_tools/unittest_discovery.py',
'testing_tools/adapter/util.py',
'testing_tools/adapter/pytest/_discovery.py',
'testing_tools/adapter/pytest/_pytest_item.py',
'tests/debug_adapter/test_install_debugpy.py',
'tests/testing_tools/adapter/.data',
'tests/testing_tools/adapter/test___main__.py',
'tests/testing_tools/adapter/test_discovery.py',
Expand Down
2 changes: 0 additions & 2 deletions python_files/tests/debug_adapter/__init__.py

This file was deleted.

25 changes: 0 additions & 25 deletions python_files/tests/debug_adapter/test_install_debugpy.py

This file was deleted.

5 changes: 3 additions & 2 deletions src/client/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { ILanguageServerOutputChannel } from './activation/types';
import { PythonExtension } from './api/types';
import { isTestExecution, PYTHON_LANGUAGE } from './common/constants';
import { IConfigurationService, Resource } from './common/types';
import { getDebugpyLauncherArgs, getDebugpyPackagePath } from './debugger/extension/adapter/remoteLaunchers';
import { getDebugpyLauncherArgs } from './debugger/extension/adapter/remoteLaunchers';
import { IInterpreterService } from './interpreter/contracts';
import { IServiceContainer, IServiceManager } from './ioc/types';
import { JupyterExtensionIntegration } from './jupyter/jupyterIntegration';
Expand All @@ -22,6 +22,7 @@ import { buildEnvironmentApi } from './environmentApi';
import { ApiForPylance } from './pylanceApi';
import { getTelemetryReporter } from './telemetry';
import { TensorboardExtensionIntegration } from './tensorBoard/tensorboardIntegration';
import { getDebugpyPath } from './debugger/pythonDebugger';

export function buildApi(
ready: Promise<void>,
Expand Down Expand Up @@ -122,7 +123,7 @@ export function buildApi(
});
},
async getDebuggerPackagePath(): Promise<string | undefined> {
return getDebugpyPackagePath();
return getDebugpyPath();
},
},
settings: {
Expand Down
18 changes: 8 additions & 10 deletions src/client/debugger/extension/adapter/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from 'vscode';
import { EXTENSION_ROOT_DIR } from '../../../constants';
import { IInterpreterService } from '../../../interpreter/contracts';
import { traceLog, traceVerbose } from '../../../logging';
import { traceError, traceLog, traceVerbose } from '../../../logging';
import { PythonEnvironment } from '../../../pythonEnvironments/info';
import { sendTelemetryEvent } from '../../../telemetry';
import { EventName } from '../../../telemetry/constants';
Expand All @@ -26,6 +26,7 @@ import { Common, Interpreters } from '../../../common/utils/localize';
import { IPersistentStateFactory } from '../../../common/types';
import { Commands } from '../../../common/constants';
import { ICommandManager } from '../../../common/application/types';
import { getDebugpyPath } from '../../pythonDebugger';

// persistent state names, exported to make use of in testing
export enum debugStateKeys {
Expand Down Expand Up @@ -90,15 +91,12 @@ export class DebugAdapterDescriptorFactory implements IDebugAdapterDescriptorFac
traceLog(`DAP Server launched with command: ${executable} ${args.join(' ')}`);
return new DebugAdapterExecutable(executable, args);
}

const debuggerAdapterPathToUse = path.join(
EXTENSION_ROOT_DIR,
'python_files',
'lib',
'python',
'debugpy',
'adapter',
);
const debugpyPath = await getDebugpyPath();
if (!debugpyPath) {
traceError('Could not find debugpy path.');
throw new Error('Could not find debugpy path.');
}
const debuggerAdapterPathToUse = path.join(debugpyPath, 'adapter');

const args = command.concat([debuggerAdapterPathToUse, ...logArgs]);
traceLog(`DAP Server launched with command: ${executable} ${args.join(' ')}`);
Expand Down
16 changes: 6 additions & 10 deletions src/client/debugger/extension/adapter/remoteLaunchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@

'use strict';

import * as path from 'path';
import { EXTENSION_ROOT_DIR } from '../../../common/constants';
import '../../../common/extensions';

const pathToPythonLibDir = path.join(EXTENSION_ROOT_DIR, 'python_files', 'lib', 'python');
const pathToDebugger = path.join(pathToPythonLibDir, 'debugpy');
import { getDebugpyPath } from '../../pythonDebugger';

type RemoteDebugOptions = {
host: string;
port: number;
waitUntilDebuggerAttaches: boolean;
};

export function getDebugpyLauncherArgs(options: RemoteDebugOptions, debuggerPath: string = pathToDebugger) {
export async function getDebugpyLauncherArgs(options: RemoteDebugOptions, debuggerPath?: string) {
if (!debuggerPath) {
debuggerPath = await getDebugpyPath();
}

const waitArgs = options.waitUntilDebuggerAttaches ? ['--wait-for-client'] : [];
return [
debuggerPath.fileToCommandArgumentForPythonExt(),
Expand All @@ -25,7 +25,3 @@ export function getDebugpyLauncherArgs(options: RemoteDebugOptions, debuggerPath
...waitArgs,
];
}

export function getDebugpyPackagePath(): string {
return pathToDebugger;
}
30 changes: 30 additions & 0 deletions src/client/debugger/pythonDebugger.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

import { extensions } from 'vscode';

interface IPythonDebuggerExtensionApi {
debug: {
getDebuggerPackagePath(): Promise<string>;
};
}

async function activateExtension() {
const extension = extensions.getExtension('ms-python.debugpy');
if (extension) {
if (!extension.isActive) {
await extension.activate();
}
}
return extension;
}

async function getPythonDebuggerExtensionAPI(): Promise<IPythonDebuggerExtensionApi | undefined> {
const extension = await activateExtension();
return extension?.exports as IPythonDebuggerExtensionApi;
}

export async function getDebugpyPath(): Promise<string> {
const api = await getPythonDebuggerExtensionAPI();
return api?.debug.getDebuggerPackagePath() ?? '';
}
Loading