Skip to content

Commit 9d18853

Browse files
authored
Merge pull request #2 from slidoapp/sweco/sync-with-upstream
Sync with upstream
2 parents 8d14fc6 + aa227fb commit 9d18853

7,324 files changed

Lines changed: 1145296 additions & 473271 deletions

File tree

Some content is hidden

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

.asf.yaml

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,14 @@
1717

1818
# https://cwiki.apache.org/confluence/display/INFRA/.asf.yaml+features+for+git+repositories
1919
---
20+
notifications:
21+
commits: commits@superset.apache.org
22+
issues: notifications@superset.apache.org
23+
pullrequests: notifications@superset.apache.org
24+
discussions: notifications@superset.apache.org
25+
2026
github:
27+
del_branch_on_merge: true
2128
description: "Apache Superset is a Data Visualization and Data Exploration Platform"
2229
homepage: https://superset.apache.org/
2330
labels:
@@ -47,32 +54,51 @@ github:
4754
projects: true
4855
# Enable wiki for documentation
4956
wiki: true
57+
# Enable discussions
58+
discussions: true
5059

5160
enabled_merge_buttons:
5261
squash: true
5362
merge: false
5463
rebase: false
5564

65+
ghp_branch: gh-pages
66+
ghp_path: /
67+
5668
protected_branches:
5769
master:
5870
required_status_checks:
5971
# strict means "Require branches to be up to date before merging".
6072
strict: false
6173
# contexts are the names of checks that must pass
74+
# unfortunately AFAICT for `matrix:` jobs, we have to itemize every
75+
# combination here.
6276
contexts:
63-
- check
77+
- lint-check
78+
- cypress-matrix (0, chrome)
6479
- cypress-matrix (1, chrome)
6580
- cypress-matrix (2, chrome)
6681
- cypress-matrix (3, chrome)
67-
- docker-build
82+
- cypress-matrix (4, chrome)
83+
- cypress-matrix (5, chrome)
84+
- dependency-review
6885
- frontend-build
69-
- pre-commit (3.7)
70-
- python-lint (3.7)
71-
- test-mysql (3.7)
72-
- test-postgres (3.7)
73-
- test-postgres (3.8)
74-
- test-sqlite (3.7)
86+
- pre-commit (current)
87+
- pre-commit (previous)
88+
- test-mysql
89+
- test-postgres (current)
90+
- test-postgres-hive
91+
- test-postgres-presto
92+
- test-sqlite
93+
- unit-tests (current)
94+
95+
required_pull_request_reviews:
96+
dismiss_stale_reviews: false
97+
require_code_owner_reviews: true
98+
required_approving_review_count: 1
7599

100+
required_signatures: false
101+
gh-pages:
76102
required_pull_request_reviews:
77103
dismiss_stale_reviews: false
78104
require_code_owner_reviews: true

.codecov.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ codecov:
33
after_n_builds: 4
44
ignore:
55
- "superset/migrations/versions/*.py"
6+
- "superset-frontend/packages/superset-ui-demo/**/*"
67
- "**/*.stories.tsx"
78
- "**/*.stories.jsx"
89
coverage:
@@ -14,6 +15,17 @@ coverage:
1415
# project coverage decrease:
1516
target: auto
1617
threshold: 0%
18+
core-packages-ts:
19+
target: 100%
20+
paths:
21+
- 'superset-frontend/packages'
22+
- '!superset-frontend/packages/**/*.jsx'
23+
- '!superset-frontend/packages/**/*.tsx'
24+
core-packages-tsx:
25+
target: 50%
26+
paths:
27+
- 'superset-frontend/packages/**/*.jsx'
28+
- 'superset-frontend/packages/**/*.tsx'
1729
patch:
1830
default:
1931
informational: true

.coveragerc

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# .coveragerc to control coverage.py
2+
[run]
3+
branch = True
4+
source = superset
5+
# omit = bad_file.py
6+
7+
[paths]
8+
source =
9+
superset/
10+
*/site-packages/
11+
12+
[report]
13+
# Regexes for lines to exclude from consideration
14+
exclude_lines =
15+
# Have to re-enable the standard pragma
16+
pragma: no cover
17+
18+
# Don't complain about missing debug-only code:
19+
def __repr__
20+
if self\.debug
21+
22+
# Don't complain if tests don't hit defensive assertion code:
23+
raise AssertionError
24+
raise NotImplementedError
25+
26+
# Don't complain if non-runnable code isn't run:
27+
if 0:
28+
if __name__ == .__main__.:
29+
30+
# Ignore importlib backport
31+
from importlib
32+
33+
if TYPE_CHECKING:
34+
35+
#fail_under = 100
36+
show_missing = True

.cursor/rules/dev-standard.mdc

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
---
2+
description: Apache Superset development standards and guidelines for Cursor IDE
3+
globs: ["**/*.py", "**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "**/*.sql", "**/*.md"]
4+
alwaysApply: true
5+
---
6+
7+
# Apache Superset Development Standards for Cursor IDE
8+
9+
Apache Superset is a data visualization platform with Flask/Python backend and React/TypeScript frontend.
10+
11+
## ⚠️ CRITICAL: Ongoing Refactors (What NOT to Do)
12+
13+
**These migrations are actively happening - avoid deprecated patterns:**
14+
15+
### Frontend Modernization
16+
- **NO `any` types** - Use proper TypeScript types
17+
- **NO JavaScript files** - Convert to TypeScript (.ts/.tsx)
18+
- **NO Enzyme** - Use React Testing Library/Jest (Enzyme fully removed)
19+
- **Use @superset-ui/core** - Don't import Ant Design directly
20+
21+
### Testing Strategy Migration
22+
- **Prefer unit tests** over integration tests
23+
- **Prefer integration tests** over Cypress end-to-end tests
24+
- **Cypress is last resort** - Actively moving away from Cypress
25+
- **Use Jest + React Testing Library** for component testing
26+
27+
### Backend Type Safety
28+
- **Add type hints** - All new Python code needs proper typing
29+
- **MyPy compliance** - Run `pre-commit run mypy` to validate
30+
- **SQLAlchemy typing** - Use proper model annotations
31+
32+
## Code Standards
33+
34+
### TypeScript Frontend
35+
- **NO `any` types** - Use proper TypeScript
36+
- **Functional components** with hooks
37+
- **@superset-ui/core** for UI components (not direct antd)
38+
- **Jest** for testing (NO Enzyme)
39+
- **Redux** for global state, hooks for local
40+
41+
### Python Backend
42+
- **Type hints required** for all new code
43+
- **MyPy compliant** - run `pre-commit run mypy`
44+
- **SQLAlchemy models** with proper typing
45+
- **pytest** for testing
46+
47+
### Apache License Headers
48+
- **New files require ASF license headers** - When creating new code files, include the standard Apache Software Foundation license header
49+
- **LLM instruction files are excluded** - Files like LLMS.md, CLAUDE.md, etc. are in `.rat-excludes` to avoid header token overhead
50+
51+
## Key Directory Structure
52+
53+
```
54+
superset/
55+
├── superset/ # Python backend (Flask, SQLAlchemy)
56+
│ ├── views/api/ # REST API endpoints
57+
│ ├── models/ # Database models
58+
│ └── connectors/ # Database connections
59+
├── superset-frontend/src/ # React TypeScript frontend
60+
│ ├── components/ # Reusable components
61+
│ ├── explore/ # Chart builder
62+
│ ├── dashboard/ # Dashboard interface
63+
│ └── SqlLab/ # SQL editor
64+
├── superset-frontend/packages/
65+
│ └── superset-ui-core/ # UI component library (USE THIS)
66+
├── tests/ # Python/integration tests
67+
├── docs/ # Documentation (UPDATE FOR CHANGES)
68+
└── UPDATING.md # Breaking changes log
69+
```
70+
71+
## Architecture Patterns
72+
73+
### Dataset-Centric Approach
74+
Charts built from enriched datasets containing:
75+
- Dimension columns with labels/descriptions
76+
- Predefined metrics as SQL expressions
77+
- Self-service analytics within defined contexts
78+
79+
### Security & Features
80+
- **RBAC**: Role-based access via Flask-AppBuilder
81+
- **Feature flags**: Control feature rollouts
82+
- **Row-level security**: SQL-based data access control
83+
84+
## Test Utilities
85+
86+
### Python Test Helpers
87+
- **`SupersetTestCase`** - Base class in `tests/integration_tests/base_tests.py`
88+
- **`@with_config`** - Config mocking decorator
89+
- **`@with_feature_flags`** - Feature flag testing
90+
- **`login_as()`, `login_as_admin()`** - Authentication helpers
91+
- **`create_dashboard()`, `create_slice()`** - Data setup utilities
92+
93+
### TypeScript Test Helpers
94+
- **`superset-frontend/spec/helpers/testing-library.tsx`** - Custom render() with providers
95+
- **`createWrapper()`** - Redux/Router/Theme wrapper
96+
- **`selectOption()`** - Select component helper
97+
- **React Testing Library** - NO Enzyme (removed)
98+
99+
## Pre-commit Validation
100+
101+
**Use pre-commit hooks for quality validation:**
102+
103+
```bash
104+
# Install hooks
105+
pre-commit install
106+
107+
# Quick validation (faster than --all-files)
108+
pre-commit run # Staged files only
109+
pre-commit run mypy # Python type checking
110+
pre-commit run prettier # Code formatting
111+
pre-commit run eslint # Frontend linting
112+
```
113+
114+
## Development Guidelines
115+
116+
- **Documentation**: Update docs/ for any user-facing changes
117+
- **Breaking Changes**: Add to UPDATING.md
118+
- **Docstrings**: Required for new functions/classes
119+
- **Follow existing patterns**: Mimic code style, use existing libraries and utilities
120+
- **Type Safety**: This codebase is actively modernizing toward full TypeScript and type safety
121+
- **Always run `pre-commit run`** to validate changes before committing
122+
123+
---
124+
125+
**Note**: This codebase is actively modernizing toward full TypeScript and type safety. Always run `pre-commit run` to validate changes. Follow the ongoing refactors section to avoid deprecated patterns.

.devcontainer/Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Keep this in sync with the base image in the main Dockerfile (ARG PY_VER)
2+
FROM python:3.11.13-bookworm AS base
3+
4+
# Install system dependencies that Superset needs
5+
# This layer will be cached across Codespace sessions
6+
RUN apt-get update && apt-get install -y \
7+
libsasl2-dev \
8+
libldap2-dev \
9+
libpq-dev \
10+
tmux \
11+
gh \
12+
&& rm -rf /var/lib/apt/lists/*
13+
14+
# Install uv for fast Python package management
15+
# This will also be cached in the image
16+
RUN curl -LsSf https://astral.sh/uv/install.sh | sh && \
17+
echo 'export PATH="/root/.cargo/bin:$PATH"' >> /etc/bash.bashrc
18+
19+
# Set the cargo/bin directory in PATH for all users
20+
ENV PATH="/root/.cargo/bin:${PATH}"

.devcontainer/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Superset Development with GitHub Codespaces
2+
3+
For complete documentation on using GitHub Codespaces with Apache Superset, please see:
4+
5+
**[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.

.devcontainer/bashrc-additions

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Superset Codespaces environment setup
2+
# This file is appended to ~/.bashrc during Codespace setup
3+
4+
# Find the workspace directory (handles both 'superset' and 'superset-2' names)
5+
WORKSPACE_DIR=$(find /workspaces -maxdepth 1 -name "superset*" -type d | head -1)
6+
7+
if [ -n "$WORKSPACE_DIR" ]; then
8+
# Check if virtual environment exists
9+
if [ -d "$WORKSPACE_DIR/.venv" ]; then
10+
# Activate the virtual environment
11+
source "$WORKSPACE_DIR/.venv/bin/activate"
12+
echo "✅ Python virtual environment activated"
13+
14+
# Verify pre-commit is installed and set up
15+
if command -v pre-commit &> /dev/null; then
16+
echo "✅ pre-commit is available ($(pre-commit --version))"
17+
# Install git hooks if not already installed
18+
if [ -d "$WORKSPACE_DIR/.git" ] && [ ! -f "$WORKSPACE_DIR/.git/hooks/pre-commit" ]; then
19+
echo "🪝 Installing pre-commit hooks..."
20+
cd "$WORKSPACE_DIR" && pre-commit install
21+
fi
22+
else
23+
echo "⚠️ pre-commit not found. Run: pip install pre-commit"
24+
fi
25+
else
26+
echo "⚠️ Python virtual environment not found at $WORKSPACE_DIR/.venv"
27+
echo " Run: cd $WORKSPACE_DIR && .devcontainer/setup-dev.sh"
28+
fi
29+
30+
# Always cd to the workspace directory for convenience
31+
cd "$WORKSPACE_DIR"
32+
fi
33+
34+
# Add helpful aliases for Superset development
35+
alias start-superset="$WORKSPACE_DIR/.devcontainer/start-superset.sh"
36+
alias setup-dev="$WORKSPACE_DIR/.devcontainer/setup-dev.sh"
37+
38+
# Show helpful message on login
39+
echo ""
40+
echo "🚀 Superset Codespaces Environment"
41+
echo "=================================="
42+
43+
# Check if Superset is running
44+
if docker ps 2>/dev/null | grep -q "superset"; then
45+
echo "✅ Superset is running!"
46+
echo " - Check the 'Ports' tab for your live Superset URL"
47+
echo " - Initial startup takes 10-20 minutes"
48+
echo " - Login: admin/admin"
49+
else
50+
echo "⚠️ Superset is not running. Use: start-superset"
51+
# Check if there's a startup log
52+
if [ -f "/tmp/superset-startup.log" ]; then
53+
echo " 📋 Startup log found: cat /tmp/superset-startup.log"
54+
fi
55+
fi
56+
57+
echo ""
58+
echo "Quick commands:"
59+
echo " start-superset - Start Superset with Docker Compose"
60+
echo " setup-dev - Set up Python environment (if not already done)"
61+
echo " pre-commit run - Run pre-commit checks on staged files"
62+
echo ""
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
# Script to build and push the devcontainer image to GitHub Container Registry
3+
# This allows caching the image between Codespace sessions
4+
5+
# You'll need to run this with appropriate GitHub permissions
6+
# gh auth login --scopes write:packages
7+
8+
REGISTRY="ghcr.io"
9+
OWNER="apache"
10+
REPO="superset"
11+
TAG="devcontainer-base"
12+
13+
echo "Building devcontainer image..."
14+
docker build -t $REGISTRY/$OWNER/$REPO:$TAG .devcontainer/
15+
16+
echo "Pushing to GitHub Container Registry..."
17+
docker push $REGISTRY/$OWNER/$REPO:$TAG
18+
19+
echo "Done! Update .devcontainer/devcontainer.json to use:"
20+
echo " \"image\": \"$REGISTRY/$OWNER/$REPO:$TAG\""

0 commit comments

Comments
 (0)