You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/01/19 01:08:53 UTC

[GitHub] [superset] betodealmeida opened a new pull request #18082: chore: split CLI into multiple files

betodealmeida opened a new pull request #18082:
URL: https://github.com/apache/superset/pull/18082


   <!---
   Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
   Example:
   fix(dashboard): load charts correctly
   -->
   
   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   
   This PR splits the `superset/cli.py` file into multiple commands.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   
   Before:
   
   ```
   % superset --help
   Loaded your LOCAL configuration at [/Users/beto/Projects/incubator-superset/superset_config.py]
   --------------------------------------------------------------------------------
                                       WARNING
   --------------------------------------------------------------------------------
   A Default SECRET_KEY was detected, please use superset_config.py to override it.
   Use a strong complex alphanumeric string and use a tool to help you generate
   a sufficiently random sequence, ex: openssl rand -base64 42
   --------------------------------------------------------------------------------
   --------------------------------------------------------------------------------
   logging was configured successfully
   2022-01-18 17:06:25,085:INFO:superset.utils.logging_configurator:logging was configured successfully
   2022-01-18 17:06:25,092:INFO:root:Configured event logger of type <class 'superset.utils.log.DBEventLogger'>
   2022-01-18 17:06:26,509:WARNING:root:ENABLE_SCHEDULED_EMAIL_REPORTS is deprecated and will be removed in version 2.0.0
   2022-01-18 17:06:26,523:WARNING:root:ENABLE_ALERTS is deprecated and will be removed in version 2.0.0
   Usage: superset [OPTIONS] COMMAND [ARGS]...
   
     This is a management script for the Superset application.
   
   Options:
     --version  Show the flask version
     --help     Show this message and exit.
   
   Commands:
     alert                     Run the alert scheduler loop
     compute-thumbnails        Compute thumbnails
     db                        Perform database migrations.
     export-dashboards         Export dashboards to ZIP file
     export-datasources        Export datasources to ZIP file
     fab                       FAB flask group commands
     flower                    Runs a Celery Flower web server Celery Flower
                               is...
   
     import-dashboards         Import dashboards from ZIP file
     import-datasources        Import datasources from ZIP file
     import-directory          Imports configs from a given directory
     init                      Inits the Superset application
     load-examples             Loads a set of Slices and Dashboards and a...
     load-test-users           Loads admin, alpha, and gamma user for testing...
     re-encrypt-secrets
     refresh-druid             Refresh druid datasources
     routes                    Show the routes for the app.
     run                       Run a development server.
     set-database-uri          Updates a database connection URI
     shell                     Run a shell in the app context.
     sync-tags                 Rebuilds special tags (owner, type, favorited...
     update-api-docs           Regenerate the openapi.json file in docs
     update-datasources-cache  Refresh sqllab datasources cache
     version                   Prints the current version number
     worker                    Starts a Superset worker for async SQL query...
   ```
   
   After:
   
   ```
   % superset --help
   Loaded your LOCAL configuration at [/Users/beto/Projects/incubator-superset/superset_config.py]
   --------------------------------------------------------------------------------
                                       WARNING
   --------------------------------------------------------------------------------
   A Default SECRET_KEY was detected, please use superset_config.py to override it.
   Use a strong complex alphanumeric string and use a tool to help you generate
   a sufficiently random sequence, ex: openssl rand -base64 42
   --------------------------------------------------------------------------------
   --------------------------------------------------------------------------------
   logging was configured successfully
   2022-01-18 17:05:24,845:INFO:superset.utils.logging_configurator:logging was configured successfully
   2022-01-18 17:05:24,855:INFO:root:Configured event logger of type <class 'superset.utils.log.DBEventLogger'>
   2022-01-18 17:05:26,370:WARNING:root:ENABLE_SCHEDULED_EMAIL_REPORTS is deprecated and will be removed in version 2.0.0
   2022-01-18 17:05:26,385:WARNING:root:ENABLE_ALERTS is deprecated and will be removed in version 2.0.0
   Usage: superset [OPTIONS] COMMAND [ARGS]...
   
     This is a management script for the Superset application.
   
   Options:
     --version  Show the flask version
     --help     Show this message and exit.
   
   Commands:
     alert                     Run the alert scheduler loop
     compute-thumbnails        Compute thumbnails
     db                        Perform database migrations.
     export-dashboards         Export dashboards to ZIP file
     export-datasources        Export datasources to ZIP file
     fab                       FAB flask group commands
     flower                    Runs a Celery Flower web server Celery Flower
                               is...
   
     import-dashboards         Import dashboards from ZIP file
     import-datasources        Import datasources from ZIP file
     import-directory          Imports configs from a given directory
     init                      Inits the Superset application
     load-examples             Loads a set of Slices and Dashboards and a...
     load-test-users           Loads admin, alpha, and gamma user for testing...
     re-encrypt-secrets
     refresh-druid             Refresh druid datasources
     routes                    Show the routes for the app.
     run                       Run a development server.
     set-database-uri          Updates a database connection URI
     shell                     Run a shell in the app context.
     sync-tags                 Rebuilds special tags (owner, type, favorited...
     update-api-docs           Regenerate the openapi.json file in docs
     update-datasources-cache  Refresh sqllab datasources cache
     version                   Prints the current version number
     worker                    Starts a Superset worker for async SQL query...
   ```
   
   ### TESTING INSTRUCTIONS
   <!--- Required! What steps can be taken to manually verify the changes? -->
   
   Nothing should have changed, and all superset commands should run as before.
   
   I tested `init`, `db upgrade`, and `version`.
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] betodealmeida merged pull request #18082: chore: split CLI into multiple files

Posted by GitBox <gi...@apache.org>.
betodealmeida merged pull request #18082:
URL: https://github.com/apache/superset/pull/18082


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] betodealmeida commented on a change in pull request #18082: chore: split CLI into multiple files

Posted by GitBox <gi...@apache.org>.
betodealmeida commented on a change in pull request #18082:
URL: https://github.com/apache/superset/pull/18082#discussion_r787974338



##########
File path: superset/cli/main.py
##########
@@ -0,0 +1,90 @@
+#!/usr/bin/env python
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+import logging
+from typing import Any, Dict
+
+import click
+from colorama import Fore, Style
+from flask.cli import FlaskGroup, with_appcontext
+
+from superset import app, appbuilder, security_manager
+from superset.cli import celery, examples, importexport, test, thumbnails, update
+from superset.cli.lib import feature_flags, normalize_token
+from superset.extensions import db
+
+logger = logging.getLogger(__name__)
+
+
+@click.group(
+    cls=FlaskGroup, context_settings={"token_normalize_func": normalize_token},
+)
+@with_appcontext
+def superset() -> None:
+    """This is a management script for the Superset application."""
+
+    @app.shell_context_processor
+    def make_shell_context() -> Dict[str, Any]:
+        return dict(app=app, db=db)
+
+
+# add sub-commands
+superset.add_command(celery.flower)

Review comment:
       Right, but I don't think that would work here.
   
   For example, in `cli/celery.py` we could try this:
   
   ```python
   from superset.cli.main import superset
   
   @superset.command()  # instead of @click.command
   def some_command():
       ...
   ```
   
   But the command wouldn't be registered until we explicitly import the `cli.celery` module. So we'd have to add this to `cli/main.py`:
   
   ```python
   from superset.cli import celery
   ```
   
   So we'd have an import that is needed because of an implicit side effect, which IMHO is worse than explicitly having to register everything.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] dpgaspar commented on a change in pull request #18082: chore: split CLI into multiple files

Posted by GitBox <gi...@apache.org>.
dpgaspar commented on a change in pull request #18082:
URL: https://github.com/apache/superset/pull/18082#discussion_r787916354



##########
File path: superset/cli/main.py
##########
@@ -0,0 +1,90 @@
+#!/usr/bin/env python
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+import logging
+from typing import Any, Dict
+
+import click
+from colorama import Fore, Style
+from flask.cli import FlaskGroup, with_appcontext
+
+from superset import app, appbuilder, security_manager
+from superset.cli import celery, examples, importexport, test, thumbnails, update
+from superset.cli.lib import feature_flags, normalize_token
+from superset.extensions import db
+
+logger = logging.getLogger(__name__)
+
+
+@click.group(
+    cls=FlaskGroup, context_settings={"token_normalize_func": normalize_token},
+)
+@with_appcontext
+def superset() -> None:
+    """This is a management script for the Superset application."""
+
+    @app.shell_context_processor
+    def make_shell_context() -> Dict[str, Any]:
+        return dict(app=app, db=db)
+
+
+# add sub-commands
+superset.add_command(celery.flower)

Review comment:
       previously we only needed to add has a decorator `superset.command`. No need to issue `superset.add_command(<Callable>)`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] dpgaspar commented on a change in pull request #18082: chore: split CLI into multiple files

Posted by GitBox <gi...@apache.org>.
dpgaspar commented on a change in pull request #18082:
URL: https://github.com/apache/superset/pull/18082#discussion_r787916354



##########
File path: superset/cli/main.py
##########
@@ -0,0 +1,90 @@
+#!/usr/bin/env python
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+import logging
+from typing import Any, Dict
+
+import click
+from colorama import Fore, Style
+from flask.cli import FlaskGroup, with_appcontext
+
+from superset import app, appbuilder, security_manager
+from superset.cli import celery, examples, importexport, test, thumbnails, update
+from superset.cli.lib import feature_flags, normalize_token
+from superset.extensions import db
+
+logger = logging.getLogger(__name__)
+
+
+@click.group(
+    cls=FlaskGroup, context_settings={"token_normalize_func": normalize_token},
+)
+@with_appcontext
+def superset() -> None:
+    """This is a management script for the Superset application."""
+
+    @app.shell_context_processor
+    def make_shell_context() -> Dict[str, Any]:
+        return dict(app=app, db=db)
+
+
+# add sub-commands
+superset.add_command(celery.flower)

Review comment:
       previously we only needed to add has a decorator `superset.command`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] dpgaspar commented on a change in pull request #18082: chore: split CLI into multiple files

Posted by GitBox <gi...@apache.org>.
dpgaspar commented on a change in pull request #18082:
URL: https://github.com/apache/superset/pull/18082#discussion_r787876159



##########
File path: superset/cli/main.py
##########
@@ -0,0 +1,90 @@
+#!/usr/bin/env python
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+import logging
+from typing import Any, Dict
+
+import click
+from colorama import Fore, Style
+from flask.cli import FlaskGroup, with_appcontext
+
+from superset import app, appbuilder, security_manager
+from superset.cli import celery, examples, importexport, test, thumbnails, update
+from superset.cli.lib import feature_flags, normalize_token
+from superset.extensions import db
+
+logger = logging.getLogger(__name__)
+
+
+@click.group(
+    cls=FlaskGroup, context_settings={"token_normalize_func": normalize_token},
+)
+@with_appcontext
+def superset() -> None:
+    """This is a management script for the Superset application."""
+
+    @app.shell_context_processor
+    def make_shell_context() -> Dict[str, Any]:
+        return dict(app=app, db=db)
+
+
+# add sub-commands
+superset.add_command(celery.flower)

Review comment:
       kind of unfortunate we have to do this, since it's slightly harder to maintain. What's was the problem?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] codecov[bot] edited a comment on pull request #18082: chore: split CLI into multiple files

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #18082:
URL: https://github.com/apache/superset/pull/18082#issuecomment-1016768537


   # [Codecov](https://codecov.io/gh/apache/superset/pull/18082?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#18082](https://codecov.io/gh/apache/superset/pull/18082?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (6fc34e6) into [master](https://codecov.io/gh/apache/superset/commit/810cfc13db666ecb2da8d9e66b06ff6d2524c764?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (810cfc1) will **decrease** coverage by `0.18%`.
   > The diff coverage is `36.03%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/18082/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/18082?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #18082      +/-   ##
   ==========================================
   - Coverage   66.01%   65.83%   -0.19%     
   ==========================================
     Files        1570     1577       +7     
     Lines       61775    61828      +53     
     Branches     6244     6244              
   ==========================================
   - Hits        40780    40702      -78     
   - Misses      19395    19526     +131     
     Partials     1600     1600              
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `52.14% <18.62%> (-0.30%)` | :arrow_down: |
   | mysql | `?` | |
   | postgres | `81.07% <36.03%> (-0.36%)` | :arrow_down: |
   | presto | `51.99% <18.62%> (-0.30%)` | :arrow_down: |
   | python | `81.47% <36.03%> (-0.41%)` | :arrow_down: |
   | sqlite | `80.78% <36.03%> (-0.35%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/18082?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset/cli/celery.py](https://codecov.io/gh/apache/superset/pull/18082/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2xpL2NlbGVyeS5weQ==) | `0.00% <0.00%> (ø)` | |
   | [superset/cli/examples.py](https://codecov.io/gh/apache/superset/pull/18082/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2xpL2V4YW1wbGVzLnB5) | `0.00% <0.00%> (ø)` | |
   | [superset/cli/main.py](https://codecov.io/gh/apache/superset/pull/18082/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2xpL21haW4ucHk=) | `0.00% <0.00%> (ø)` | |
   | [superset/cli/thumbnails.py](https://codecov.io/gh/apache/superset/pull/18082/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2xpL3RodW1ibmFpbHMucHk=) | `0.00% <0.00%> (ø)` | |
   | [superset/cli/update.py](https://codecov.io/gh/apache/superset/pull/18082/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2xpL3VwZGF0ZS5weQ==) | `0.00% <0.00%> (ø)` | |
   | [superset/cli/lib.py](https://codecov.io/gh/apache/superset/pull/18082/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2xpL2xpYi5weQ==) | `61.53% <61.53%> (ø)` | |
   | [superset/cli/importexport.py](https://codecov.io/gh/apache/superset/pull/18082/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2xpL2ltcG9ydGV4cG9ydC5weQ==) | `72.43% <72.43%> (ø)` | |
   | [superset/cli/test.py](https://codecov.io/gh/apache/superset/pull/18082/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2xpL3Rlc3QucHk=) | `83.72% <83.72%> (ø)` | |
   | [superset/common/utils/dataframe\_utils.py](https://codecov.io/gh/apache/superset/pull/18082/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3V0aWxzL2RhdGFmcmFtZV91dGlscy5weQ==) | `85.71% <0.00%> (-7.15%)` | :arrow_down: |
   | [superset/db\_engine\_specs/mysql.py](https://codecov.io/gh/apache/superset/pull/18082/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL215c3FsLnB5) | `93.97% <0.00%> (-3.62%)` | :arrow_down: |
   | ... and [6 more](https://codecov.io/gh/apache/superset/pull/18082/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/18082?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/18082?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [810cfc1...6fc34e6](https://codecov.io/gh/apache/superset/pull/18082?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] betodealmeida commented on a change in pull request #18082: chore: split CLI into multiple files

Posted by GitBox <gi...@apache.org>.
betodealmeida commented on a change in pull request #18082:
URL: https://github.com/apache/superset/pull/18082#discussion_r787882172



##########
File path: superset/cli/main.py
##########
@@ -0,0 +1,90 @@
+#!/usr/bin/env python
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+import logging
+from typing import Any, Dict
+
+import click
+from colorama import Fore, Style
+from flask.cli import FlaskGroup, with_appcontext
+
+from superset import app, appbuilder, security_manager
+from superset.cli import celery, examples, importexport, test, thumbnails, update
+from superset.cli.lib import feature_flags, normalize_token
+from superset.extensions import db
+
+logger = logging.getLogger(__name__)
+
+
+@click.group(
+    cls=FlaskGroup, context_settings={"token_normalize_func": normalize_token},
+)
+@with_appcontext
+def superset() -> None:
+    """This is a management script for the Superset application."""
+
+    @app.shell_context_processor
+    def make_shell_context() -> Dict[str, Any]:
+        return dict(app=app, db=db)
+
+
+# add sub-commands
+superset.add_command(celery.flower)

Review comment:
       At this point the file is still manageable, but I'm planning to add more commands in the next months (for syncing to/from DBT and other metric stores) and I'm worried it's going to get too big.
   
   I followed the pattern described in the docs (https://click.palletsprojects.com/en/6.x/quickstart/#nesting-commands). Not sure if there's a better way of doing this that doesn't require touching this file when adding a new command. :-/




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] betodealmeida commented on a change in pull request #18082: chore: split CLI into multiple files

Posted by GitBox <gi...@apache.org>.
betodealmeida commented on a change in pull request #18082:
URL: https://github.com/apache/superset/pull/18082#discussion_r788035317



##########
File path: superset/cli/main.py
##########
@@ -0,0 +1,90 @@
+#!/usr/bin/env python
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+import logging
+from typing import Any, Dict
+
+import click
+from colorama import Fore, Style
+from flask.cli import FlaskGroup, with_appcontext
+
+from superset import app, appbuilder, security_manager
+from superset.cli import celery, examples, importexport, test, thumbnails, update
+from superset.cli.lib import feature_flags, normalize_token
+from superset.extensions import db
+
+logger = logging.getLogger(__name__)
+
+
+@click.group(
+    cls=FlaskGroup, context_settings={"token_normalize_func": normalize_token},
+)
+@with_appcontext
+def superset() -> None:
+    """This is a management script for the Superset application."""
+
+    @app.shell_context_processor
+    def make_shell_context() -> Dict[str, Any]:
+        return dict(app=app, db=db)
+
+
+# add sub-commands
+superset.add_command(celery.flower)

Review comment:
       @dpgaspar I was able to load them dynamically.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] codecov[bot] commented on pull request #18082: chore: split CLI into multiple files

Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on pull request #18082:
URL: https://github.com/apache/superset/pull/18082#issuecomment-1016768537


   # [Codecov](https://codecov.io/gh/apache/superset/pull/18082?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#18082](https://codecov.io/gh/apache/superset/pull/18082?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (6fc34e6) into [master](https://codecov.io/gh/apache/superset/commit/810cfc13db666ecb2da8d9e66b06ff6d2524c764?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (810cfc1) will **decrease** coverage by `0.34%`.
   > The diff coverage is `36.03%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/18082/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/18082?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #18082      +/-   ##
   ==========================================
   - Coverage   66.01%   65.67%   -0.35%     
   ==========================================
     Files        1570     1577       +7     
     Lines       61775    61828      +53     
     Branches     6244     6244              
   ==========================================
   - Hits        40780    40604     -176     
   - Misses      19395    19624     +229     
     Partials     1600     1600              
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `52.14% <18.62%> (-0.30%)` | :arrow_down: |
   | mysql | `?` | |
   | postgres | `?` | |
   | presto | `51.99% <18.62%> (-0.30%)` | :arrow_down: |
   | python | `81.15% <36.03%> (-0.73%)` | :arrow_down: |
   | sqlite | `80.78% <36.03%> (-0.35%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/18082?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset/cli/celery.py](https://codecov.io/gh/apache/superset/pull/18082/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2xpL2NlbGVyeS5weQ==) | `0.00% <0.00%> (ø)` | |
   | [superset/cli/examples.py](https://codecov.io/gh/apache/superset/pull/18082/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2xpL2V4YW1wbGVzLnB5) | `0.00% <0.00%> (ø)` | |
   | [superset/cli/main.py](https://codecov.io/gh/apache/superset/pull/18082/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2xpL21haW4ucHk=) | `0.00% <0.00%> (ø)` | |
   | [superset/cli/thumbnails.py](https://codecov.io/gh/apache/superset/pull/18082/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2xpL3RodW1ibmFpbHMucHk=) | `0.00% <0.00%> (ø)` | |
   | [superset/cli/update.py](https://codecov.io/gh/apache/superset/pull/18082/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2xpL3VwZGF0ZS5weQ==) | `0.00% <0.00%> (ø)` | |
   | [superset/cli/lib.py](https://codecov.io/gh/apache/superset/pull/18082/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2xpL2xpYi5weQ==) | `61.53% <61.53%> (ø)` | |
   | [superset/cli/importexport.py](https://codecov.io/gh/apache/superset/pull/18082/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2xpL2ltcG9ydGV4cG9ydC5weQ==) | `72.43% <72.43%> (ø)` | |
   | [superset/cli/test.py](https://codecov.io/gh/apache/superset/pull/18082/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2xpL3Rlc3QucHk=) | `83.72% <83.72%> (ø)` | |
   | [superset/databases/commands/create.py](https://codecov.io/gh/apache/superset/pull/18082/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2NvbW1hbmRzL2NyZWF0ZS5weQ==) | `31.37% <0.00%> (-56.87%)` | :arrow_down: |
   | [superset/sql\_validators/postgres.py](https://codecov.io/gh/apache/superset/pull/18082/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvc3FsX3ZhbGlkYXRvcnMvcG9zdGdyZXMucHk=) | `50.00% <0.00%> (-50.00%)` | :arrow_down: |
   | ... and [20 more](https://codecov.io/gh/apache/superset/pull/18082/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/18082?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/18082?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [810cfc1...6fc34e6](https://codecov.io/gh/apache/superset/pull/18082?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org