From 0d0e47acf796fe289e9c47c21506f427204d8f45 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 1 Apr 2024 20:00:42 -0700 Subject: [PATCH] =?UTF-8?q?chore(=F0=9F=A6=BE):=20bump=20python=20flask-se?= =?UTF-8?q?ssion=200.5.0=20->=200.8.0=20(#27751)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: GitHub Action Co-authored-by: Maxime Beauchemin --- UPDATING.md | 3 +++ requirements/base.txt | 4 +++- superset/config.py | 6 +++--- superset/models/slice.py | 8 ++++---- tests/integration_tests/charts/commands_tests.py | 7 ++++--- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/UPDATING.md b/UPDATING.md index 040196c69..459cc4e45 100644 --- a/UPDATING.md +++ b/UPDATING.md @@ -35,6 +35,9 @@ assists people when migrating to a new version. files for production use cases! While we never really supported or should have tried to support docker-compose for production use cases, we now actively have taken a stance against supporting it. See the PR for details. +- [27697](https://github.com/apache/superset/pull/27697) [minor] flask-session bump leads to them + deprecating `SESSION_USE_SIGNER`, check your configs as this flag won't do anything moving + forward. ### Breaking Changes diff --git a/requirements/base.txt b/requirements/base.txt index ea0f90024..f5318071b 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -126,7 +126,7 @@ flask-login==0.6.3 # flask-appbuilder flask-migrate==3.1.0 # via apache-superset -flask-session==0.5.0 +flask-session==0.8.0 # via apache-superset flask-sqlalchemy==2.5.1 # via @@ -214,6 +214,8 @@ mdurl==0.1.2 # via markdown-it-py msgpack==1.0.8 # via apache-superset +msgspec==0.18.6 + # via flask-session nh3==0.2.17 # via apache-superset numba==0.57.1 diff --git a/superset/config.py b/superset/config.py index 2f6ce1369..0d00fedfb 100644 --- a/superset/config.py +++ b/superset/config.py @@ -20,6 +20,7 @@ All configuration in this file can be overridden by providing a superset_config in your PYTHONPATH as there is a ``from superset_config import *`` at the end of this file. """ +# mypy: ignore-errors # pylint: disable=too-many-lines from __future__ import annotations @@ -940,7 +941,7 @@ class CeleryConfig: # pylint: disable=too-few-public-methods } -CELERY_CONFIG = CeleryConfig # pylint: disable=invalid-name +CELERY_CONFIG: type[CeleryConfig] = CeleryConfig # Set celery config to None to disable all the above configuration # CELERY_CONFIG = None @@ -1474,7 +1475,6 @@ SESSION_SERVER_SIDE = False # from flask_session import RedisSessionInterface # # SESSION_SERVER_SIDE = True -# SESSION_USE_SIGNER = True # SESSION_TYPE = "redis" # SESSION_REDIS = Redis(host="localhost", port=6379, db=0) # @@ -1704,7 +1704,7 @@ elif importlib.util.find_spec("superset_config") and not is_test(): try: # pylint: disable=import-error,wildcard-import,unused-wildcard-import import superset_config - from superset_config import * # type: ignore + from superset_config import * # noqa: F403, F401 print(f"Loaded your LOCAL configuration at [{superset_config.__file__}]") except Exception: diff --git a/superset/models/slice.py b/superset/models/slice.py index eb2b220c8..4b1cef7e4 100644 --- a/superset/models/slice.py +++ b/superset/models/slice.py @@ -51,7 +51,7 @@ from superset.viz import BaseViz, viz_types if TYPE_CHECKING: from superset.common.query_context import QueryContext from superset.common.query_context_factory import QueryContextFactory - from superset.connectors.sqla.models import BaseDatasource + from superset.connectors.sqla.models import SqlaTable metadata = Model.metadata # pylint: disable=no-member slice_user = Table( @@ -139,14 +139,14 @@ class Slice( # pylint: disable=too-many-public-methods return self.slice_name or str(self.id) @property - def cls_model(self) -> type[BaseDatasource]: + def cls_model(self) -> type[SqlaTable]: # pylint: disable=import-outside-toplevel from superset.daos.datasource import DatasourceDAO return DatasourceDAO.sources[self.datasource_type] @property - def datasource(self) -> BaseDatasource | None: + def datasource(self) -> SqlaTable | None: return self.get_datasource def clone(self) -> Slice: @@ -163,7 +163,7 @@ class Slice( # pylint: disable=too-many-public-methods # pylint: disable=using-constant-test @datasource.getter # type: ignore - def get_datasource(self) -> BaseDatasource | None: + def get_datasource(self) -> SqlaTable | None: return ( db.session.query(self.cls_model) .filter_by(id=self.datasource_id) diff --git a/tests/integration_tests/charts/commands_tests.py b/tests/integration_tests/charts/commands_tests.py index 28f9d42d6..5d3a4986b 100644 --- a/tests/integration_tests/charts/commands_tests.py +++ b/tests/integration_tests/charts/commands_tests.py @@ -173,7 +173,7 @@ class TestExportChartsCommand(SupersetTestCase): class TestImportChartsCommand(SupersetTestCase): @patch("superset.utils.core.g") @patch("superset.security.manager.g") - def test_import_v1_chart(self, sm_g, utils_g): + def test_import_v1_chart(self, sm_g, utils_g) -> None: """Test that we can import a chart""" admin = sm_g.user = utils_g.user = security_manager.find_user("admin") contents = { @@ -192,7 +192,7 @@ class TestImportChartsCommand(SupersetTestCase): assert json.loads(chart.params) == { "annotation_layers": [], "color_picker": {"a": 1, "b": 135, "g": 122, "r": 0}, - "datasource": dataset.uid, + "datasource": dataset.uid if dataset else None, "js_columns": ["color"], "js_data_mutator": "data => data.map(d => ({\\n ...d,\\n color: colors.hexToRGB(d.extraProps.color)\\n}));", "js_onclick_href": "", @@ -228,7 +228,8 @@ class TestImportChartsCommand(SupersetTestCase): dataset = ( db.session.query(SqlaTable).filter_by(uuid=dataset_config["uuid"]).one() ) - assert dataset.table_name == "imported_dataset" + table_name = dataset.table_name if dataset else None + assert table_name == "imported_dataset" assert chart.table == dataset database = (