Skip to content
This repository has been archived by the owner on Dec 23, 2021. It is now read-only.

Removing dependency on pythonPath setting #384

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

luabud
Copy link
Member

@luabud luabud commented Oct 22, 2020

Description:

The Python extension is deprecating the python.pythonPath setting, which the DSX extension relies on.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Limitations:

  • No tests
  • Limited support for multi-root workspaces (interpreter path is retrieved for the first workspace folder, instead of the workspace folder from the file in focus)

Testing:

This is what I've done to test the changes:

  • Run "Preferences: Open Settings (JSON)" command and add the following line:
 "python.experiments.optInto": ["DeprecatePythonPath - experiment"]
  • Run "Developer: Reload Window"

  • Added a breakpoint to line 183 of src\service\setupService.ts to see the value of originalPythonExecutablePath changing to the right environment that was selected in the workspace.

Checklist:

  • My code follows the style guidelines of this project
  • My code has been formatted with npm run format and passes the checks in npm run check
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

},
"python.linting.pylintArgs": [
"--init-hook",
"import sys; sys.path.extend([\"\"c:\\\\Users\\\\luabud\\\\.vscode\\\\extensions\\\\ms-python.devicesimulatorexpress-2020.0.36321\\\\out\"\",\"\"c:\\\\Users\\\\luabud\\\\.vscode\\\\extensions\\\\ms-python.devicesimulatorexpress-2020.0.36321\\\\out\\\\micropython\"\",\"\"c:\\\\Users\\\\luabud\\\\.vscode\\\\extensions\\\\ms-python.devicesimulatorexpress-2020.0.36321\\\\out\\\\clue\"\",\"\"c:\\\\Users\\\\luabud\\\\.vscode\\\\extensions\\\\ms-python.devicesimulatorexpress-2020.0.36321\\\\out\\\\base_circuitpython\"\"])"
Copy link
Contributor

Choose a reason for hiding this comment

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

This is your local path, please remove

Copy link
Contributor

@isadorasophia isadorasophia left a comment

Choose a reason for hiding this comment

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

🤩

originalPythonExecutablePath = getConfig(CONFIG.PYTHON_PATH);
const extension = vscode.extensions.getExtension("ms-python.python");
const usingNewInterpreterStorage = extension.packageJSON?.featureFlags?.usingNewInterpreterStorage;
if (usingNewInterpreterStorage) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a comment explaining that the python extension is deprecating the old path? As we are still falling back to it if the new interpreter storage is not set

const execCommand = extension.exports.settings.getExecutionDetails ?
extension.exports.settings.getExecutionDetails().execCommand :
extension.exports.settings.getExecutionCommand();
originalPythonExecutablePath = execCommand.join(" ");
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
originalPythonExecutablePath = execCommand.join(" ");
originalPythonExecutablePath = execCommand.join(" ");

nit: extra tab 😁

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants