FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Remove all other version of debugpy by karthiknadig · Pull Request #11689 · microsoft/vscode-python · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .js  (1) .md  (2) .py  (1) .ts  (6) .yml  (3) All 5 file types selected
Only manifest files
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
16 changes: 10 additions & 6 deletions .github/workflows/ci.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ jobs:
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/python/old_ptvsd --no-cache-dir --implementation py --no-deps --upgrade 'ptvsd==4.3.2'
python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python/debugpy/no_wheels --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy

- name: Install debugpy wheels
run: |
Expand Down Expand Up @@ -259,9 +258,8 @@ jobs:
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/python/old_ptvsd --no-cache-dir --implementation py --no-deps --upgrade 'ptvsd==4.3.2'
python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python/debugpy/no_wheels --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy
# We need to have debugpy available in wheels/ 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/debugpy/wheels --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy
# 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

- name: Install test requirements
run: python -m pip install --upgrade -r build/test-requirements.txt
Expand All @@ -272,14 +270,20 @@ jobs:
python -m pip install --upgrade -r ./build/ipython-test-requirements.txt
if: matrix.test-suite == 'python-unit'

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

- name: Install debugpy (python 2.7)
run: |
python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy
shell: bash
if: matrix.test-suite == 'debugger' && matrix.python == 2.7

- name: Install functional test requirements
run: |
python -m pip install numpy
Expand Down Expand Up @@ -454,7 +458,7 @@ jobs:
python -m pip install --upgrade -r build/test-requirements.txt
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/python/old_ptvsd --no-cache-dir --implementation py --no-deps --upgrade 'ptvsd==4.3.2'
python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python/debugpy/no_wheels --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy
python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy
shell: bash

- name: pip install ipython requirements
Expand Down
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,9 @@ Steps to build the extension on your machine once you've cloned the repo:
> npm ci
> python3 -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r requirements.txt
> python3 -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python/old_ptvsd --no-cache-dir --implementation py --no-deps --upgrade 'ptvsd==4.3.2'
> python3 -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python/debugpy/no_wheels --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy
# For python 3.6 and lower use this command to install the debugger
> python3 -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy
# For python 3.7 and greater use this command to install the debugger
> python3 -m pip --disable-pip-version-check install -r build/debugger-install-requirements.txt
> python3 ./pythonFiles/install_debugpy.py
> npm run clean
Expand Down
1 change: 0 additions & 1 deletion build/ci/templates/steps/build.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ steps:
- bash: |
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/python/old_ptvsd --no-cache-dir --implementation py --no-deps --upgrade 'ptvsd==4.3.2'
python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python/debugpy/no_wheels --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy
failOnStderr: true
displayName: 'pip install requirements'

Expand Down
4 changes: 2 additions & 2 deletions build/ci/templates/test_phases.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ steps:
python -m pip install --upgrade -r build/test-requirements.txt
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/python/old_ptvsd --no-cache-dir --implementation py --no-deps --upgrade 'ptvsd==4.3.2'
python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python/debugpy/no_wheels --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy
python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy
displayName: 'pip install system test requirements'
condition: and(succeeded(), eq(variables['NeedsPythonTestReqs'], 'true'))

Expand Down Expand Up @@ -161,7 +161,7 @@ steps:
# Run the pip installs in the 3 environments (windows)
- script: |
call activate base
conda install --quiet -y --file build/ci/conda_base.yml
conda install --quiet -y --file build/ci/conda_base.yml
python -m pip install --upgrade -r build/conda-functional-requirements.txt
call activate conda_env_1
python -m pip install --upgrade -r build/conda-functional-requirements.txt
Expand Down
31 changes: 0 additions & 31 deletions gulpfile.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -405,37 +405,6 @@ gulp.task('installNewDebugpy', async () => {
}

rmrf.sync('./pythonFiles/lib/temp');

// Install source only version of new DEBUGPY for use with all other python versions.
const args = [
'-m',
'pip',
'--disable-pip-version-check',
'install',
'-t',
'./pythonFiles/lib/python/debugpy/no_wheels',
'--no-cache-dir',
'--implementation',
'py',
'--no-deps',
'--upgrade',
'--pre',
'debugpy'
];
const successWithoutWheels = await spawnAsync(process.env.CI_PYTHON_PATH || 'python3', args, undefined, true)
.then(() => true)
.catch((ex) => {
console.error("Failed to install DEBUGPY using 'python3'", ex);
return false;
});
if (!successWithoutWheels) {
console.info(
"Failed to install source only version of new DEBUGPY using 'python3', attempting to install using 'python'"
);
await spawnAsync('python', args).catch((ex) =>
console.error("Failed to install source only DEBUGPY using 'python'", ex)
);
}
});

// Install the last stable version of old PTVSD (which includes a middle layer adapter and requires ptvsd_launcher.py)
Expand Down
1 change: 1 addition & 0 deletions news/2 Fixes/11686.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixes issue with importing `debupy` in interactive window.
4 changes: 1 addition & 3 deletions pythonFiles/install_debugpy.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@


EXTENSION_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DEBUGGER_DEST = os.path.join(
EXTENSION_ROOT, "pythonFiles", "lib", "python", "debugpy", "wheels"
)
DEBUGGER_DEST = os.path.join(EXTENSION_ROOT, "pythonFiles", "lib", "python")
DEBUGGER_PACKAGE = "debugpy"
DEBUGGER_PYTHON_VERSIONS = ("cp37",)

Expand Down
16 changes: 2 additions & 14 deletions src/client/datascience/jupyter/jupyterDebugger.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -238,20 +238,13 @@ export class JupyterDebugger implements IJupyterDebugger, ICellHashListener {
* @returns {Promise<string>}
* @memberof JupyterDebugger
*/
private async getDebuggerPath(notebook: INotebook): Promise<string> {
private async getDebuggerPath(_notebook: INotebook): Promise<string> {
if (this.debuggerPackage === 'ptvsd') {
return path.join(EXTENSION_ROOT_DIR, 'pythonFiles', 'lib', 'python', 'old_ptvsd');
}
const pythonVersion = await this.getKernelPythonVersion(notebook);
// The new debug adapter with wheels is only supported in 3.7
// Code can be found here (src/client/debugger/extension/adapter/factory.ts).
if (pythonVersion && pythonVersion.major === 3 && pythonVersion.minor === 7) {
// Return debugger with wheels
return path.join(EXTENSION_ROOT_DIR, 'pythonFiles', 'lib', 'python', 'debugpy', 'wheels');
}

// We are here so this is NOT python 3.7, return debugger without wheels
return path.join(EXTENSION_ROOT_DIR, 'pythonFiles', 'lib', 'python', 'debugpy', 'no_wheels');
return path.join(EXTENSION_ROOT_DIR, 'pythonFiles', 'lib', 'python');
}
private async calculateDebuggerPathList(notebook: INotebook): Promise<string | undefined> {
const extraPaths: string[] = [];
Expand Down Expand Up @@ -328,11 +321,6 @@ export class JupyterDebugger implements IJupyterDebugger, ICellHashListener {
return notebook.execute(code, Identifiers.EmptyFileName, 0, uuid(), undefined, true);
}

private async getKernelPythonVersion(notebook: INotebook): Promise<Version | undefined> {
const execResults = await this.executeSilently(notebook, 'import sys;print(sys.version)');
return this.parseVersionInfo(execResults, 'pythonVersionInfo');
}

private async debuggerCheck(notebook: INotebook): Promise<Version | undefined> {
// We don't want to actually import the debugger to check version so run
// python instead. If we import an old version it's hard to get rid of on
Expand Down
44 changes: 11 additions & 33 deletions src/client/debugger/extension/adapter/factory.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,17 @@ export class DebugAdapterDescriptorFactory implements IDebugAdapterDescriptorFac
return new DebugAdapterExecutable(pythonPath, [configuration.debugAdapterPath, ...logArgs]);
}

const debuggerPathToUse = path.join(EXTENSION_ROOT_DIR, 'pythonFiles', 'lib', 'python', 'debugpy');

if (await this.useNewDebugger(pythonPath)) {
sendTelemetryEvent(EventName.DEBUG_ADAPTER_USING_WHEELS_PATH, undefined, { usingWheels: true });
return new DebugAdapterExecutable(pythonPath, [
path.join(debuggerPathToUse, 'wheels', 'debugpy', 'adapter'),
...logArgs
]);
} else {
sendTelemetryEvent(EventName.DEBUG_ADAPTER_USING_WHEELS_PATH, undefined, {
usingWheels: false
});
return new DebugAdapterExecutable(pythonPath, [
path.join(debuggerPathToUse, 'no_wheels', 'debugpy', 'adapter'),
...logArgs
]);
}
const debuggerAdapterPathToUse = path.join(
EXTENSION_ROOT_DIR,
'pythonFiles',
'lib',
'python',
'debugpy',
'adapter'
);

sendTelemetryEvent(EventName.DEBUG_ADAPTER_USING_WHEELS_PATH, undefined, { usingWheels: true });
return new DebugAdapterExecutable(pythonPath, [debuggerAdapterPathToUse, ...logArgs]);
}
} else {
this.experimentsManager.sendTelemetryIfInExperiment(DebugAdapterNewPtvsd.control);
Expand All @@ -105,22 +99,6 @@ export class DebugAdapterDescriptorFactory implements IDebugAdapterDescriptorFac
throw new Error('Debug Adapter Executable not provided');
}

/**
* Check and return whether the user should and can use the new Debugger wheels or not.
*
* @param {string} pythonPath Path to the python executable used to launch the Python Debug Adapter (result of `this.getPythonPath()`)
* @returns {Promise<boolean>} Whether the user should and can use the new Debugger wheels or not.
* @memberof DebugAdapterDescriptorFactory
*/
private async useNewDebugger(pythonPath: string): Promise<boolean> {
const interpreterInfo = await this.interpreterService.getInterpreterDetails(pythonPath);
if (!interpreterInfo || !interpreterInfo.version || !interpreterInfo.version.raw.startsWith('3.7')) {
return false;
}

return true;
}

/**
* Get the python executable used to launch the Python Debug Adapter.
* In the case of `attach` scenarios, just use the workspace interpreter, else first available one.
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import '../../../common/extensions';

const pathToPythonLibDir = path.join(EXTENSION_ROOT_DIR, 'pythonFiles', 'lib', 'python');
const pathToScript = path.join(EXTENSION_ROOT_DIR, 'pythonFiles', 'ptvsd_launcher.py');
const pathToDebugger = path.join(pathToPythonLibDir, 'debugpy', 'no_wheels', 'debugpy');
const pathToDebugger = path.join(pathToPythonLibDir, 'debugpy');

export type RemoteDebugOptions = {
host: string;
Expand Down
20 changes: 2 additions & 18 deletions src/test/api.functional.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,7 @@ suite('Extension API', () => {
const expectedLauncherPath = path
.join(EXTENSION_ROOT_DIR, 'pythonFiles', 'ptvsd_launcher.py')
.fileToCommandArgument();
const debuggerPath = path.join(
EXTENSION_ROOT_DIR,
'pythonFiles',
'lib',
'python',
'debugpy',
'no_wheels',
'debugpy'
);
const debuggerPath = path.join(EXTENSION_ROOT_DIR, 'pythonFiles', 'lib', 'python', 'debugpy');
const ptvsdHost = 'somehost';
const ptvsdPort = 12345;

Expand Down Expand Up @@ -167,15 +159,7 @@ suite('Extension API', () => {
instance(serviceContainer)
).debug.getDebuggerPackagePath();

const expected = path.join(
EXTENSION_ROOT_DIR,
'pythonFiles',
'lib',
'python',
'debugpy',
'no_wheels',
'debugpy'
);
const expected = path.join(EXTENSION_ROOT_DIR, 'pythonFiles', 'lib', 'python', 'debugpy');
assert.equal(pkgPath, expected);
});
});
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ suite('Debugging - Adapter Factory', () => {
'lib',
'python',
'debugpy',
'wheels',
'debugpy',
'adapter'
);
const ptvsdAdapterPathWithoutWheels = path.join(
Expand All @@ -60,8 +58,6 @@ suite('Debugging - Adapter Factory', () => {
'lib',
'python',
'debugpy',
'no_wheels',
'debugpy',
'adapter'
);
const pythonPath = path.join('path', 'to', 'python', 'interpreter');
Expand Down Expand Up @@ -429,7 +425,7 @@ suite('Debugging - Adapter Factory', () => {
EventName.PYTHON_EXPERIMENTS,
EventName.DEBUG_ADAPTER_USING_WHEELS_PATH
]);
assert.deepEqual(Reporter.properties, [{ expName: DebugAdapterNewPtvsd.experiment }, { usingWheels: 'false' }]);
assert.deepEqual(Reporter.properties, [{ expName: DebugAdapterNewPtvsd.experiment }, { usingWheels: 'true' }]);
});

test('Send attach to local process telemetry if inside the DA experiment and attaching to a local process', async () => {
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ suite('Path To Debugger Package', () => {
const pathToPythonLibDir = path.join(EXTENSION_ROOT_DIR, 'pythonFiles', 'lib', 'python');
test('Path to debugpy debugger package', () => {
const actual = launchers.getDebugpyPackagePath();
const expected = path.join(pathToPythonLibDir, 'debugpy', 'no_wheels', 'debugpy');
const expected = path.join(pathToPythonLibDir, 'debugpy');
expect(actual).to.be.deep.equal(expected);
});
});

Back | FazBrowse Home | New Git URL