Skip to content

Commit a9ed918

Browse files
committed
Merge branch 'master' of https://github.com/apache/superset
2 parents 2e00018 + c42e3c6 commit a9ed918

File tree

921 files changed

+37404
-11518
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

921 files changed

+37404
-11518
lines changed

.devcontainer/README.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,3 @@
33
For complete documentation on using GitHub Codespaces with Apache Superset, please see:
44

55
**[Setting up a Development Environment - GitHub Codespaces](https://superset.apache.org/docs/contributing/development#github-codespaces-cloud-development)**
6-
7-
## Pre-installed Development Environment
8-
9-
When you create a new Codespace from this repository, it automatically:
10-
11-
1. **Creates a Python virtual environment** using `uv venv`
12-
2. **Installs all development dependencies** via `uv pip install -r requirements/development.txt`
13-
3. **Sets up pre-commit hooks** with `pre-commit install`
14-
4. **Activates the virtual environment** automatically in all terminals
15-
16-
The virtual environment is located at `/workspaces/{repository-name}/.venv` and is automatically activated through environment variables set in the devcontainer configuration.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
// Extend the base configuration
3+
"extends": "../devcontainer-base.json",
4+
5+
"name": "Apache Superset Development (Default)",
6+
7+
// Forward ports for development
8+
"forwardPorts": [9001],
9+
"portsAttributes": {
10+
"9001": {
11+
"label": "Superset (via Webpack Dev Server)",
12+
"onAutoForward": "notify",
13+
"visibility": "public"
14+
}
15+
},
16+
17+
// Auto-start Superset on Codespace resume
18+
"postStartCommand": ".devcontainer/start-superset.sh"
19+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "Apache Superset Development",
3+
// Keep this in sync with the base image in Dockerfile (ARG PY_VER)
4+
// Using the same base as Dockerfile, but non-slim for dev tools
5+
"image": "python:3.11.13-bookworm",
6+
7+
"features": {
8+
"ghcr.io/devcontainers/features/docker-in-docker:2": {
9+
"moby": true,
10+
"dockerDashComposeVersion": "v2"
11+
},
12+
"ghcr.io/devcontainers/features/node:1": {
13+
"version": "20"
14+
},
15+
"ghcr.io/devcontainers/features/git:1": {},
16+
"ghcr.io/devcontainers/features/common-utils:2": {
17+
"configureZshAsDefaultShell": true
18+
},
19+
"ghcr.io/devcontainers/features/sshd:1": {
20+
"version": "latest"
21+
}
22+
},
23+
24+
// Run commands after container is created
25+
"postCreateCommand": "chmod +x .devcontainer/setup-dev.sh && .devcontainer/setup-dev.sh",
26+
27+
// VS Code customizations
28+
"customizations": {
29+
"vscode": {
30+
"extensions": [
31+
"ms-python.python",
32+
"ms-python.vscode-pylance",
33+
"charliermarsh.ruff",
34+
"dbaeumer.vscode-eslint",
35+
"esbenp.prettier-vscode"
36+
]
37+
}
38+
}
39+
}

.devcontainer/setup-dev.sh

Lines changed: 19 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -3,76 +3,30 @@
33

44
echo "🔧 Setting up Superset development environment..."
55

6-
# System dependencies and uv are now pre-installed in the Docker image
7-
# This speeds up Codespace creation significantly!
8-
9-
# Create virtual environment using uv
10-
echo "🐍 Creating Python virtual environment..."
11-
if ! uv venv; then
12-
echo "❌ Failed to create virtual environment"
13-
exit 1
14-
fi
15-
16-
# Install Python dependencies
17-
echo "📦 Installing Python dependencies..."
18-
if ! uv pip install -r requirements/development.txt; then
19-
echo "❌ Failed to install Python dependencies"
20-
echo "💡 You may need to run this manually after the Codespace starts"
21-
exit 1
22-
fi
23-
24-
# Install pre-commit hooks
25-
echo "🪝 Installing pre-commit hooks..."
26-
if source .venv/bin/activate && pre-commit install; then
27-
echo "✅ Pre-commit hooks installed"
28-
else
29-
echo "⚠️ Pre-commit hooks installation failed (non-critical)"
30-
fi
6+
# The universal image has most tools, just need Superset-specific libs
7+
echo "📦 Installing Superset-specific dependencies..."
8+
sudo apt-get update
9+
sudo apt-get install -y \
10+
libsasl2-dev \
11+
libldap2-dev \
12+
libpq-dev \
13+
tmux \
14+
gh
15+
16+
# Install uv for fast Python package management
17+
echo "📦 Installing uv..."
18+
curl -LsSf https://astral.sh/uv/install.sh | sh
19+
20+
# Add cargo/bin to PATH for uv
21+
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.bashrc
22+
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.zshrc
3123

3224
# Install Claude Code CLI via npm
3325
echo "🤖 Installing Claude Code..."
34-
if npm install -g @anthropic-ai/claude-code; then
35-
echo "✅ Claude Code installed"
36-
else
37-
echo "⚠️ Claude Code installation failed (non-critical)"
38-
fi
26+
npm install -g @anthropic-ai/claude-code
3927

4028
# Make the start script executable
4129
chmod +x .devcontainer/start-superset.sh
4230

43-
# Add bashrc additions for automatic venv activation
44-
echo "🔧 Setting up automatic environment activation..."
45-
if [ -f ~/.bashrc ]; then
46-
# Check if we've already added our additions
47-
if ! grep -q "Superset Codespaces environment setup" ~/.bashrc; then
48-
echo "" >> ~/.bashrc
49-
cat .devcontainer/bashrc-additions >> ~/.bashrc
50-
echo "✅ Added automatic venv activation to ~/.bashrc"
51-
else
52-
echo "✅ Bashrc additions already present"
53-
fi
54-
else
55-
# Create bashrc if it doesn't exist
56-
cat .devcontainer/bashrc-additions > ~/.bashrc
57-
echo "✅ Created ~/.bashrc with automatic venv activation"
58-
fi
59-
60-
# Also add to zshrc since that's the default shell
61-
if [ -f ~/.zshrc ] || [ -n "$ZSH_VERSION" ]; then
62-
if ! grep -q "Superset Codespaces environment setup" ~/.zshrc; then
63-
echo "" >> ~/.zshrc
64-
cat .devcontainer/bashrc-additions >> ~/.zshrc
65-
echo "✅ Added automatic venv activation to ~/.zshrc"
66-
fi
67-
fi
68-
6931
echo "✅ Development environment setup complete!"
70-
echo ""
71-
echo "📝 The virtual environment will be automatically activated in new terminals"
72-
echo ""
73-
echo "🔄 To activate in this terminal, run:"
74-
echo " source ~/.bashrc"
75-
echo ""
76-
echo "🚀 To start Superset:"
77-
echo " start-superset"
78-
echo ""
32+
echo "🚀 Run '.devcontainer/start-superset.sh' to start Superset"

.devcontainer/start-superset.sh

Lines changed: 22 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#!/bin/bash
22
# Startup script for Superset in Codespaces
33

4-
# Log to a file for debugging
5-
LOG_FILE="/tmp/superset-startup.log"
6-
echo "[$(date)] Starting Superset startup script" >> "$LOG_FILE"
7-
echo "[$(date)] User: $(whoami), PWD: $(pwd)" >> "$LOG_FILE"
8-
94
echo "🚀 Starting Superset in Codespaces..."
105
echo "🌐 Frontend will be available at port 9001"
116

7+
# Check if MCP is enabled
8+
if [ "$ENABLE_MCP" = "true" ]; then
9+
echo "🤖 MCP Service will be available at port 5008"
10+
fi
11+
1212
# Find the workspace directory (Codespaces clones as 'superset', not 'superset-2')
1313
WORKSPACE_DIR=$(find /workspaces -maxdepth 1 -name "superset*" -type d | head -1)
1414
if [ -n "$WORKSPACE_DIR" ]; then
@@ -18,71 +18,32 @@ else
1818
echo "📁 Using current directory: $(pwd)"
1919
fi
2020

21-
# Wait for Docker to be available
22-
echo "⏳ Waiting for Docker to start..."
23-
echo "[$(date)] Waiting for Docker..." >> "$LOG_FILE"
24-
max_attempts=30
25-
attempt=0
26-
while ! docker info > /dev/null 2>&1; do
27-
if [ $attempt -eq $max_attempts ]; then
28-
echo "❌ Docker failed to start after $max_attempts attempts"
29-
echo "[$(date)] Docker failed to start after $max_attempts attempts" >> "$LOG_FILE"
30-
echo "🔄 Please restart the Codespace or run this script manually later"
31-
exit 1
32-
fi
33-
echo " Attempt $((attempt + 1))/$max_attempts..."
34-
echo "[$(date)] Docker check attempt $((attempt + 1))/$max_attempts" >> "$LOG_FILE"
35-
sleep 2
36-
attempt=$((attempt + 1))
37-
done
38-
echo "✅ Docker is ready!"
39-
echo "[$(date)] Docker is ready" >> "$LOG_FILE"
40-
41-
# Check if Superset containers are already running
42-
if docker ps | grep -q "superset"; then
43-
echo "✅ Superset containers are already running!"
44-
echo ""
45-
echo "🌐 To access Superset:"
46-
echo " 1. Click the 'Ports' tab at the bottom of VS Code"
47-
echo " 2. Find port 9001 and click the globe icon to open"
48-
echo " 3. Wait 10-20 minutes for initial startup"
49-
echo ""
50-
echo "📝 Login credentials: admin/admin"
51-
exit 0
21+
# Check if docker is running
22+
if ! docker info > /dev/null 2>&1; then
23+
echo "⏳ Waiting for Docker to start..."
24+
sleep 5
5225
fi
5326

5427
# Clean up any existing containers
5528
echo "🧹 Cleaning up existing containers..."
56-
docker-compose -f docker-compose-light.yml down
29+
docker-compose -f docker-compose-light.yml --profile mcp down
5730

5831
# Start services
59-
echo "🏗️ Starting Superset in background (daemon mode)..."
32+
echo "🏗️ Building and starting services..."
6033
echo ""
61-
62-
# Start in detached mode
63-
docker-compose -f docker-compose-light.yml up -d
64-
65-
echo ""
66-
echo "✅ Docker Compose started successfully!"
67-
echo ""
68-
echo "📋 Important information:"
69-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
70-
echo "⏱️ Initial startup takes 10-20 minutes"
71-
echo "🌐 Check the 'Ports' tab for your Superset URL (port 9001)"
72-
echo "👤 Login: admin / admin"
34+
echo "📝 Once started, login with:"
35+
echo " Username: admin"
36+
echo " Password: admin"
7337
echo ""
74-
echo "📊 Useful commands:"
75-
echo " docker-compose -f docker-compose-light.yml logs -f # Follow logs"
76-
echo " docker-compose -f docker-compose-light.yml ps # Check status"
77-
echo " docker-compose -f docker-compose-light.yml down # Stop services"
78-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
79-
echo ""
80-
echo "💤 Keeping terminal open for 60 seconds to test persistence..."
81-
sleep 60
82-
echo "✅ Test complete - check if this terminal is still visible!"
38+
echo "📋 Running in foreground with live logs (Ctrl+C to stop)..."
8339

84-
# Show final status
85-
docker-compose -f docker-compose-light.yml ps
40+
# Run docker-compose and capture exit code
41+
if [ "$ENABLE_MCP" = "true" ]; then
42+
echo "🤖 Starting with MCP Service enabled..."
43+
docker-compose -f docker-compose-light.yml --profile mcp up
44+
else
45+
docker-compose -f docker-compose-light.yml up
46+
fi
8647
EXIT_CODE=$?
8748

8849
# If it failed, provide helpful instructions
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
// Extend the base configuration
3+
"extends": "../devcontainer-base.json",
4+
5+
"name": "Apache Superset Development with MCP",
6+
7+
// Forward ports for development
8+
"forwardPorts": [9001, 5008],
9+
"portsAttributes": {
10+
"9001": {
11+
"label": "Superset (via Webpack Dev Server)",
12+
"onAutoForward": "notify",
13+
"visibility": "public"
14+
},
15+
"5008": {
16+
"label": "MCP Service (Model Context Protocol)",
17+
"onAutoForward": "notify",
18+
"visibility": "private"
19+
}
20+
},
21+
22+
// Auto-start Superset with MCP on Codespace resume
23+
"postStartCommand": "ENABLE_MCP=true .devcontainer/start-superset.sh",
24+
25+
// Environment variables
26+
"containerEnv": {
27+
"ENABLE_MCP": "true"
28+
}
29+
}

.github/workflows/superset-frontend.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,15 @@ jobs:
135135
run: |
136136
docker load < docker-image.tar.gz
137137
138-
- name: eslint
138+
- name: lint
139139
run: |
140140
docker run --rm $TAG bash -c \
141-
"npm i && npm run eslint -- . --quiet"
141+
"npm i && npm run lint"
142142
143143
- name: tsc
144144
run: |
145145
docker run --rm $TAG bash -c \
146-
"npm run plugins:build && npm run type"
146+
"npm i && npm run plugins:build && npm run type"
147147
148148
validate-frontend:
149149
needs: frontend-build

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ docker/requirements-local.txt
121121

122122
cache/
123123
docker/*local*
124+
docker/superset-websocket/config.json
125+
docker-compose.override.yml
124126

125127
.temp_cache
126128

@@ -134,3 +136,4 @@ PROJECT.md
134136
.aider*
135137
.claude_rc*
136138
.env.local
139+
oxc-custom-build/

.pre-commit-config.yaml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,23 @@ repos:
6060
args: ["--markdown-linebreak-ext=md"]
6161
- repo: local
6262
hooks:
63-
- id: eslint-frontend
64-
name: eslint (frontend)
65-
entry: ./scripts/eslint.sh
63+
- id: prettier-frontend
64+
name: prettier (frontend)
65+
entry: bash -c 'cd superset-frontend && for file in "$@"; do npx prettier --write "${file#superset-frontend/}"; done'
66+
language: system
67+
pass_filenames: true
68+
files: ^superset-frontend/.*\.(js|jsx|ts|tsx|css|scss|sass|json)$
69+
- repo: local
70+
hooks:
71+
- id: oxlint-frontend
72+
name: oxlint (frontend)
73+
entry: ./scripts/oxlint.sh
74+
language: system
75+
pass_filenames: true
76+
files: ^superset-frontend/.*\.(js|jsx|ts|tsx)$
77+
- id: custom-rules-frontend
78+
name: custom rules (frontend)
79+
entry: ./scripts/check-custom-rules.sh
6680
language: system
6781
pass_filenames: true
6882
files: ^superset-frontend/.*\.(js|jsx|ts|tsx)$
@@ -110,9 +124,12 @@ repos:
110124
- -c
111125
- |
112126
TARGET_BRANCH=${GITHUB_BASE_REF:-master}
113-
git fetch origin "$TARGET_BRANCH"
114-
BASE=$(git merge-base origin/"$TARGET_BRANCH" HEAD)
115-
files=$(git diff --name-only --diff-filter=ACM "$BASE"..HEAD | grep '^superset/.*\.py$' || true)
127+
# Only fetch if we're not in CI (CI already has all refs)
128+
if [ -z "$CI" ]; then
129+
git fetch --no-recurse-submodules origin "$TARGET_BRANCH" 2>/dev/null || true
130+
fi
131+
BASE=$(git merge-base origin/"$TARGET_BRANCH" HEAD 2>/dev/null) || BASE="HEAD"
132+
files=$(git diff --name-only --diff-filter=ACM "$BASE"..HEAD 2>/dev/null | grep '^superset/.*\.py$' || true)
116133
if [ -n "$files" ]; then
117134
pylint --rcfile=.pylintrc --load-plugins=superset.extensions.pylint --reports=no $files
118135
else

.rat-excludes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
.nvmrc
1212
.prettierrc
1313
.rat-excludes
14+
.swcrc
1415
.*log
1516
.*pyc
1617
.*lock

0 commit comments

Comments
 (0)