This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch codespaces_setup
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 1ad286b680688e426881673e317930c78d1b3f70
Author: Maxime Beauchemin <[email protected]>
AuthorDate: Wed Jul 30 11:25:18 2025 -0700

    feat(codespaces): auto-setup Python venv with dependencies
    
    This enhancement makes Codespaces development-ready out of the box by 
automatically:
    
    - Creating a Python virtual environment using `uv venv`
    - Installing all development dependencies via `uv pip install -r 
requirements/development.txt`
    - Setting up pre-commit hooks with `pre-commit install`
    - Configuring the environment to auto-activate the venv in all terminals
    
    Developers no longer need to manually set up their Python environment when 
creating a new Codespace. The virtual environment is persisted at 
`/workspaces/{repo}/.venv` and automatically activated through container-level 
environment variables, eliminating the need to run `source .venv/bin/activate`.
    
    🤖 Generated with [Claude Code](https://claude.ai/code)
    
    Co-Authored-By: Claude <[email protected]>
---
 .devcontainer/README.md         | 11 +++++++++++
 .devcontainer/devcontainer.json |  6 ++++++
 .devcontainer/setup-dev.sh      | 15 +++++++++++++++
 3 files changed, 32 insertions(+)

diff --git a/.devcontainer/README.md b/.devcontainer/README.md
index 6b24183edc..e5dda78fe3 100644
--- a/.devcontainer/README.md
+++ b/.devcontainer/README.md
@@ -3,3 +3,14 @@
 For complete documentation on using GitHub Codespaces with Apache Superset, 
please see:
 
 **[Setting up a Development Environment - GitHub 
Codespaces](https://superset.apache.org/docs/contributing/development#github-codespaces-cloud-development)**
+
+## Pre-installed Development Environment
+
+When you create a new Codespace from this repository, it automatically:
+
+1. **Creates a Python virtual environment** using `uv venv`
+2. **Installs all development dependencies** via `uv pip install -r 
requirements/development.txt`
+3. **Sets up pre-commit hooks** with `pre-commit install`
+4. **Activates the virtual environment** automatically in all terminals
+
+The virtual environment is located at `/workspaces/{repository-name}/.venv` 
and is automatically activated through environment variables set in the 
devcontainer configuration.
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index c73a69e6c4..da5efedeb3 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -37,6 +37,12 @@
   // Auto-start Superset on Codespace resume
   "postStartCommand": ".devcontainer/start-superset.sh",
 
+  // Set environment variables
+  "remoteEnv": {
+    "VIRTUAL_ENV": "/workspaces/${localWorkspaceFolderBasename}/.venv",
+    "PATH": "/workspaces/${localWorkspaceFolderBasename}/.venv/bin:${PATH}"
+  },
+
   // VS Code customizations
   "customizations": {
     "vscode": {
diff --git a/.devcontainer/setup-dev.sh b/.devcontainer/setup-dev.sh
index f852118900..7d1eb91ab5 100755
--- a/.devcontainer/setup-dev.sh
+++ b/.devcontainer/setup-dev.sh
@@ -21,6 +21,21 @@ curl -LsSf https://astral.sh/uv/install.sh | sh
 echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.bashrc
 echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.zshrc
 
+# Source the PATH update for the current session
+export PATH="$HOME/.cargo/bin:$PATH"
+
+# Create virtual environment using uv
+echo "🐍 Creating Python virtual environment..."
+uv venv
+
+# Install Python dependencies
+echo "📦 Installing Python dependencies..."
+uv pip install -r requirements/development.txt
+
+# Install pre-commit hooks
+echo "🪝 Installing pre-commit hooks..."
+source .venv/bin/activate && pre-commit install
+
 # Install Claude Code CLI via npm
 echo "🤖 Installing Claude Code..."
 npm install -g @anthropic-ai/claude-code

Reply via email to