From e3719a1b076228dcfae3cdd82844bdfe48b552ec Mon Sep 17 00:00:00 2001 From: Sebastian Liebscher <112352529+sebastianliebscher@users.noreply.github.com> Date: Wed, 10 May 2023 19:21:56 +0200 Subject: [PATCH] feat: bump to Python3.9 (#23890) Co-authored-by: EugeneTorap --- .asf.yaml | 12 ++++++------ .github/workflows/docker_build_push.sh | 13 ++++++------- .github/workflows/superset-applitool-cypress.yml | 2 +- .github/workflows/superset-cli.yml | 2 +- .github/workflows/superset-e2e.yml | 2 +- .github/workflows/superset-helm-lint.yml | 2 +- .../workflows/superset-python-integrationtest.yml | 6 +++--- .github/workflows/superset-python-misc.yml | 6 +++--- .github/workflows/superset-python-presto-hive.yml | 4 ++-- .github/workflows/superset-python-unittest.yml | 2 +- .github/workflows/superset-translations.yml | 2 +- Dockerfile | 2 +- Makefile | 6 +++--- UPDATING.md | 1 + docs/docs/contributing/local-backend.mdx | 2 +- requirements/base.txt | 2 -- scripts/benchmark_migration.py | 6 +++--- setup.cfg | 2 +- setup.py | 4 +--- 19 files changed, 37 insertions(+), 41 deletions(-) diff --git a/.asf.yaml b/.asf.yaml index e9d16ae17e03..ab980e0c3fb2 100644 --- a/.asf.yaml +++ b/.asf.yaml @@ -66,12 +66,12 @@ github: - cypress-matrix (3, chrome) - docker-build - frontend-build -# - pre-commit (3.9) -# - python-lint (3.9) -# - test-mysql (3.9) -# - test-postgres (3.9) -# - test-postgres (3.10) -# - test-sqlite (3.9) + - pre-commit (3.9) + - python-lint (3.9) + - test-mysql (3.9) + - test-postgres (3.9) + - test-postgres (3.10) + - test-sqlite (3.9) required_pull_request_reviews: dismiss_stale_reviews: false diff --git a/.github/workflows/docker_build_push.sh b/.github/workflows/docker_build_push.sh index b969813627c5..642b9b53db6d 100755 --- a/.github/workflows/docker_build_push.sh +++ b/.github/workflows/docker_build_push.sh @@ -50,7 +50,6 @@ docker build --target lean \ -t "${REPO_NAME}:${SHA}" \ -t "${REPO_NAME}:${REFSPEC}" \ -t "${REPO_NAME}:${LATEST_TAG}" \ - --build-arg PY_VER="3.8-slim"\ --label "sha=${SHA}" \ --label "built_at=$(date)" \ --label "target=lean" \ @@ -58,16 +57,16 @@ docker build --target lean \ . # -# Build the "lean39" image +# Build the "lean310" image # docker build --target lean \ - -t "${REPO_NAME}:${SHA}-py39" \ - -t "${REPO_NAME}:${REFSPEC}-py39" \ - -t "${REPO_NAME}:${LATEST_TAG}-py39" \ - --build-arg PY_VER="3.9-slim"\ + -t "${REPO_NAME}:${SHA}-py310" \ + -t "${REPO_NAME}:${REFSPEC}-py310" \ + -t "${REPO_NAME}:${LATEST_TAG}-py310" \ + --build-arg PY_VER="3.10-slim"\ --label "sha=${SHA}" \ --label "built_at=$(date)" \ - --label "target=lean39" \ + --label "target=lean310" \ --label "build_actor=${GITHUB_ACTOR}" \ . diff --git a/.github/workflows/superset-applitool-cypress.yml b/.github/workflows/superset-applitool-cypress.yml index 2647d7a0689a..7222ed17d41c 100644 --- a/.github/workflows/superset-applitool-cypress.yml +++ b/.github/workflows/superset-applitool-cypress.yml @@ -60,7 +60,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: "3.8" + python-version: "3.9" - name: OS dependencies uses: ./.github/actions/cached-dependencies with: diff --git a/.github/workflows/superset-cli.yml b/.github/workflows/superset-cli.yml index 160c60965e5d..129ecc117abc 100644 --- a/.github/workflows/superset-cli.yml +++ b/.github/workflows/superset-cli.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - python-version: [3.9] + python-version: ["3.9"] env: PYTHONPATH: ${{ github.workspace }} SUPERSET_CONFIG: tests.integration_tests.superset_test_config diff --git a/.github/workflows/superset-e2e.yml b/.github/workflows/superset-e2e.yml index 3afdbe2cf345..e1b090a5f399 100644 --- a/.github/workflows/superset-e2e.yml +++ b/.github/workflows/superset-e2e.yml @@ -69,7 +69,7 @@ jobs: if: steps.check.outcome == 'failure' uses: actions/setup-python@v4 with: - python-version: "3.8" + python-version: "3.9" - name: OS dependencies if: steps.check.outcome == 'failure' uses: ./.github/actions/cached-dependencies diff --git a/.github/workflows/superset-helm-lint.yml b/.github/workflows/superset-helm-lint.yml index a0eca217969e..4bb888e15d74 100644 --- a/.github/workflows/superset-helm-lint.yml +++ b/.github/workflows/superset-helm-lint.yml @@ -22,7 +22,7 @@ jobs: - uses: actions/setup-python@v4 with: - python-version: 3.8 + python-version: "3.9" - name: Set up chart-testing uses: ./.github/actions/chart-testing-action diff --git a/.github/workflows/superset-python-integrationtest.yml b/.github/workflows/superset-python-integrationtest.yml index 7b3da06283a2..40096c2eb8ec 100644 --- a/.github/workflows/superset-python-integrationtest.yml +++ b/.github/workflows/superset-python-integrationtest.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - python-version: [3.8] + python-version: ["3.9"] env: PYTHONPATH: ${{ github.workspace }} SUPERSET_CONFIG: tests.integration_tests.superset_test_config @@ -80,7 +80,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - python-version: [3.8, 3.9] + python-version: ["3.9", "3.10"] env: PYTHONPATH: ${{ github.workspace }} SUPERSET_CONFIG: tests.integration_tests.superset_test_config @@ -147,7 +147,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - python-version: [3.8] + python-version: ["3.9"] env: PYTHONPATH: ${{ github.workspace }} SUPERSET_CONFIG: tests.integration_tests.superset_test_config diff --git a/.github/workflows/superset-python-misc.yml b/.github/workflows/superset-python-misc.yml index bb284a58ab2e..400c217ed426 100644 --- a/.github/workflows/superset-python-misc.yml +++ b/.github/workflows/superset-python-misc.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - python-version: [3.8] + python-version: ["3.9"] steps: - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v3 @@ -54,7 +54,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - python-version: [3.8] + python-version: ["3.9"] steps: - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v3 @@ -95,7 +95,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - python-version: [3.8] + python-version: ["3.9"] steps: - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v3 diff --git a/.github/workflows/superset-python-presto-hive.yml b/.github/workflows/superset-python-presto-hive.yml index f817b32df03f..934954984844 100644 --- a/.github/workflows/superset-python-presto-hive.yml +++ b/.github/workflows/superset-python-presto-hive.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - python-version: [3.8] + python-version: ["3.9"] env: PYTHONPATH: ${{ github.workspace }} SUPERSET_CONFIG: tests.integration_tests.superset_test_config @@ -91,7 +91,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - python-version: [3.8] + python-version: ["3.9"] 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 ad620d322733..3fdc315b0264 100644 --- a/.github/workflows/superset-python-unittest.yml +++ b/.github/workflows/superset-python-unittest.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - python-version: [3.8, 3.9] + python-version: ["3.9", "3.10"] env: PYTHONPATH: ${{ github.workspace }} steps: diff --git a/.github/workflows/superset-translations.yml b/.github/workflows/superset-translations.yml index 65641a8b67f0..c903b9226940 100644 --- a/.github/workflows/superset-translations.yml +++ b/.github/workflows/superset-translations.yml @@ -35,7 +35,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - python-version: [3.8] + python-version: ["3.9"] steps: - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v3 diff --git a/Dockerfile b/Dockerfile index aa83ff5fdb9d..0745294b4537 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,7 @@ ###################################################################### # Node stage to deal with static asset construction ###################################################################### -ARG PY_VER=3.8.16-slim +ARG PY_VER=3.9.16-slim # if BUILDPLATFORM is null, set it to 'amd64' (or leave as is otherwise). ARG BUILDPLATFORM=${BUILDPLATFORM:-amd64} diff --git a/Makefile b/Makefile index fbe0fc8bfcb1..14e7bb17efda 100644 --- a/Makefile +++ b/Makefile @@ -15,8 +15,8 @@ # limitations under the License. # -# Python version installed; we need 3.8-3.11 -PYTHON=`command -v python3.11 || command -v python3.10 || command -v python3.9 || command -v python3.8` +# Python version installed; we need 3.9-3.11 +PYTHON=`command -v python3.11 || command -v python3.10 || command -v python3.9` .PHONY: install superset venv pre-commit @@ -70,7 +70,7 @@ update-js: venv: # Create a virtual environment and activate it (recommended) - if ! [ -x "${PYTHON}" ]; then echo "You need Python 3.8, 3.9, 3.10 or 3.11 installed"; exit 1; fi + if ! [ -x "${PYTHON}" ]; then echo "You need Python 3.9, 3.10 or 3.11 installed"; exit 1; fi test -d venv || ${PYTHON} -m venv venv # setup a python3 virtualenv . venv/bin/activate diff --git a/UPDATING.md b/UPDATING.md index 1d5f9385150c..b001ffc46731 100644 --- a/UPDATING.md +++ b/UPDATING.md @@ -46,6 +46,7 @@ assists people when migrating to a new version. - [21163](https://github.com/apache/superset/pull/21163): The time grain will be decoupled from the time filter column and the time grain control will move below the X-Axis control when `GENERIC_CHART_AXES` feature flags set to `True`. The time grain will be applied on the time column in the column-like controls(x axis, dimensions) instead of the time column in the time section. - [21284](https://github.com/apache/superset/pull/21284): The non-functional `MAX_TABLE_NAMES` config key has been removed. - [21794](https://github.com/apache/superset/pull/21794): Deprecates the undocumented `PRESTO_SPLIT_VIEWS_FROM_TABLES` feature flag. Now for Presto, like other engines, only physical tables are treated as tables. +- [23890](https://github.com/apache/superset/pull/23890): Removes Python 3.8 support. ### Breaking Changes diff --git a/docs/docs/contributing/local-backend.mdx b/docs/docs/contributing/local-backend.mdx index 36d4586fe0cc..5056f167369d 100644 --- a/docs/docs/contributing/local-backend.mdx +++ b/docs/docs/contributing/local-backend.mdx @@ -12,7 +12,7 @@ version: 1 Make sure your machine meets the [OS dependencies](https://superset.apache.org/docs/installation/installing-superset-from-scratch#os-dependencies) before following these steps. You also need to install MySQL or [MariaDB](https://mariadb.com/downloads). -Ensure that you are using Python version 3.8 or 3.9, then proceed with: +Ensure that you are using Python version 3.9 or 3.10, then proceed with: ```bash # Create a virtual environment and activate it (recommended) diff --git a/requirements/base.txt b/requirements/base.txt index 3e7b872dc3c8..720a77d57cf4 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -122,8 +122,6 @@ geographiclib==1.52 # via geopy geopy==2.2.0 # via apache-superset -graphlib-backport==1.0.3 - # via apache-superset greenlet==2.0.2 # via sqlalchemy gunicorn==20.1.0 diff --git a/scripts/benchmark_migration.py b/scripts/benchmark_migration.py index baae8befec1b..83c06456a102 100644 --- a/scripts/benchmark_migration.py +++ b/scripts/benchmark_migration.py @@ -19,16 +19,16 @@ import re import time from collections import defaultdict +from graphlib import TopologicalSorter from inspect import getsource from pathlib import Path from types import ModuleType -from typing import Dict, List, Set, Type +from typing import Any, Dict, List, Set, Type import click from flask import current_app from flask_appbuilder import Model from flask_migrate import downgrade, upgrade -from graphlib import TopologicalSorter # pylint: disable=wrong-import-order from progress.bar import ChargingBar from sqlalchemy import create_engine, inspect from sqlalchemy.ext.automap import automap_base @@ -120,7 +120,7 @@ def find_models(module: ModuleType) -> List[Type[Model]]: # sort topologically so we can create entities in order and # maintain relationships (eg, create a database before creating # a slice) - sorter = TopologicalSorter() + sorter: TopologicalSorter[Any] = TopologicalSorter() for model in models: inspector = inspect(model) dependent_tables: List[str] = [] diff --git a/setup.cfg b/setup.cfg index 970fd4ca8246..41db2332abc0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -30,7 +30,7 @@ combine_as_imports = true include_trailing_comma = true line_length = 88 known_first_party = superset -known_third_party =alembic,apispec,backoff,cachelib,celery,click,colorama,cron_descriptor,croniter,cryptography,dateutil,deprecation,flask,flask_appbuilder,flask_babel,flask_caching,flask_compress,flask_jwt_extended,flask_login,flask_migrate,flask_sqlalchemy,flask_talisman,flask_testing,flask_wtf,freezegun,geohash,geopy,graphlib,holidays,humanize,isodate,jinja2,jwt,markdown,markupsafe,marshmallow,marshmallow_enum,msgpack,nh3,numpy,pandas,parameterized,parsedatetime,pgsanity,pkg_resources,polyline,prison,progress,pyarrow,sqlalchemy_bigquery,pyhive,pyparsing,pytest,pytest_mock,pytz,redis,requests,selenium,setuptools,simplejson,slack,sqlalchemy,sqlalchemy_utils,sqlparse,typing_extensions,urllib3,werkzeug,wtforms,wtforms_json,yaml +known_third_party =alembic,apispec,backoff,cachelib,celery,click,colorama,cron_descriptor,croniter,cryptography,dateutil,deprecation,flask,flask_appbuilder,flask_babel,flask_caching,flask_compress,flask_jwt_extended,flask_login,flask_migrate,flask_sqlalchemy,flask_talisman,flask_testing,flask_wtf,freezegun,geohash,geopy,holidays,humanize,isodate,jinja2,jwt,markdown,markupsafe,marshmallow,marshmallow_enum,msgpack,nh3,numpy,pandas,parameterized,parsedatetime,pgsanity,pkg_resources,polyline,prison,progress,pyarrow,sqlalchemy_bigquery,pyhive,pyparsing,pytest,pytest_mock,pytz,redis,requests,selenium,setuptools,simplejson,slack,sqlalchemy,sqlalchemy_utils,sqlparse,typing_extensions,urllib3,werkzeug,wtforms,wtforms_json,yaml multi_line_output = 3 order_by_type = false diff --git a/setup.py b/setup.py index e20c1eb07e78..bc99c2695957 100644 --- a/setup.py +++ b/setup.py @@ -92,7 +92,6 @@ def get_git_sha() -> str: "flask-wtf>=1.0.1, <1.1", "func_timeout", "geopy", - "graphlib-backport", "gunicorn>=20.1.0; sys_platform != 'win32'", "hashids>=1.3.1, <2", "holidays>=0.23, <0.24", @@ -186,13 +185,12 @@ def get_git_sha() -> str: "vertica": ["sqlalchemy-vertica-python>=0.5.9, < 0.6"], "netezza": ["nzalchemy>=11.0.2"], }, - python_requires="~=3.8", + python_requires="~=3.9", author="Apache Software Foundation", author_email="dev@superset.apache.org", url="https://superset.apache.org/", download_url="https://www.apache.org/dist/superset/" + version_string, classifiers=[ - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11",