You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/11/09 22:35:14 UTC

[GitHub] [airflow] kaxil opened a new pull request #12218: Beautify Output of setup-installation pre-commit

kaxil opened a new pull request #12218:
URL: https://github.com/apache/airflow/pull/12218


   **Before**:
   ![image](https://user-images.githubusercontent.com/8811558/98604541-c5675d80-22db-11eb-834c-3ccaf226cc43.png)
   
   
   **After**:
   ![image](https://user-images.githubusercontent.com/8811558/98604553-cac4a800-22db-11eb-87cf-a09f130ea0cc.png)
   
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
   


----------------------------------------------------------------
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.

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



[GitHub] [airflow] turbaszek commented on a change in pull request #12218: Beautify Output of setup-installation pre-commit

Posted by GitBox <gi...@apache.org>.
turbaszek commented on a change in pull request #12218:
URL: https://github.com/apache/airflow/pull/12218#discussion_r520166145



##########
File path: scripts/ci/pre_commit/pre_commit_check_setup_installation.py
##########
@@ -81,32 +85,35 @@ def get_extras_from_docs() -> List[str]:
     setup_packages = get_extras_from_setup()
     docs_packages = get_extras_from_docs()
 
-    output_table = ""
+    table = Table()
+    table.add_column("NAME", justify="right", style="cyan")
+    table.add_column("SETUP", justify="center", style="magenta")
+    table.add_column("INSTALLATION", justify="center", style="green")
 
     for extras in sorted(setup_packages.keys()):
         if not set(setup_packages[extras]).intersection(docs_packages):
-            output_table += "| {:20} | {:^10} | {:^10} |\n".format(extras, "V", "")
+            table.add_row(extras, "V", "")
 
     setup_packages_str = str(setup_packages)
     for extras in sorted(docs_packages):
         if f"'{extras}'" not in setup_packages_str:
-            output_table += "| {:20} | {:^10} | {:^10} |\n".format(extras, "", "V")
+            table.add_row(extras, "", "V")
 
-    if output_table == "":
+    if table.row_count == 0:
         sys.exit(0)
 
-    print(
+    rprint(
         f"""

Review comment:
       ```suggestion
           f"""\
   ```
   To avoid leading new line - WDYT?




----------------------------------------------------------------
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.

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



[GitHub] [airflow] turbaszek commented on a change in pull request #12218: Beautify Output of setup-installation pre-commit

Posted by GitBox <gi...@apache.org>.
turbaszek commented on a change in pull request #12218:
URL: https://github.com/apache/airflow/pull/12218#discussion_r520165627



##########
File path: scripts/ci/pre_commit/pre_commit_check_setup_installation.py
##########
@@ -26,6 +26,10 @@
 from os.path import dirname
 from typing import Dict, List
 
+from rich import print as rprint
+from rich.console import Console
+from rich.table import Table

Review comment:
       I did not expected that we will adopt rich so fast 🚀 




----------------------------------------------------------------
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.

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



[GitHub] [airflow] turbaszek commented on a change in pull request #12218: Beautify Output of setup-installation pre-commit

Posted by GitBox <gi...@apache.org>.
turbaszek commented on a change in pull request #12218:
URL: https://github.com/apache/airflow/pull/12218#discussion_r520165924



##########
File path: scripts/ci/pre_commit/pre_commit_check_setup_installation.py
##########
@@ -81,32 +85,35 @@ def get_extras_from_docs() -> List[str]:
     setup_packages = get_extras_from_setup()
     docs_packages = get_extras_from_docs()
 
-    output_table = ""
+    table = Table()
+    table.add_column("NAME", justify="right", style="cyan")
+    table.add_column("SETUP", justify="center", style="magenta")
+    table.add_column("INSTALLATION", justify="center", style="green")
 
     for extras in sorted(setup_packages.keys()):
         if not set(setup_packages[extras]).intersection(docs_packages):
-            output_table += "| {:20} | {:^10} | {:^10} |\n".format(extras, "V", "")
+            table.add_row(extras, "V", "")
 
     setup_packages_str = str(setup_packages)
     for extras in sorted(docs_packages):
         if f"'{extras}'" not in setup_packages_str:
-            output_table += "| {:20} | {:^10} | {:^10} |\n".format(extras, "", "V")
+            table.add_row(extras, "", "V")
 
-    if output_table == "":
+    if table.row_count == 0:
         sys.exit(0)
 
-    print(
+    rprint(
         f"""
-ERROR
+[red bold]ERROR!![/red bold]
 
-"EXTRAS_REQUIREMENTS" section in {SETUP_PY_FILE} should be synchronized
-with "Extra Packages" section in documentation file doc/{DOCS_FILE}.
+"EXTRAS_REQUIREMENTS" section in [bold yellow]{SETUP_PY_FILE}[/bold yellow] should be synchronized
+with "Extra Packages" section in documentation file [bold yellow]doc/{DOCS_FILE}[/bold yellow].
 
 here is a list of packages that are used but are not documented, or

Review comment:
       ```suggestion
   Here is a list of packages that are used but are not documented, or
   ```




----------------------------------------------------------------
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.

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



[GitHub] [airflow] kaxil merged pull request #12218: Beautify Output of setup-installation pre-commit

Posted by GitBox <gi...@apache.org>.
kaxil merged pull request #12218:
URL: https://github.com/apache/airflow/pull/12218


   


----------------------------------------------------------------
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.

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



[GitHub] [airflow] kaxil commented on a change in pull request #12218: Beautify Output of setup-installation pre-commit

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #12218:
URL: https://github.com/apache/airflow/pull/12218#discussion_r520168575



##########
File path: scripts/ci/pre_commit/pre_commit_check_setup_installation.py
##########
@@ -81,32 +85,35 @@ def get_extras_from_docs() -> List[str]:
     setup_packages = get_extras_from_setup()
     docs_packages = get_extras_from_docs()
 
-    output_table = ""
+    table = Table()
+    table.add_column("NAME", justify="right", style="cyan")
+    table.add_column("SETUP", justify="center", style="magenta")
+    table.add_column("INSTALLATION", justify="center", style="green")
 
     for extras in sorted(setup_packages.keys()):
         if not set(setup_packages[extras]).intersection(docs_packages):
-            output_table += "| {:20} | {:^10} | {:^10} |\n".format(extras, "V", "")
+            table.add_row(extras, "V", "")
 
     setup_packages_str = str(setup_packages)
     for extras in sorted(docs_packages):
         if f"'{extras}'" not in setup_packages_str:
-            output_table += "| {:20} | {:^10} | {:^10} |\n".format(extras, "", "V")
+            table.add_row(extras, "", "V")
 
-    if output_table == "":
+    if table.row_count == 0:
         sys.exit(0)
 
-    print(
+    rprint(
         f"""

Review comment:
       done




----------------------------------------------------------------
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.

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



[GitHub] [airflow] github-actions[bot] commented on pull request #12218: Beautify Output of setup-installation pre-commit

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #12218:
URL: https://github.com/apache/airflow/pull/12218#issuecomment-724375867


   The PR needs to run all tests because it modifies core of Airflow! Please rebase it to latest master or ask committer to re-run it!


----------------------------------------------------------------
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.

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



[GitHub] [airflow] kaxil commented on a change in pull request #12218: Beautify Output of setup-installation pre-commit

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #12218:
URL: https://github.com/apache/airflow/pull/12218#discussion_r520167080



##########
File path: scripts/ci/pre_commit/pre_commit_check_setup_installation.py
##########
@@ -26,6 +26,10 @@
 from os.path import dirname
 from typing import Dict, List
 
+from rich import print as rprint
+from rich.console import Console
+from rich.table import Table

Review comment:
       I love rich, I am going to plug it in everywhere I can in Airflow :D

##########
File path: scripts/ci/pre_commit/pre_commit_check_setup_installation.py
##########
@@ -81,32 +85,35 @@ def get_extras_from_docs() -> List[str]:
     setup_packages = get_extras_from_setup()
     docs_packages = get_extras_from_docs()
 
-    output_table = ""
+    table = Table()
+    table.add_column("NAME", justify="right", style="cyan")
+    table.add_column("SETUP", justify="center", style="magenta")
+    table.add_column("INSTALLATION", justify="center", style="green")
 
     for extras in sorted(setup_packages.keys()):
         if not set(setup_packages[extras]).intersection(docs_packages):
-            output_table += "| {:20} | {:^10} | {:^10} |\n".format(extras, "V", "")
+            table.add_row(extras, "V", "")
 
     setup_packages_str = str(setup_packages)
     for extras in sorted(docs_packages):
         if f"'{extras}'" not in setup_packages_str:
-            output_table += "| {:20} | {:^10} | {:^10} |\n".format(extras, "", "V")
+            table.add_row(extras, "", "V")
 
-    if output_table == "":
+    if table.row_count == 0:
         sys.exit(0)
 
-    print(
+    rprint(
         f"""
-ERROR
+[red bold]ERROR!![/red bold]
 
-"EXTRAS_REQUIREMENTS" section in {SETUP_PY_FILE} should be synchronized
-with "Extra Packages" section in documentation file doc/{DOCS_FILE}.
+"EXTRAS_REQUIREMENTS" section in [bold yellow]{SETUP_PY_FILE}[/bold yellow] should be synchronized
+with "Extra Packages" section in documentation file [bold yellow]doc/{DOCS_FILE}[/bold yellow].
 
 here is a list of packages that are used but are not documented, or

Review comment:
       fixed




----------------------------------------------------------------
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.

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