middpy
This is an extension for VS Code that adds a few buttons to get set up with Python
.
It provides the ability to set up a virtual environment and install packages that are specified in settings.json
of the .vscode
directory. There are buttons to open the Python
shell using that environment, run the current Python
script interactively, and debug the current script.
This was mainly developed to set up Python
for teaching computer science and has been tested on macOS, Windows and Linux.
The idea is that an initial folder for coursework is distributed to students which only contains .vscode/settings.json
with the packages needed for the course.
Features
- A button in the task bar (right) to set up the
Python
virtual environment.
- A menu button ("$(terminal)") to open a
Python
shell.
- A menu button ("$(rocket)") to run the current
Python
script interactively.
- A menu button ("$(bug)") to debug the current
Python
script.
Requirements
First, Python
should be installed on your system: https://www.python.org/downloads/.
This extension depends on the Microsoft Python
Extension which will automatically install when installing middpy
.
Extension Settings
Python
packages can be installed when the virtual environment is created by specifying the following list in settings.json
of your .vscode
folder. A prompt
can also be specified to change how the terminal appears.
middpy.packages
(optional, default: []
): List (string[]
) of packages to install.
middpy.prompt
(optional, default: .venv
): Alternative prompt name (string
) to display in the terminal.
middpy.requireSave
(optional, default: false
): Whether users should be required to save the current file before running (the default is to auto-save when the run/debug buttons are clicked).
Example
Here is an example of .vscode/settings.json
for CSCI 146 at Middlebury College in Fall 2025:
{
"middpy.prompt": "cs146",
"middpy.packages": [
"numpy",
"datascience",
"matplotlib",
"pillow",
"pygame",
"requests"
]
}
Release Notes
1.0.0
Initial release.
1.0.1
Added interactive run button.
1.0.2
Added debug command; only display icons in menu; moved setup button to the right in the taskbar.
1.0.3
Changed icon for Setup Python
("$(tools)").
1.0.4
Added back Python Shell
button in task bar.
1.0.5
Fixed some bugs with spaces in the workspace directory. Files will automatically save when the run or debug buttons are used (unless middpy.requireSave
is true
).
1.0.6
Fix bugs with PowerShell (Windows).