Skip to content

Commit

Permalink
Add back "Select Python Interpreter"
Browse files Browse the repository at this point in the history
  • Loading branch information
julieg18 committed Apr 27, 2023
1 parent a05091b commit d9662cc
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 80 deletions.
13 changes: 11 additions & 2 deletions extension/src/setup/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import { BaseWebview } from '../webview'
import { ViewKey } from '../webview/constants'
import { BaseRepository } from '../webview/repository'
import { Resource } from '../resourceLocator'
import { isPythonExtensionInstalled } from '../extensions/python'
import {
findAbsoluteDvcRootPath,
findDvcRootPaths,
Expand Down Expand Up @@ -354,10 +353,19 @@ export class Setup
}
}

private isDVCBeingUsedGlobally() {
const dvcPath = this.config.getCliPath()
const pythonBinPath = this.config.getPythonBinPath()

return dvcPath || !pythonBinPath
}

private async sendDataToWebview() {
const projectInitialized = this.hasRoots()
const hasData = this.getHasData()

const isPythonExtensionUsed = await this.isPythonExtensionUsed()

const needsGitInitialized =
!projectInitialized && !!(await this.needsGitInit())

Expand All @@ -375,7 +383,8 @@ export class Setup
cliCompatible: this.cliCompatible,
dvcCliDetails,
hasData,
isPythonExtensionInstalled: isPythonExtensionInstalled(),
isPythonExtensionUsed:
!this.isDVCBeingUsedGlobally() && isPythonExtensionUsed,
isStudioConnected: this.studioIsConnected,
needsGitCommit,
needsGitInitialized,
Expand Down
2 changes: 1 addition & 1 deletion extension/src/setup/webview/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export type SetupData = {
cliCompatible: boolean | undefined
dvcCliDetails: DvcCliDetails
hasData: boolean | undefined
isPythonExtensionInstalled: boolean
isPythonExtensionUsed: boolean
isStudioConnected: boolean
needsGitCommit: boolean
needsGitInitialized: boolean | undefined
Expand Down
4 changes: 2 additions & 2 deletions extension/src/setup/webview/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class WebviewMessages {
cliCompatible,
dvcCliDetails,
hasData,
isPythonExtensionInstalled,
isPythonExtensionUsed,
isStudioConnected,
needsGitCommit,
needsGitInitialized,
Expand All @@ -51,7 +51,7 @@ export class WebviewMessages {
cliCompatible,
dvcCliDetails,
hasData,
isPythonExtensionInstalled,
isPythonExtensionUsed,
isStudioConnected,
needsGitCommit,
needsGitInitialized,
Expand Down
8 changes: 4 additions & 4 deletions extension/src/test/suite/setup/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ suite('Setup Test Suite', () => {
cliCompatible: undefined,
dvcCliDetails: { command: 'dvc', version: undefined },
hasData: false,
isPythonExtensionInstalled: false,
isPythonExtensionUsed: false,
isStudioConnected: false,
needsGitCommit: true,
needsGitInitialized: true,
Expand Down Expand Up @@ -282,7 +282,7 @@ suite('Setup Test Suite', () => {
cliCompatible: true,
dvcCliDetails: { command: 'dvc', version: MIN_CLI_VERSION },
hasData: false,
isPythonExtensionInstalled: false,
isPythonExtensionUsed: false,
isStudioConnected: false,
needsGitCommit: true,
needsGitInitialized: true,
Expand Down Expand Up @@ -332,7 +332,7 @@ suite('Setup Test Suite', () => {
version: MIN_CLI_VERSION
},
hasData: false,
isPythonExtensionInstalled: false,
isPythonExtensionUsed: false,
isStudioConnected: false,
needsGitCommit: false,
needsGitInitialized: false,
Expand Down Expand Up @@ -382,7 +382,7 @@ suite('Setup Test Suite', () => {
version: MIN_CLI_VERSION
},
hasData: false,
isPythonExtensionInstalled: false,
isPythonExtensionUsed: false,
isStudioConnected: false,
needsGitCommit: true,
needsGitInitialized: false,
Expand Down
Loading

0 comments on commit d9662cc

Please sign in to comment.