diff --git a/README.md b/README.md index a4ee4e0c..1a6e48d1 100644 --- a/README.md +++ b/README.md @@ -39,10 +39,13 @@ Older versions of the Python Debugger extension are available for debugging Pyth You can reference the table below to find the most recent Python Debugger extension version that offers debugging support for projects using deprecated Python versions, as well as the debugpy version that is shipped in each extension version. +> **Note**: If you do not see older extension versions to install (<=`2024.0.0`), try opting-in to pre-releases. You can do so on the extension page by clicking `Switch to Pre-Release Version`. + | Python version | Latest supported Python Debugger extension version | debugpy version | | -------------- | -------------------------------------------------- | ---------------- | -| 2.7, >= 3.5 | 2023.1.XXX | 1.5.1 | -| >= 3.7 | 2023.3.XXX | 1.7.0 | +| 2.7, >= 3.5 | 2023.1.XXX | 1.5.1 | +| >= 3.7 | 2024.0.XXX | 1.7.0 | +| >= 3.8 | 2024.2.XXX | 1.8.1 | > **Note**: Once you install an older version of the Python Debugger extension in VS Code, you may want to disable auto update by changing the value of the `"extensions.autoUpdate"` setting in your `settings.json` file. diff --git a/src/extension/debugger/configuration/providers/djangoLaunch.ts b/src/extension/debugger/configuration/providers/djangoLaunch.ts index 23526e04..3aa75e33 100644 --- a/src/extension/debugger/configuration/providers/djangoLaunch.ts +++ b/src/extension/debugger/configuration/providers/djangoLaunch.ts @@ -31,6 +31,7 @@ export async function buildDjangoLaunchDebugConfiguration( program: program || defaultProgram, args: ['runserver'], django: true, + autoStartBrowser: false, }; if (!program) { const selectedProgram = await input.showInputBox({ @@ -42,6 +43,8 @@ export async function buildDjangoLaunchDebugConfiguration( if (selectedProgram) { manuallyEnteredAValue = true; config.program = selectedProgram; + } else { + return; } } diff --git a/src/extension/debugger/configuration/providers/fastapiLaunch.ts b/src/extension/debugger/configuration/providers/fastapiLaunch.ts index fe09c044..6755c71c 100644 --- a/src/extension/debugger/configuration/providers/fastapiLaunch.ts +++ b/src/extension/debugger/configuration/providers/fastapiLaunch.ts @@ -44,6 +44,8 @@ export async function buildFastAPILaunchDebugConfiguration( if (selectedPath) { manuallyEnteredAValue = true; config.args = [`${path.basename(selectedPath, '.py').replace('/', '.')}:app`, '--reload']; + } else { + return; } } diff --git a/src/extension/debugger/configuration/providers/flaskLaunch.ts b/src/extension/debugger/configuration/providers/flaskLaunch.ts index 85363d13..bd64bdc0 100644 --- a/src/extension/debugger/configuration/providers/flaskLaunch.ts +++ b/src/extension/debugger/configuration/providers/flaskLaunch.ts @@ -32,6 +32,7 @@ export async function buildFlaskLaunchDebugConfiguration( }, args: ['run', '--no-debugger', '--no-reload'], jinja: true, + autoStartBrowser: false, }; if (!application) { @@ -49,6 +50,8 @@ export async function buildFlaskLaunchDebugConfiguration( if (selectedApp) { manuallyEnteredAValue = true; config.env!.FLASK_APP = selectedApp; + } else { + return; } } diff --git a/src/extension/debugger/configuration/providers/moduleLaunch.ts b/src/extension/debugger/configuration/providers/moduleLaunch.ts index 447ea7b4..6c2ff32e 100644 --- a/src/extension/debugger/configuration/providers/moduleLaunch.ts +++ b/src/extension/debugger/configuration/providers/moduleLaunch.ts @@ -34,6 +34,8 @@ export async function buildModuleLaunchConfiguration( if (selectedModule) { manuallyEnteredAValue = true; config.module = selectedModule; + } else { + return; } sendTelemetryEvent(EventName.DEBUGGER_CONFIGURATION_PROMPTS, undefined, { diff --git a/src/extension/debugger/configuration/providers/pyramidLaunch.ts b/src/extension/debugger/configuration/providers/pyramidLaunch.ts index 22e420ca..47476be9 100644 --- a/src/extension/debugger/configuration/providers/pyramidLaunch.ts +++ b/src/extension/debugger/configuration/providers/pyramidLaunch.ts @@ -48,6 +48,8 @@ export async function buildPyramidLaunchConfiguration( if (selectedIniPath) { manuallyEnteredAValue = true; config.args = [selectedIniPath]; + } else { + return; } } diff --git a/src/extension/debugger/configuration/providers/remoteAttach.ts b/src/extension/debugger/configuration/providers/remoteAttach.ts index 2c142309..f4dd17ee 100644 --- a/src/extension/debugger/configuration/providers/remoteAttach.ts +++ b/src/extension/debugger/configuration/providers/remoteAttach.ts @@ -47,8 +47,9 @@ export async function buildRemoteAttachConfiguration( value && value.trim().length > 0 ? undefined : DebugConfigStrings.attach.enterRemoteHost.invalid, ), }); + if (!connect.host) { - connect.host = defaultHost; + return; } sendTelemetryEvent(EventName.DEBUGGER_CONFIGURATION_PROMPTS, undefined, { diff --git a/src/test/unittest/configuration/providers/djangoLaunch.unit.test.ts b/src/test/unittest/configuration/providers/djangoLaunch.unit.test.ts index 17df9f5d..60873509 100644 --- a/src/test/unittest/configuration/providers/djangoLaunch.unit.test.ts +++ b/src/test/unittest/configuration/providers/djangoLaunch.unit.test.ts @@ -109,6 +109,7 @@ suite('Debugging - Configuration Provider Django', () => { program: 'hello', args: ['runserver'], django: true, + autoStartBrowser: false, }; expect(state.config).to.be.deep.equal(config); @@ -119,7 +120,7 @@ suite('Debugging - Configuration Provider Django', () => { const workspaceFolderToken = '${workspaceFolder}'; const defaultProgram = `${workspaceFolderToken}-manage.py`; pathSeparatorStub.value('-'); - when(input.showInputBox(anything())).thenResolve(); + when(input.showInputBox(anything())).thenResolve(defaultProgram); await djangoLaunch.buildDjangoLaunchDebugConfiguration(instance(input), state); const config = { @@ -129,6 +130,7 @@ suite('Debugging - Configuration Provider Django', () => { program: defaultProgram, args: ['runserver'], django: true, + autoStartBrowser: false, }; expect(state.config).to.be.deep.equal(config); diff --git a/src/test/unittest/configuration/providers/fastapiLaunch.unit.test.ts b/src/test/unittest/configuration/providers/fastapiLaunch.unit.test.ts index 0667345a..f948c147 100644 --- a/src/test/unittest/configuration/providers/fastapiLaunch.unit.test.ts +++ b/src/test/unittest/configuration/providers/fastapiLaunch.unit.test.ts @@ -42,23 +42,6 @@ suite('Debugging - Configuration Provider FastAPI', () => { expect(file).to.be.equal('main.py'); }); - test('Launch JSON with valid python path', async () => { - const folder = { uri: Uri.parse(path.join('one', 'two')), name: '1', index: 0 }; - const state = { config: {}, folder }; - - await fastApiLaunch.buildFastAPILaunchDebugConfiguration(instance(input), state); - - const config = { - name: DebugConfigStrings.fastapi.snippet.name, - type: DebuggerTypeName, - request: 'launch', - module: 'uvicorn', - args: ['main:app', '--reload'], - jinja: true, - }; - - expect(state.config).to.be.deep.equal(config); - }); test('Launch JSON with selected app path', async () => { const folder = { uri: Uri.parse(path.join('one', 'two')), name: '1', index: 0 }; const state = { config: {}, folder }; diff --git a/src/test/unittest/configuration/providers/flaskLaunch.unit.test.ts b/src/test/unittest/configuration/providers/flaskLaunch.unit.test.ts index 1bb28ade..7fd6f1ea 100644 --- a/src/test/unittest/configuration/providers/flaskLaunch.unit.test.ts +++ b/src/test/unittest/configuration/providers/flaskLaunch.unit.test.ts @@ -41,27 +41,6 @@ suite('Debugging - Configuration Provider Flask', () => { expect(file).to.be.equal('app.py'); }); - test('Launch JSON with valid python path', async () => { - const folder = { uri: Uri.parse(path.join('one', 'two')), name: '1', index: 0 }; - const state = { config: {}, folder }; - - await flaskLaunch.buildFlaskLaunchDebugConfiguration(instance(input), state); - - const config = { - name: DebugConfigStrings.flask.snippet.name, - type: DebuggerTypeName, - request: 'launch', - module: 'flask', - env: { - FLASK_APP: 'app.py', - FLASK_DEBUG: '1', - }, - args: ['run', '--no-debugger', '--no-reload'], - jinja: true, - }; - - expect(state.config).to.be.deep.equal(config); - }); test('Launch JSON with selected app path', async () => { const folder = { uri: Uri.parse(path.join('one', 'two')), name: '1', index: 0 }; const state = { config: {}, folder }; @@ -81,6 +60,7 @@ suite('Debugging - Configuration Provider Flask', () => { }, args: ['run', '--no-debugger', '--no-reload'], jinja: true, + autoStartBrowser: false, }; expect(state.config).to.be.deep.equal(config); @@ -88,7 +68,7 @@ suite('Debugging - Configuration Provider Flask', () => { test('Launch JSON with default managepy path', async () => { const folder = { uri: Uri.parse(path.join('one', 'two')), name: '1', index: 0 }; const state = { config: {}, folder }; - when(input.showInputBox(anything())).thenResolve(); + when(input.showInputBox(anything())).thenResolve('app.py'); await flaskLaunch.buildFlaskLaunchDebugConfiguration(instance(input), state); @@ -103,6 +83,7 @@ suite('Debugging - Configuration Provider Flask', () => { }, args: ['run', '--no-debugger', '--no-reload'], jinja: true, + autoStartBrowser: false, }; expect(state.config).to.be.deep.equal(config); diff --git a/src/test/unittest/configuration/providers/moduleLaunch.unit.test.ts b/src/test/unittest/configuration/providers/moduleLaunch.unit.test.ts index d1db6c72..8cb4458d 100644 --- a/src/test/unittest/configuration/providers/moduleLaunch.unit.test.ts +++ b/src/test/unittest/configuration/providers/moduleLaunch.unit.test.ts @@ -19,7 +19,7 @@ suite('Debugging - Configuration Provider Module', () => { const state = { config: {}, folder }; const input = mock>(MultiStepInput); - when(input.showInputBox(anything())).thenResolve(); + when(input.showInputBox(anything())).thenResolve('enter-your-module-name'); await buildModuleLaunchConfiguration(instance(input), state); diff --git a/src/test/unittest/configuration/providers/pyramidLaunch.unit.test.ts b/src/test/unittest/configuration/providers/pyramidLaunch.unit.test.ts index 5489b624..e04acada 100644 --- a/src/test/unittest/configuration/providers/pyramidLaunch.unit.test.ts +++ b/src/test/unittest/configuration/providers/pyramidLaunch.unit.test.ts @@ -99,6 +99,7 @@ suite('Debugging - Configuration Provider Pyramid', () => { const folder = { uri: Uri.parse(path.join('one', 'two')), name: '1', index: 0 }; const state = { config: {}, folder }; pathSeparatorStub.value('-'); + when(input.showInputBox(anything())).thenResolve('${workspaceFolder}-development.ini'); await pyramidLaunch.buildPyramidLaunchConfiguration(instance(input), state); @@ -141,7 +142,7 @@ suite('Debugging - Configuration Provider Pyramid', () => { const defaultIni = `${workspaceFolderToken}-development.ini`; pathSeparatorStub.value('-'); - when(input.showInputBox(anything())).thenResolve(); + when(input.showInputBox(anything())).thenResolve(defaultIni); await pyramidLaunch.buildPyramidLaunchConfiguration(instance(input), state); diff --git a/src/test/unittest/configuration/providers/remoteAttach.unit.test.ts b/src/test/unittest/configuration/providers/remoteAttach.unit.test.ts index 85fd7408..c66db778 100644 --- a/src/test/unittest/configuration/providers/remoteAttach.unit.test.ts +++ b/src/test/unittest/configuration/providers/remoteAttach.unit.test.ts @@ -62,7 +62,7 @@ suite('Debugging - Configuration Provider Remote Attach', () => { const folder = { uri: Uri.parse(path.join('one', 'two')), name: '1', index: 0 }; const state = { config: {}, folder }; let portConfigured = false; - when(input.showInputBox(anything())).thenResolve(); + when(input.showInputBox(anything())).thenResolve('localhost'); sinon.stub(configuration, 'configurePort').callsFake(async () => { portConfigured = true;