Skip to main content

VS Code Extension

Bring Codeflash directly into your editor. See optimization suggestions inline, track progress in real-time, and apply performance improvements without leaving your code.
Works with multiple editors — This extension is compatible with VS Code, Cursor, Windsurf, and other VS Code-compatible editors.

Requirements

Before installing the extension, ensure you have:
  • VS Code 1.94.0+ (or Cursor, Windsurf, or other VS Code-compatible editor)
  • Python 3.9+ installed and available in your PATH
  • Git repository initialized for your project
  • Microsoft Python extension installed (the Codeflash extension depends on it)

Installation

The quickest way to install for VS Code users:
1

Open Extensions Panel

Press Ctrl+Shift+X (Windows/Linux) or Cmd+Shift+X (macOS) to open the Extensions panel.
2

Search for Codeflash

Type “Codeflash” in the search bar.
3

Install

Click Install on the Codeflash extension.Install from VS Code Marketplace →
4

Reload

Reload VS Code when prompted to activate the extension.

First-Time Setup

When you first open a Python file, the extension guides you through setup:
1

Extension Activates

The Codeflash sidebar opens automatically, showing the setup wizard.
2

Select Python Interpreter

This step is critical. The extension uses the Python interpreter selected in VS Code to run Codeflash. Make sure you select the interpreter from the environment where Codeflash is installed.
  1. Press Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (macOS)
  2. Type “Python: Select Interpreter”
  3. Choose the Python environment where you installed Codeflash (e.g., your project’s virtual environment)
If you see “No Python interpreter selected” or “Codeflash not installed” errors, verify that:
  • You’ve selected the correct Python interpreter
  • Codeflash is installed in that environment (pip install codeflash)
3

Install Codeflash Package

If Codeflash is not installed in your selected Python environment, the extension prompts you to install it. Click the “Install codeflash Python package” button or run:
pip install codeflash
4

Authentication

Authenticate with Codeflash using one of two methods:
5

Project Initialization

The extension runs codeflash init to configure your project if needed. This creates or updates your pyproject.toml with Codeflash settings.
6

Ready to Optimize

Once setup completes, you’ll see “optimize” hints appear above your Python functions.
If you’ve already run codeflash init via CLI, the extension detects your existing configuration and skips to the ready state.

Changing the Python Interpreter

If you need to switch to a different Python environment later:
  1. Use VS Code’s interpreter selector: Ctrl+Shift+P → “Python: Select Interpreter”
  2. The extension automatically reloads when you change interpreters
The extension uses the Python interpreter selected in VS Code. Make sure Codeflash is installed in the selected environment.

Quick Start

Once installed, here’s the basic workflow:
  1. Open a Python file in your project
  2. See “optimize” hints appear above functions
  3. Click to optimize — the extension handles the rest
  4. Review and accept optimizations via inline comments
For detailed feature documentation, see Features.

Using with CLI

The extension works alongside the Codeflash CLI. You can:
  • Use CLI for batch operations — Run codeflash --all for large-scale optimization
  • Use extension for interactive work — Optimize individual functions as you code
  • Mix both — The extension picks up CLI results when you return to the editor

Next Steps


Need Help?