Skip to content

Support resolving Python environments #35

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

Merged
merged 11 commits into from
Jun 17, 2024
Merged

Support resolving Python environments #35

merged 11 commits into from
Jun 17, 2024

Conversation

DonJayamanne
Copy link
Collaborator

No description provided.

"env.bak",
"venv.bak",
"Scripts", // If the folder ends bin/scripts, then ignore it, as the parent is most likely an env.
"bin", // If the folder ends bin/scripts, then ignore it, as the parent is most likely an env.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ignore searching some known directories

) -> Option<ResolvedEnvironment> {
// First check if this is a known environment
let env = PythonEnv::new(executable.to_owned(), None, None);
if let Some(env) = identify_python_environment_using_locators(&env, locators) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Resolve

configuration: RwLock::new(Configuration::default()),
};

let mut handlers = HandlersKeyedByMethodName::new(Arc::new(context));
handlers.add_request_handler("refresh", handle_refresh);
handlers.add_request_handler("resolve", handle_resolve);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Add resolve request

// if the prefix is not defined, try to get this.
// For instance, if the file is bin/python or Scripts/python
// And we have a pyvenv.cfg file in the parent directory, then we can get the prefix.
if prefix.is_none() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Bug fix caught via CI

.unwrap_or_default();
}
if let Some(project) = &self.project {
writeln!(f, " Project : {}", project.to_str().unwrap()).unwrap_or_default();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Minor refactor

@DonJayamanne DonJayamanne marked this pull request as ready for review June 17, 2024 17:22
Copy link
Member

@karthiknadig karthiknadig left a comment

Choose a reason for hiding this comment

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

Spelling.

@DonJayamanne DonJayamanne enabled auto-merge (squash) June 17, 2024 22:43
@DonJayamanne DonJayamanne merged commit 8cf3388 into main Jun 17, 2024
22 of 24 checks passed
@DonJayamanne DonJayamanne deleted the wipx branch June 17, 2024 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants