You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/07/14 16:47:24 UTC
(superset) 01/01: chore: drop Python 3.10 support, require Python 3.11+
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a commit to branch chore/drop-python-3.10-support
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 332fe2e74b719b0b14d1581bbec544c20f388cb8
Author: Evan Rusackas <ev...@rusackas.com>
AuthorDate: Tue Jul 14 09:47:01 2026 -0700
chore: drop Python 3.10 support, require Python 3.11+
CI, packaging metadata, and docs now reflect Python 3.11 as the minimum
supported version. Also collapses the sys.version_info compat shims in
superset/app.py, superset/middleware/legacy_prefix_redirect.py, and
superset/utils/backports.py, which existed solely to support running on
Python 3.10 (StrEnum and wsgiref.types were both added in 3.11).
Removing the 3.10 floor also drops the now-dead pyhive<0.7.0 marker for
python_version<'3.11' and obsoletes the need to pin syntaqlite below
0.5.0 for 3.10 compatibility.
Closes #42007
Co-Authored-By: Claude Sonnet 5 <no...@anthropic.com>
---
.github/ISSUE_TEMPLATE/bug-report.yml | 3 +--
.github/actions/setup-backend/action.yml | 2 --
.github/workflows/bump-python-package.yml | 2 +-
.github/workflows/docker.yml | 2 +-
.github/workflows/pre-commit.yml | 2 +-
.github/workflows/scheduled-docker-image-refresh.yml | 2 +-
.github/workflows/superset-extensions-cli.yml | 2 +-
.github/workflows/superset-frontend.yml | 2 +-
.github/workflows/superset-python-integrationtest.yml | 2 +-
.github/workflows/superset-python-unittest.yml | 2 +-
.github/workflows/tag-release.yml | 2 +-
RELEASING/Dockerfile.from_local_tarball | 2 +-
RELEASING/Dockerfile.from_svn_tarball | 2 +-
RELEASING/Dockerfile.make_docs | 2 +-
RELEASING/Dockerfile.make_tarball | 2 +-
UPDATING.md | 7 +++++++
docker-compose-light.yml | 2 +-
docker-compose-non-dev.yml | 2 +-
docker-compose.yml | 2 +-
docs/admin_docs/configuration/mcp-server.mdx | 2 +-
docs/developer_docs/contributing/development-setup.md | 2 +-
docs/developer_docs/contributing/issue-reporting.md | 4 ++--
docs/developer_docs/index.md | 2 +-
pyproject.toml | 9 +++------
scripts/check-env.py | 4 ++--
superset-core/README.md | 2 +-
superset-core/pyproject.toml | 3 +--
superset-extensions-cli/README.md | 2 +-
superset-extensions-cli/pyproject.toml | 3 +--
superset/app.py | 17 ++---------------
superset/mcp_service/README.md | 2 +-
superset/middleware/legacy_prefix_redirect.py | 10 +---------
superset/utils/backports.py | 11 +----------
33 files changed, 43 insertions(+), 74 deletions(-)
diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml
index 6c8165357f9..fad00ba748b 100644
--- a/.github/ISSUE_TEMPLATE/bug-report.yml
+++ b/.github/ISSUE_TEMPLATE/bug-report.yml
@@ -50,9 +50,8 @@ body:
attributes:
label: Python version
options:
- - "3.9"
- - "3.10"
- "3.11"
+ - "3.12"
- Not applicable
- I don't know
validations:
diff --git a/.github/actions/setup-backend/action.yml b/.github/actions/setup-backend/action.yml
index 74f8842330a..c1134f7c74a 100644
--- a/.github/actions/setup-backend/action.yml
+++ b/.github/actions/setup-backend/action.yml
@@ -32,8 +32,6 @@ runs:
elif [ "$INPUT_PYTHON_VERSION" = "next" ]; then
# currently disabled in GHA matrixes because of library compatibility issues
RESOLVED_VERSION="3.12"
- elif [ "$INPUT_PYTHON_VERSION" = "previous" ]; then
- RESOLVED_VERSION="3.10"
elif printf '%s' "$INPUT_PYTHON_VERSION" | grep -Eq '^[0-9]+\.[0-9]+(\.[0-9]+)?$'; then
RESOLVED_VERSION="$INPUT_PYTHON_VERSION"
else
diff --git a/.github/workflows/bump-python-package.yml b/.github/workflows/bump-python-package.yml
index 305e38d99a4..59fc4bbb787 100644
--- a/.github/workflows/bump-python-package.yml
+++ b/.github/workflows/bump-python-package.yml
@@ -42,7 +42,7 @@ jobs:
- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
- python-version: "3.10"
+ python-version: "3.11"
- name: Install uv
run: pip install uv
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index 3d7892151fc..903518b4b5a 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -47,7 +47,7 @@ jobs:
steps:
- id: set_matrix
run: |
- MATRIX_CONFIG=$(if [ "${{ github.event_name }}" == "pull_request" ]; then echo '["dev", "lean"]'; else echo '["dev", "lean", "py310", "websocket", "dockerize", "py311", "py312"]'; fi)
+ MATRIX_CONFIG=$(if [ "${{ github.event_name }}" == "pull_request" ]; then echo '["dev", "lean"]'; else echo '["dev", "lean", "websocket", "dockerize", "py311", "py312"]'; fi)
echo "matrix_config=${MATRIX_CONFIG}" >> $GITHUB_OUTPUT
echo $GITHUB_OUTPUT
diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml
index c9f675554b2..ad32145339d 100644
--- a/.github/workflows/pre-commit.yml
+++ b/.github/workflows/pre-commit.yml
@@ -25,7 +25,7 @@ jobs:
# Run the full version spread on push (master/release) and nightly,
# but only the current version on PRs — lint/format/type results
# rarely differ across patch versions, so 3x per PR is wasteful.
- python-version: ${{ github.event_name == 'pull_request' && fromJSON('["current"]') || fromJSON('["current", "previous", "next"]') }}
+ python-version: ${{ github.event_name == 'pull_request' && fromJSON('["current"]') || fromJSON('["current", "next"]') }}
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
diff --git a/.github/workflows/scheduled-docker-image-refresh.yml b/.github/workflows/scheduled-docker-image-refresh.yml
index 955233bf231..1b1a1794afa 100644
--- a/.github/workflows/scheduled-docker-image-refresh.yml
+++ b/.github/workflows/scheduled-docker-image-refresh.yml
@@ -98,7 +98,7 @@ jobs:
# Mirror the same matrix the release publisher uses so every variant
# operators consume from Docker Hub gets the refreshed base.
matrix:
- build_preset: ["dev", "lean", "py310", "websocket", "dockerize", "py311", "py312"]
+ build_preset: ["dev", "lean", "websocket", "dockerize", "py311", "py312"]
fail-fast: false
steps:
- name: "Checkout release tag: ${{ needs.config.outputs.latest-release }}"
diff --git a/.github/workflows/superset-extensions-cli.yml b/.github/workflows/superset-extensions-cli.yml
index 476b43e3fa9..91ace6eed3b 100644
--- a/.github/workflows/superset-extensions-cli.yml
+++ b/.github/workflows/superset-extensions-cli.yml
@@ -25,7 +25,7 @@ jobs:
matrix:
# Full version spread on push (master/release) + nightly; current only
# on PRs to cut runner cost (cross-version breaks are caught at merge).
- python-version: ${{ github.event_name == 'pull_request' && fromJSON('["current"]') || fromJSON('["previous", "current", "next"]') }}
+ python-version: ${{ github.event_name == 'pull_request' && fromJSON('["current"]') || fromJSON('["current", "next"]') }}
defaults:
run:
working-directory: superset-extensions-cli
diff --git a/.github/workflows/superset-frontend.yml b/.github/workflows/superset-frontend.yml
index 7f411e3a857..8ba4cec3269 100644
--- a/.github/workflows/superset-frontend.yml
+++ b/.github/workflows/superset-frontend.yml
@@ -51,7 +51,7 @@ jobs:
git show -s --format=raw HEAD
docker buildx build \
-t $TAG \
- --cache-from=type=registry,ref=apache/superset-cache:3.10-slim-trixie \
+ --cache-from=type=registry,ref=apache/superset-cache:3.11-slim-trixie \
--target superset-node-ci \
.
diff --git a/.github/workflows/superset-python-integrationtest.yml b/.github/workflows/superset-python-integrationtest.yml
index 46f5a961da8..8fb465eb314 100644
--- a/.github/workflows/superset-python-integrationtest.yml
+++ b/.github/workflows/superset-python-integrationtest.yml
@@ -135,7 +135,7 @@ jobs:
matrix:
# Full version spread on push (master/release) + nightly; current only
# on PRs to cut runner cost (cross-version breaks are caught at merge).
- python-version: ${{ github.event_name == 'pull_request' && fromJSON('["current"]') || fromJSON('["current", "previous", "next"]') }}
+ python-version: ${{ github.event_name == 'pull_request' && fromJSON('["current"]') || fromJSON('["current", "next"]') }}
env:
PYTHONPATH: ${{ github.workspace }}
SUPERSET_CONFIG: tests.integration_tests.superset_test_config
diff --git a/.github/workflows/superset-python-unittest.yml b/.github/workflows/superset-python-unittest.yml
index b502bfca2af..056d959802f 100644
--- a/.github/workflows/superset-python-unittest.yml
+++ b/.github/workflows/superset-python-unittest.yml
@@ -50,7 +50,7 @@ jobs:
matrix:
# Full version spread on push (master/release) + nightly; current only
# on PRs to cut runner cost (cross-version breaks are caught at merge).
- python-version: ${{ github.event_name == 'pull_request' && fromJSON('["current"]') || fromJSON('["previous", "current", "next"]') }}
+ python-version: ${{ github.event_name == 'pull_request' && fromJSON('["current"]') || fromJSON('["current", "next"]') }}
env:
PYTHONPATH: ${{ github.workspace }}
# Promotes the SQLAlchemy 2.0 deprecation warnings already locked in as
diff --git a/.github/workflows/tag-release.yml b/.github/workflows/tag-release.yml
index fdf67aa0881..f2dbc9a631f 100644
--- a/.github/workflows/tag-release.yml
+++ b/.github/workflows/tag-release.yml
@@ -56,7 +56,7 @@ jobs:
strategy:
matrix:
build_preset:
- ["dev", "lean", "py310", "websocket", "dockerize", "py311", "py312"]
+ ["dev", "lean", "websocket", "dockerize", "py311", "py312"]
fail-fast: false
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
diff --git a/RELEASING/Dockerfile.from_local_tarball b/RELEASING/Dockerfile.from_local_tarball
index c56d75e87dc..e7ee676e12c 100644
--- a/RELEASING/Dockerfile.from_local_tarball
+++ b/RELEASING/Dockerfile.from_local_tarball
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-FROM python:3.10-slim-trixie
+FROM python:3.11-slim-trixie
RUN useradd --user-group --create-home --no-log-init --shell /bin/bash superset
diff --git a/RELEASING/Dockerfile.from_svn_tarball b/RELEASING/Dockerfile.from_svn_tarball
index 889724863a5..e858c7adacd 100644
--- a/RELEASING/Dockerfile.from_svn_tarball
+++ b/RELEASING/Dockerfile.from_svn_tarball
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-FROM python:3.10-slim-trixie
+FROM python:3.11-slim-trixie
RUN useradd --user-group --create-home --no-log-init --shell /bin/bash superset
diff --git a/RELEASING/Dockerfile.make_docs b/RELEASING/Dockerfile.make_docs
index e62faa89f8b..08817a462a6 100644
--- a/RELEASING/Dockerfile.make_docs
+++ b/RELEASING/Dockerfile.make_docs
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-FROM python:3.10-slim-trixie
+FROM python:3.11-slim-trixie
ARG VERSION
RUN git clone --depth 1 --branch ${VERSION} https://github.com/apache/superset.git /superset
diff --git a/RELEASING/Dockerfile.make_tarball b/RELEASING/Dockerfile.make_tarball
index e3163273a5e..344bb064df0 100644
--- a/RELEASING/Dockerfile.make_tarball
+++ b/RELEASING/Dockerfile.make_tarball
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-FROM python:3.10-slim-trixie
+FROM python:3.11-slim-trixie
RUN apt-get update -y
RUN apt-get install -y \
diff --git a/UPDATING.md b/UPDATING.md
index 138fe882375..6bf3bff087a 100644
--- a/UPDATING.md
+++ b/UPDATING.md
@@ -24,6 +24,13 @@ assists people when migrating to a new version.
## Next
+### Python 3.10 support removed
+
+Python 3.10 is no longer supported. Superset now requires **Python 3.11 or higher**.
+Update your environment (virtualenv, Docker base image, CI configuration, etc.) to
+Python 3.11+ before upgrading. The `apache/superset-cache:3.10-slim-trixie` and
+`py310` Docker image variants are no longer published.
+
### Owners, dashboard roles, and RLS roles replaced by Subjects
Superset now uses subject-based access assignments for dashboards, charts, datasets,
diff --git a/docker-compose-light.yml b/docker-compose-light.yml
index 458708bd26a..3be24237eb9 100644
--- a/docker-compose-light.yml
+++ b/docker-compose-light.yml
@@ -71,7 +71,7 @@ x-common-build: &common-build
context: .
target: ${SUPERSET_BUILD_TARGET:-dev} # can use `dev` (default) or `lean`
cache_from:
- - apache/superset-cache:3.10-slim-trixie
+ - apache/superset-cache:3.11-slim-trixie
args:
DEV_MODE: "true"
INCLUDE_CHROMIUM: ${INCLUDE_CHROMIUM:-false}
diff --git a/docker-compose-non-dev.yml b/docker-compose-non-dev.yml
index cc80aea9d19..a939d4971e7 100644
--- a/docker-compose-non-dev.yml
+++ b/docker-compose-non-dev.yml
@@ -33,7 +33,7 @@ x-common-build: &common-build
context: .
target: dev
cache_from:
- - apache/superset-cache:3.10-slim-trixie
+ - apache/superset-cache:3.11-slim-trixie
services:
redis:
diff --git a/docker-compose.yml b/docker-compose.yml
index 1c0d1592d17..d522b66a664 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -38,7 +38,7 @@ x-common-build: &common-build
context: .
target: ${SUPERSET_BUILD_TARGET:-dev} # can use `dev` (default) or `lean`
cache_from:
- - apache/superset-cache:3.10-slim-trixie
+ - apache/superset-cache:3.11-slim-trixie
args:
DEV_MODE: "true"
INCLUDE_CHROMIUM: ${INCLUDE_CHROMIUM:-false}
diff --git a/docs/admin_docs/configuration/mcp-server.mdx b/docs/admin_docs/configuration/mcp-server.mdx
index d14b323e760..f0f33c8e785 100644
--- a/docs/admin_docs/configuration/mcp-server.mdx
+++ b/docs/admin_docs/configuration/mcp-server.mdx
@@ -99,7 +99,7 @@ See [Connecting AI Clients](#connecting-ai-clients) for Claude Code, Claude Web,
## Prerequisites
- Apache Superset 5.0+ running and accessible
-- Python 3.10+
+- Python 3.11+
- The `fastmcp` package (`pip install fastmcp`)
---
diff --git a/docs/developer_docs/contributing/development-setup.md b/docs/developer_docs/contributing/development-setup.md
index c0ac0d165bb..1b6227b2597 100644
--- a/docs/developer_docs/contributing/development-setup.md
+++ b/docs/developer_docs/contributing/development-setup.md
@@ -379,7 +379,7 @@ functioning across environments.
Make sure your machine meets the [OS dependencies](https://superset.apache.org/docs/installation/pypi#os-dependencies) before following these steps.
You also need to install MySQL.
-Ensure that you are using Python version 3.9, 3.10 or 3.11, then proceed with:
+Ensure that you are using Python version 3.11 or 3.12, then proceed with:
```bash
# Create a virtual environment and activate it (recommended)
diff --git a/docs/developer_docs/contributing/issue-reporting.md b/docs/developer_docs/contributing/issue-reporting.md
index 3bf1de8dc90..969a1b14757 100644
--- a/docs/developer_docs/contributing/issue-reporting.md
+++ b/docs/developer_docs/contributing/issue-reporting.md
@@ -82,7 +82,7 @@ If applicable, add screenshots or recordings.
### Environment
- Superset version: [e.g., 3.0.0]
-- Python version: [e.g., 3.9.7]
+- Python version: [e.g., 3.11.7]
- Node version: [e.g., 18.17.0]
- Database: [e.g., PostgreSQL 14]
- Browser: [e.g., Chrome 120]
@@ -125,7 +125,7 @@ No error messages in browser console or server logs.
### Environment
- Superset version: 3.0.0
-- Python version: 3.9.16
+- Python version: 3.11.16
- Database: PostgreSQL 14.9
- Browser: Chrome 120.0.6099.71
- OS: macOS 14.2
diff --git a/docs/developer_docs/index.md b/docs/developer_docs/index.md
index 2bfc2bba9ca..de1a5f39f9d 100644
--- a/docs/developer_docs/index.md
+++ b/docs/developer_docs/index.md
@@ -52,7 +52,7 @@ Everything you need to contribute to the Apache Superset project. This section i
## Development Resources
### Prerequisites
-- **Python**: 3.9, 3.10, or 3.11
+- **Python**: 3.11 or 3.12
- **Node.js**: 18.x or 20.x
- **npm**: 9.x or 10.x
- **Git**: Basic understanding
diff --git a/pyproject.toml b/pyproject.toml
index 81a299759db..9d1f47dae9c 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -24,13 +24,12 @@ name = "apache_superset"
description = "A modern, enterprise-ready business intelligence web application"
readme = "README.md"
dynamic = ["version", "scripts", "entry-points"]
-requires-python = ">=3.10"
+requires-python = ">=3.11"
license = { file="LICENSE.txt" }
authors = [
{ name = "Apache Software Foundation", email = "dev@superset.apache.org" },
]
classifiers = [
- "Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
@@ -167,7 +166,6 @@ gevent = ["gevent>=26.4.0"]
gsheets = ["shillelagh[gsheetsapi]>=1.4.4, <2"]
hana = ["hdbcli==2.28.21", "sqlalchemy_hana==3.0.3"]
hive = [
- "pyhive[hive]>=0.6.5;python_version<'3.11'",
"pyhive[hive_pure_sasl]>=0.7.0",
"tableschema",
"thrift>=0.23.0, <1.0.0",
@@ -201,7 +199,6 @@ singlestore = ["sqlalchemy-singlestoredb>=1.2.1, <2"]
snowflake = ["snowflake-sqlalchemy>=1.10.2, <2"]
sqlite = ["syntaqlite>=0.6.0,<0.7.0"]
spark = [
- "pyhive[hive]>=0.6.5;python_version<'3.11'",
"pyhive[hive_pure_sasl]>=0.7",
"tableschema",
"thrift>=0.23.0, <1",
@@ -344,8 +341,8 @@ exclude = [
line-length = 88
indent-width = 4
-# Assume Python 3.10
-target-version = "py310"
+# Assume Python 3.11
+target-version = "py311"
[tool.ruff.lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
diff --git a/scripts/check-env.py b/scripts/check-env.py
index e7816fb585d..830d7a3cc29 100755
--- a/scripts/check-env.py
+++ b/scripts/check-env.py
@@ -133,8 +133,8 @@ def main(docker: bool, frontend: bool, backend: bool) -> None: # noqa: C901
requirements = [
Requirement(
"python",
- (Version("3.10.0"), Version("3.10.999")),
- (Version("3.9.0"), Version("3.11.999")),
+ (Version("3.11.0"), Version("3.11.999")),
+ (Version("3.11.0"), Version("3.12.999")),
"backend",
"python --version",
),
diff --git a/superset-core/README.md b/superset-core/README.md
index 61fefbac142..22961497fa5 100644
--- a/superset-core/README.md
+++ b/superset-core/README.md
@@ -21,7 +21,7 @@ under the License.
[](https://badge.fury.io/py/apache-superset-core)
[](https://opensource.org/licenses/Apache-2.0)
-[](https://www.python.org/downloads/)
+[](https://www.python.org/downloads/)
The official core package for building Apache Superset backend extensions and integrations. This package provides essential building blocks including base classes, API utilities, type definitions, and decorators for both the host application and extensions.
diff --git a/superset-core/pyproject.toml b/superset-core/pyproject.toml
index 22b684f1947..74d178fc951 100644
--- a/superset-core/pyproject.toml
+++ b/superset-core/pyproject.toml
@@ -26,7 +26,7 @@ authors = [
]
license = "Apache-2.0"
license-files = ["LICENSE.txt"]
-requires-python = ">=3.10"
+requires-python = ">=3.11"
keywords = ["superset", "apache", "analytics", "business-intelligence", "extensions", "visualization"]
classifiers = [
"Development Status :: 3 - Alpha",
@@ -34,7 +34,6 @@ classifiers = [
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
- "Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Database",
diff --git a/superset-extensions-cli/README.md b/superset-extensions-cli/README.md
index a5143a80ba3..4750ece4db6 100644
--- a/superset-extensions-cli/README.md
+++ b/superset-extensions-cli/README.md
@@ -21,7 +21,7 @@ under the License.
[](https://badge.fury.io/py/apache-superset-extensions-cli)
[](https://opensource.org/licenses/Apache-2.0)
-[](https://www.python.org/downloads/)
+[](https://www.python.org/downloads/)
Official command-line interface for building, bundling, and managing Apache Superset extensions. This CLI tool provides developers with everything needed to create, develop, and package extensions for the Superset ecosystem.
diff --git a/superset-extensions-cli/pyproject.toml b/superset-extensions-cli/pyproject.toml
index 99f4ca0fd52..a7865556b70 100644
--- a/superset-extensions-cli/pyproject.toml
+++ b/superset-extensions-cli/pyproject.toml
@@ -25,7 +25,7 @@ authors = [
]
license = "Apache-2.0"
license-files = ["LICENSE.txt"]
-requires-python = ">=3.10"
+requires-python = ">=3.11"
keywords = ["superset", "apache", "cli", "extensions", "analytics", "business-intelligence", "development-tools"]
classifiers = [
"Development Status :: 3 - Alpha",
@@ -33,7 +33,6 @@ classifiers = [
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
- "Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Database",
diff --git a/superset/app.py b/superset/app.py
index 3b90d74b3d7..1ba24a1139c 100644
--- a/superset/app.py
+++ b/superset/app.py
@@ -18,21 +18,12 @@ from __future__ import annotations
import logging
import os
-import sys
from typing import cast, Iterable, Optional
+from wsgiref.types import StartResponse, WSGIApplication, WSGIEnvironment
from alembic.config import Config
from alembic.runtime.migration import MigrationContext
from alembic.script import ScriptDirectory
-
-if sys.version_info >= (3, 11):
- from wsgiref.types import StartResponse, WSGIApplication, WSGIEnvironment
-else:
- from typing import TYPE_CHECKING
-
- if TYPE_CHECKING:
- from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment
-
from flask import Flask, Response
from werkzeug.exceptions import NotFound
@@ -100,12 +91,8 @@ def create_app(
# because legacy bookmarks exist under root deployments too.
# See the "Layering invariant" section of the module docstring
# in `superset/middleware/legacy_prefix_redirect.py`.
- # mypy reads `app.wsgi_app` as `object` after the conditional
- # `AppRootMiddleware` rewrap above — the LUB of the two branches
- # widens it. The runtime type is always a WSGI callable; the
- # `# type: ignore` is intentional.
app.wsgi_app = LegacyPrefixRedirectMiddleware(
- app.wsgi_app, # type: ignore[arg-type]
+ app.wsgi_app,
app_root,
)
diff --git a/superset/mcp_service/README.md b/superset/mcp_service/README.md
index d1b4eed9e7b..b9599632fda 100644
--- a/superset/mcp_service/README.md
+++ b/superset/mcp_service/README.md
@@ -84,7 +84,7 @@ If Docker is not available, you can set up manually:
git clone https://github.com/apache/superset.git
cd superset
-# 2. Set up Python environment (Python 3.10 or 3.11 required)
+# 2. Set up Python environment (Python 3.11 or 3.12 required)
python3 -m venv venv
source venv/bin/activate
diff --git a/superset/middleware/legacy_prefix_redirect.py b/superset/middleware/legacy_prefix_redirect.py
index 84c9d9b2447..86122624a01 100644
--- a/superset/middleware/legacy_prefix_redirect.py
+++ b/superset/middleware/legacy_prefix_redirect.py
@@ -58,20 +58,12 @@ closed-set discipline.
from __future__ import annotations
import re
-import sys
from typing import Iterable, Optional
from urllib.parse import quote
+from wsgiref.types import StartResponse, WSGIApplication, WSGIEnvironment
from werkzeug.wrappers import Response
-if sys.version_info >= (3, 11):
- from wsgiref.types import StartResponse, WSGIApplication, WSGIEnvironment
-else:
- from typing import TYPE_CHECKING
-
- if TYPE_CHECKING:
- from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment
-
#: The legacy URL token the shim recognises. Hard-coded — not configurable.
_LEGACY_PREFIX: str = "/superset"
diff --git a/superset/utils/backports.py b/superset/utils/backports.py
index b48f76d2353..14c705a235c 100644
--- a/superset/utils/backports.py
+++ b/superset/utils/backports.py
@@ -14,13 +14,4 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-import sys
-from enum import Enum
-
-if sys.version_info >= (3, 11):
- # pylint: disable=unused-import
- from enum import StrEnum # nopycln: import
-else:
-
- class StrEnum(str, Enum):
- pass
+from enum import StrEnum # noqa: F401