You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2020/03/13 19:36:29 UTC

[incubator-superset] branch master updated: fix: bump click in setup.py and requirements.txt (#9299)

This is an automated email from the ASF dual-hosted git repository.

villebro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 91f3cb9  fix: bump click in setup.py and requirements.txt (#9299)
91f3cb9 is described below

commit 91f3cb98785cf0a55c407be0392b708f35a4c596
Author: Ville Brofeldt <33...@users.noreply.github.com>
AuthorDate: Fri Mar 13 21:36:16 2020 +0200

    fix: bump click in setup.py and requirements.txt (#9299)
    
    * bump click
    
    * add token_normalize_func to click cli decorator
---
 requirements.txt |  2 +-
 setup.py         |  2 +-
 superset/cli.py  | 19 ++++++++++++++++++-
 3 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/requirements.txt b/requirements.txt
index dc2459b..2d7edb0 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -14,7 +14,7 @@ billiard==3.6.3.0         # via celery
 bleach==3.1.0             # via apache-superset (setup.py)
 celery==4.4.1             # via apache-superset (setup.py)
 cffi==1.13.2              # via cryptography
-click==6.7                # via apache-superset (setup.py), flask, flask-appbuilder
+click==7.1.1              # via apache-superset (setup.py), flask, flask-appbuilder
 colorama==0.4.3           # via apache-superset (setup.py), flask-appbuilder
 contextlib2==0.6.0.post1  # via apache-superset (setup.py)
 croniter==0.3.31          # via apache-superset (setup.py)
diff --git a/setup.py b/setup.py
index 915ee6c..7cc6a4b 100644
--- a/setup.py
+++ b/setup.py
@@ -70,7 +70,7 @@ setup(
         "backoff>=1.8.0",
         "bleach>=3.0.2, <4.0.0",
         "celery>=4.3.0, <5.0.0",
-        "click>=6.0, <7.0.0",  # `click`>=7 forces "-" instead of "_"
+        "click<8",
         "colorama",
         "contextlib2",
         "croniter>=0.3.28",
diff --git a/superset/cli.py b/superset/cli.py
index 013a7a8..c6cdc45 100755
--- a/superset/cli.py
+++ b/superset/cli.py
@@ -36,7 +36,24 @@ from superset.utils import core as utils
 logger = logging.getLogger(__name__)
 
 
-@click.group(cls=FlaskGroup, create_app=create_app)
+def normalize_token(token_name: str) -> str:
+    """
+    As of click>=7, underscores in function names are replaced by dashes.
+    To avoid the need to rename all cli functions, e.g. load_examples to
+    load-examples, this function is used to convert dashes back to
+    underscores.
+
+    :param token_name: token name possibly containing dashes
+    :return: token name where dashes are replaced with underscores
+    """
+    return token_name.replace("_", "-")
+
+
+@click.group(
+    cls=FlaskGroup,
+    create_app=create_app,
+    context_settings={"token_normalize_func": normalize_token},
+)
 @with_appcontext
 def superset():
     """This is a management script for the Superset application."""