Skip to content

Support for CLI Configuration ProfilesΒ #25589

@Kendr1ckFu

Description

@Kendr1ckFu

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:

  1. 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
  2. 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

  1. A user creates a profile named "API Server" with arguments --host 0.0.0.0 --port 8080.
  2. From the VS Code Command Palette (Ctrl+Shift+P), they can select "Python: Run with Configuration" and choose "API Server."
  3. The integrated terminal would then execute the command: python my_script.py --host 0.0.0.0 --port 8080.
  4. Similarly, for debugging, they could select a configuration from the debug launch dropdown, and VS Code would automatically populate the args field in the underlying launch.json for 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestRequest for new features or functionalitytriage-neededNeeds assignment to the proper sub-team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions