Skip to content

Conversation

@DonJayamanne
Copy link

No description provided.

PathBuf::from(".direnv"),
PathBuf::from(".venvs"),
PathBuf::from(".virtualenvs"),
PathBuf::from(".local").join("share").join("virtualenvs"),
Copy link
Author

Choose a reason for hiding this comment

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

@karthiknadig lets discuss tomorrow
Right now I'm only looking for pipenv envs, but all other envs even if global will be ignored.
I think we should just list them as well,

/**
* The project path for the Pipenv environment.
*/
pub project_path: Option<String>,
Copy link
Author

Choose a reason for hiding this comment

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

@karthiknadig Lets discuss tomorrow.

}

pub fn get_version(path: &str) -> Option<String> {
if let Some(parent_folder) = PathBuf::from(path).parent() {
Copy link
Author

Choose a reason for hiding this comment

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

@karthiknadig i think this is correct.
E.g. virtual envs and pipenvs have their version numbers in the pyvenv.cfg file, thus we can try to avoid the spawn here.


assert_eq!(dispatcher.messages.len(), 1);
let expected_json = json!({"envManager":null,"name":null,"pythonExecutablePath":unix_python_exe.clone(),"category":"system","version":null,"pythonRunCommand":[unix_python_exe.clone()],"envPath":unix_python.clone(),"sysPrefixPath":unix_python.clone()});
let expected_json = json!({"envManager":null,"projectPath": null, "name":null,"pythonExecutablePath":unix_python_exe.clone(),"category":"system","version":null,"pythonRunCommand":[unix_python_exe.clone()],"envPath":unix_python.clone(),"sysPrefixPath":unix_python.clone()});
Copy link
Author

Choose a reason for hiding this comment

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

I'll update the tests to remove the JSON and just build the structs by hand, then convert to JSOn and compare
handcrafting JSON is messy, structs will provide better language features.
@karthiknadig FYI only, will clean this in a separate PR

/**
* Path to the project directory when dealing with pipenv virtual environments.
*/
projectPath?: string;
Copy link
Author

Choose a reason for hiding this comment

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

Lets discuss these tomorrow.

@DonJayamanne DonJayamanne added no-changelog No news entry required skip package*.json package.json and package-lock.json don't both need updating skip tests Updates to tests unnecessary labels May 8, 2024
@DonJayamanne DonJayamanne marked this pull request as ready for review May 8, 2024 07:14
@DonJayamanne DonJayamanne merged commit 6be64ec into native_locator May 8, 2024
@DonJayamanne DonJayamanne deleted the get_version_from_pyevenv.cfg branch May 8, 2024 07:14
@vscodenpa vscodenpa added this to the May 2024 milestone May 8, 2024
kind: categoryToKind(data.category),
executablePath: data.pythonExecutablePath[0],
// TODO: What if executable is undefined?
executablePath: data.pythonExecutablePath!,
Copy link
Author

Choose a reason for hiding this comment

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

Need to discuss this as well.

anthonykim1 pushed a commit to anthonykim1/vscode-python that referenced this pull request May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog No news entry required skip package*.json package.json and package-lock.json don't both need updating skip tests Updates to tests unnecessary

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants