-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
I would like to request a feature to support persistent, configurable CLI argument profiles for running and debugging Python scripts within VS Code.
Currently, to run a script with command-line arguments, a user must manually edit the launch.json file for each debug session or type the arguments into the terminal every time for a run session. This workflow becomes inefficient and error-prone when developers frequently switch between different sets of arguments (e.g., --train vs --evaluate, --env development vs --env production).
Proposed Solution
Introduce a dedicated UI and configuration system for managing "Run Configurations," similar to the excellent feature in PyCharm.
This could be implemented in one or both of the following ways:
-
A Graphical Configuration Manager: A new view in the Sidebar (e.g., "Python Configurations") where users can create, edit, and delete multiple run profiles. Each profile would have:
- Name (e.g., "Train Model," "Run Tests")
- Script path
- Command-line arguments (e.g.,
--mode train --epochs 50) - Working directory
- Environment variables
-
A Simplified Configuration File: A user/workspace-level configuration file (e.g.,
python_run_configurations.json) where these profiles are defined. This file could be source-controlled, allowing teams to share common run configurations.
User Workflow with this Feature
- A user creates a profile named "API Server" with arguments
--host 0.0.0.0 --port 8080. - From the VS Code Command Palette (
Ctrl+Shift+P), they can select "Python: Run with Configuration" and choose "API Server." - The integrated terminal would then execute the command:
python my_script.py --host 0.0.0.0 --port 8080. - Similarly, for debugging, they could select a configuration from the debug launch dropdown, and VS Code would automatically populate the
argsfield in the underlyinglaunch.jsonfor that session.
Benefits
- Increased Productivity: Saves time and reduces manual typing errors.
- Improved Project Onboarding: New team members can get started quickly with pre-defined, common commands.
- Better Organization: Keeps frequently used command-line invocations neatly organized and easily accessible.
- Seamless Switching: Allows developers to quickly switch between different execution contexts (e.g., development, testing, production) without remembering complex argument strings.
This feature would bring a level of convenience that many developers coming from IDEs like PyCharm are familiar with and would significantly improve the day-to-day workflow for Python development in VS Code.
Thank you for considering this feature.