-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Port Python Env Tools #25066
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port Python Env Tools #25066
Conversation
"resourcePath" | ||
] | ||
}, | ||
"when": "!pythonEnvExtensionInstalled" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will ensure these tools are disabled when Python Env extension is installed
src/client/extension.ts
Outdated
@@ -162,6 +163,7 @@ async function activateUnsafe( | ||
components.pythonEnvs, | ||
); | ||
const proposedApi = buildProposedApi(components.pythonEnvs, ext.legacyIOC.serviceContainer); | ||
registerTools(context,components.pythonEnvs, api.environments, ext.legacyIOC.serviceContainer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given these tools are temporary until Env extension goes stable, I didn't want to spend too much effort into moving these into the component registration, that was a lot of work, same with using Python API to get env details (there are too many ways to get env details, else resorted to using the external API as thats the stable way).
env: CondaEnvInfo, | ||
forShellExecution?: boolean, | ||
): Promise<string[] | undefined> { | ||
const args = ['-p', env.prefix]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using -p
as thats exactly whats done today in getRunPythonArgs
,
See the method right above this.
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
export interface PipPackage { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copied from Python Env repo
* Returns a promise that rejects with an {@CancellationError} as soon as the passed token is cancelled. | ||
* @see {@link raceCancellation} | ||
*/ | ||
export function raceCancellationError<T>(promise: Promise<T>, token: CancellationToken): Promise<T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't move into async.ts
as that doesn't allow usage of vscode
types for some reason.
Left here for private use, again these will go away when env extension is stable.
ourTools.add( | ||
extensions.onDidChange(() => { | ||
const envExtension = extensions.getExtension(ENVS_EXTENSION_ID); | ||
if (envExtension) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check if env extension is installed and disable this.
_token: CancellationToken, | ||
): Promise<PreparedToolInvocation> { | ||
return { | ||
invocationMessage: l10n.t('Fetching Python environment information'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will port these changes to prepareInvocation
into the Python env extension soon
: l10n.t(`Installing packages {0} in {1}`, options.input.packageList.sort().join(', '), envName); | ||
} else { | ||
title = | ||
options.input.packageList.length === 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will port these changes to prepareInvocation
into the Python env extension soon
Uh oh!
There was an error while loading. Please reload this page.