Skip to content

Python: implement recommendedWorkspaceRuntime() #6204

@sharon-wang

Description

Implementation Summary

This is the Python equivalent of #6208.

Implement recommendedWorkspaceRuntime() for the Python extension here:

/**
* Recommend a Python language runtime based on the workspace.
*/
async recommendedWorkspaceRuntime(): Promise<positron.LanguageRuntimeMetadata | undefined> {
// TODO: This is where we could recommend a runtime based on the
// workspace, e.g. if it contains a virtualenv
return undefined;
}

The method returns a single language runtime metadata based on a few criteria:

  • has the user indicated a preferred runtime in some way?
  • does the workspace contain files that indicate the preferred runtime?
    • .venv or .conda present?
    • other files that indicate the python interpreter to use?
  • does the user have a default Python runtime set? (there's a bug re: default python; see Respect python.defaultInterpreterPath setting #6281)

The startup behaviour of the runtime will also be set for the runtime metadata, based on the following:

  • if a specific interpreter is indicated in a .venv/.conda/etc, then use StartupBehavior.Immediately
  • if the Workspace or User level default interpreter is recommended, then use StartupBehavior.Implicit
  • maybe we need to do this? check the global and/or Python-specific startup behaviour to see if StartupBehavior.Explicit may need to be used

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions