Skip to content
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

Add --user flag to global dvc auto installation #4091

Merged
merged 10 commits into from
Jun 14, 2023

Conversation

julieg18
Copy link
Contributor

@julieg18 julieg18 commented Jun 12, 2023

  • uses the python extension api to get information on selected environment and, if env is global, adds a --user flag to the install command

Part of #3935

@julieg18 julieg18 added the bug Something isn't working label Jun 12, 2023
@julieg18 julieg18 self-assigned this Jun 12, 2023
@julieg18 julieg18 marked this pull request as ready for review June 13, 2023 20:13
@@ -11,15 +11,24 @@ interface Settings {
}
}

type EnvironmentVariables = { readonly [key: string]: string | undefined }
type EnvironmentVariables = { readonly [key: string]: undefined }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Q] is this change intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope! I think it happened when I was fixing a merge conflict.

extension/src/setup/autoInstall.ts Outdated Show resolved Hide resolved
export interface VscodePython {
ready: Thenable<void>
settings: Settings
environments: {
known: Environment[]
getActiveEnvironmentPath: () => { id: string }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[I] If we are using this we also need to use onDidChangeActiveEnvironmentPath so that updates are taken into account... unless an update will be triggered in a different way.

[Q] Can we replace our other use of the API with this now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[I] If we are using this we also need to use onDidChangeActiveEnvironmentPath so that updates are taken into account... unless an update will be triggered in a different way.

Updates are triggered with onDidChangePythonExecutionDetails since that runs when the environment path changes.

[Q] Can we replace our other use of the API with this now?

Apologies, I'm not sure what you mean. What other use of the API could be replaced? Looking at the API, they all seem to be doing different things to me 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to merge this, but happy to update the use of the API in a followup!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use getExecutionDetails to get the Python executable for the active environment. Isn't that returned by getActiveEnvironmentPath?

export type EnvironmentPath = {
    /**
     * The ID of the environment.
     */
    readonly id: string;
    /**
     * Path to environment folder or path to python executable that uniquely identifies an environment. Environments
     * lacking a python executable are identified by environment folder paths, whereas other envs can be identified
     * using python executable path.
     */
    readonly path: string;
};

☝🏻 maybe we can't rely on this as it could return a folder and not an executable. Nevermind.

@julieg18 julieg18 enabled auto-merge (squash) June 14, 2023 16:07
@codeclimate
Copy link

codeclimate bot commented Jun 14, 2023

Code Climate has analyzed commit f0648dc and detected 2 issues on this pull request.

Here's the issue category breakdown:

Category Count
Duplication 2

The test coverage on the diff in this pull request is 93.5% (85% is the threshold).

This pull request will bring the total coverage in the repository to 95.1% (0.0% change).

View more on Code Climate.

@julieg18 julieg18 merged commit 4f5be9f into main Jun 14, 2023
@julieg18 julieg18 deleted the use-flag-for-installing-dvc-globally branch June 14, 2023 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants