-
Notifications
You must be signed in to change notification settings - Fork 48
Virtual Environment Support for Dependencies #218
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The experience was much smoother than I expected! Awesome job :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I noticed that the linter outputs a errors before "activating" the extension in the session (before we point to the venv), do you think we can do something about that?
package.nls.json
Outdated
@@ -12,7 +12,7 @@ | |||
"deviceSimulatorExpressExtension.commands.microbit.openSimulator": "[micro:bit] Open Simulator", | |||
"deviceSimulatorExpressExtension.commands.microbit.newFile": "[micro:bit] New File", | |||
"deviceSimulatorExpressExtension.configuration.title": "Device Simulator Express configuration", | |||
"deviceSimulatorExpressExtension.configuration.properties.configEnvOnChange": "When you change the Python Interpreter, the dependencies for the Device Simulator Express will automatically be configured for the extension dependencies (and the interpreter will auto-change if necessary).", | |||
"deviceSimulatorExpressExtension.configuration.properties.configEnvOnChange": "When you change the Python interpreter, the Device Simulator Express will atuomatically configure itself for the required dependencies.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'automatically' is misspelled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I noticed that the linter outputs a errors before "activating" the extension in the session (before we point to the venv), do you think we can do something about that?
For this, the pylint configuration is added upon activation, so it's hard to have it recognize it before activating :(. Based on our current structure, pylint doesn't know to look in our outfolder until we specify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not entirely familiar with the best practices managing packages for VS extensions, but LGTM otherwise. I mostly made some nit suggestions as I had some trouble understanding some of the details at first :)
By the way, does the CI pipeline test the whole flow (from installing the extension to running an example)? |
Description:
Uses a virtual environment in extension files for holding adafruit_circuitplayground dependencies. Also allows for users to use their own virtual environments + install dependencies to those ones.
I also added a new option in settings to automatically configure environments when you switch the python interpreter. It is set to false by default, as it would probably be pretty disruptive if you're not using the extension.
There still the command palette option to configure the environment, which is now adapted for the new workflow.
If the python interpreter option ever gets deprecated and the "python.pythonPath" setting is no longer available, it will just use the global python version to create a virtual environment in the extension files every time.
Former dependencyChecker.ts system is deleted, since we are now more reliant on the python interpreter's ability to find the python path rather than what the python path environment variable is pointing to.
If virtual environment creation on the extension side ever fails, the extension asks the user if it can just install dependencies to whichever python interpreter they have selected & it stays on that interpreter.
If the user already has all dependencies installed on the python version that the interpreter is pointing to, it doesn't care whether they're in a venv and just goes with the current interpreter with no setup.
Type of change
Please delete options that are not relevant.
Limitations:
Testing:
Checklist:
npm run format
and passes the checks innpm run check