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 2022/06/25 14:23:59 UTC

[GitHub] [airflow] potiuk opened a new pull request, #24654: Script to filter candidates for PR of the month based on heuristics

potiuk opened a new pull request, #24654:
URL: https://github.com/apache/airflow/pull/24654

   This scripts proposes top candidates for PR of the month
   based on simple heuristics as discussed in the document
   
   https://docs.google.com/document/d/1qO5FztgzJLccfvbagX8DLh1EwhFVD2nUqbw96fRJmQQ/edit?disco=AAAAZ-Ct0Bs&usp_dm=true
   
   <!--
   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/main/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 a newsfragement file, named `{pr_number}.significant.rst`, in [newsfragments](https://github.com/apache/airflow/tree/main/newsfragments).
   


-- 
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: commits-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] ashb commented on a diff in pull request #24654: Script to filter candidates for PR of the month based on heuristics

Posted by GitBox <gi...@apache.org>.
ashb commented on code in PR #24654:
URL: https://github.com/apache/airflow/pull/24654#discussion_r908640536


##########
dev/stats/get_important_pr_candidates.py:
##########
@@ -0,0 +1,187 @@
+#!/usr/bin/env python3
+# 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
+import math
+import sys
+import textwrap
+from copy import deepcopy
+from datetime import date, datetime, timedelta
+from typing import List, Set
+
+import rich_click as click
+from github import Github
+from github.PullRequest import PullRequest
+from rich.console import Console
+
+if sys.version_info >= (3, 8):
+    from functools import cached_property
+else:
+    from cached_property import cached_property
+
+PROVIDER_LABEL = "area:providers"
+
+logger = logging.getLogger(__name__)
+
+console = Console(width=400, color_system="standard")
+
+option_github_token = click.option(
+    "--github-token",
+    type=str,
+    required=True,
+    help=textwrap.dedent(
+        """
+        GitHub token used to authenticate.
+        You can set omit it if you have GITHUB_TOKEN env variable set
+        Can be generated with:
+        https://github.com/settings/tokens/new?description=Read%20issues&scopes=repo:status"""
+    ),
+    envvar='GITHUB_TOKEN',
+)
+
+PROVIDER_SCORE = 0.5
+REGULAR_SCORE = 1.0
+
+REVIEW_INTERACTION_VALUE = 1.0
+COMMENT_INTERACTION_VALUE = 1.0
+REACTION_INTERACTION_VALUE = 0.1
+
+
+class PrStat:
+    def __init__(self, pull_request: PullRequest):
+        self.pull_request = pull_request
+        self._users: Set[str] = set()
+
+    @cached_property
+    def label_score(self) -> float:
+        for label in self.pull_request.labels:
+            if "provider" in label.name:
+                return PROVIDER_SCORE
+        return REGULAR_SCORE
+
+    @cached_property
+    def num_interactions(self) -> float:
+        interactions = 0.0
+        for comment in self.pull_request.get_comments():
+            interactions += COMMENT_INTERACTION_VALUE
+            self._users.add(comment.user.login)
+            for _ in comment.get_reactions():
+                interactions += REACTION_INTERACTION_VALUE
+        for review in self.pull_request.get_reviews():
+            interactions += REVIEW_INTERACTION_VALUE
+            self._users.add(review.user.login)
+        return interactions
+
+    @cached_property
+    def num_interacting_users(self) -> int:
+        _ = self.num_interactions  # make sure the _users set is populated
+        return len(self._users)
+
+    @cached_property
+    def num_changed_files(self) -> float:
+        return self.pull_request.changed_files
+
+    @cached_property
+    def score(self):
+        return (
+            1.0
+            * self.num_interactions
+            * self.label_score
+            * self.num_interacting_users
+            / (math.log10(self.num_changed_files) if self.num_changed_files > 10 else 1.0)
+        )
+
+    def __str__(self) -> str:
+        return (
+            f"Score: {self.score:.2f}: PR{self.pull_request.number} by @{self.pull_request.user.login}: "
+            f"`{self.pull_request.title}. "
+            f"Merged at {self.pull_request.merged_at}: {self.pull_request.html_url}"
+        )
+
+
+DAYS_BACK = 5
+# Current (or previous during first few days of the next month)
+DEFAULT_BEGINNING_OF_MONTH = (date.today() - timedelta(days=DAYS_BACK)).replace(day=1)
+DEFAULT_END_OF_MONTH = (
+    deepcopy(DEFAULT_BEGINNING_OF_MONTH)
+    .replace(month=1 if DEFAULT_BEGINNING_OF_MONTH == 12 else DEFAULT_BEGINNING_OF_MONTH.month + 1)
+    .replace(
+        year=DEFAULT_BEGINNING_OF_MONTH.year + 1
+        if DEFAULT_BEGINNING_OF_MONTH.month == 12
+        else DEFAULT_BEGINNING_OF_MONTH.year
+    )
+)

Review Comment:
   Lets use pendulum?
   
   ```suggestion
   DEFAULT_BEGINNING_OF_MONTH = pendulum.now().start_of('month")
   DEFAULT_END_OF_MONTH = DEFAULT_BEGINNING_OF_MONTH.add(months=1)
   ```



-- 
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: commits-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] potiuk commented on a diff in pull request #24654: Script to filter candidates for PR of the month based on heuristics

Posted by GitBox <gi...@apache.org>.
potiuk commented on code in PR #24654:
URL: https://github.com/apache/airflow/pull/24654#discussion_r908766542


##########
dev/stats/get_important_pr_candidates.py:
##########
@@ -0,0 +1,187 @@
+#!/usr/bin/env python3
+# 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
+import math
+import sys
+import textwrap
+from copy import deepcopy
+from datetime import date, datetime, timedelta
+from typing import List, Set
+
+import rich_click as click
+from github import Github
+from github.PullRequest import PullRequest
+from rich.console import Console
+
+if sys.version_info >= (3, 8):
+    from functools import cached_property
+else:
+    from cached_property import cached_property
+
+PROVIDER_LABEL = "area:providers"
+
+logger = logging.getLogger(__name__)
+
+console = Console(width=400, color_system="standard")
+
+option_github_token = click.option(
+    "--github-token",
+    type=str,
+    required=True,
+    help=textwrap.dedent(
+        """
+        GitHub token used to authenticate.
+        You can set omit it if you have GITHUB_TOKEN env variable set
+        Can be generated with:
+        https://github.com/settings/tokens/new?description=Read%20issues&scopes=repo:status"""
+    ),
+    envvar='GITHUB_TOKEN',
+)
+
+PROVIDER_SCORE = 0.5
+REGULAR_SCORE = 1.0
+
+REVIEW_INTERACTION_VALUE = 1.0
+COMMENT_INTERACTION_VALUE = 1.0
+REACTION_INTERACTION_VALUE = 0.1
+
+
+class PrStat:
+    def __init__(self, pull_request: PullRequest):
+        self.pull_request = pull_request
+        self._users: Set[str] = set()
+
+    @cached_property
+    def label_score(self) -> float:
+        for label in self.pull_request.labels:
+            if "provider" in label.name:
+                return PROVIDER_SCORE
+        return REGULAR_SCORE
+
+    @cached_property
+    def num_interactions(self) -> float:
+        interactions = 0.0
+        for comment in self.pull_request.get_comments():
+            interactions += COMMENT_INTERACTION_VALUE
+            self._users.add(comment.user.login)
+            for _ in comment.get_reactions():
+                interactions += REACTION_INTERACTION_VALUE
+        for review in self.pull_request.get_reviews():
+            interactions += REVIEW_INTERACTION_VALUE
+            self._users.add(review.user.login)
+        return interactions
+
+    @cached_property
+    def num_interacting_users(self) -> int:
+        _ = self.num_interactions  # make sure the _users set is populated
+        return len(self._users)
+
+    @cached_property
+    def num_changed_files(self) -> float:
+        return self.pull_request.changed_files
+
+    @cached_property
+    def score(self):
+        return (
+            1.0
+            * self.num_interactions
+            * self.label_score
+            * self.num_interacting_users
+            / (math.log10(self.num_changed_files) if self.num_changed_files > 10 else 1.0)
+        )
+
+    def __str__(self) -> str:
+        return (
+            f"Score: {self.score:.2f}: PR{self.pull_request.number} by @{self.pull_request.user.login}: "
+            f"`{self.pull_request.title}. "
+            f"Merged at {self.pull_request.merged_at}: {self.pull_request.html_url}"
+        )
+
+
+DAYS_BACK = 5
+# Current (or previous during first few days of the next month)
+DEFAULT_BEGINNING_OF_MONTH = (date.today() - timedelta(days=DAYS_BACK)).replace(day=1)
+DEFAULT_END_OF_MONTH = (
+    deepcopy(DEFAULT_BEGINNING_OF_MONTH)
+    .replace(month=1 if DEFAULT_BEGINNING_OF_MONTH == 12 else DEFAULT_BEGINNING_OF_MONTH.month + 1)
+    .replace(
+        year=DEFAULT_BEGINNING_OF_MONTH.year + 1
+        if DEFAULT_BEGINNING_OF_MONTH.month == 12
+        else DEFAULT_BEGINNING_OF_MONTH.year
+    )
+)

Review Comment:
   Actually  - why not :). Tha API is indeed nicer. Switched. 



-- 
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: commits-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] potiuk commented on pull request #24654: Script to filter candidates for PR of the month based on heuristics

Posted by GitBox <gi...@apache.org>.
potiuk commented on PR #24654:
URL: https://github.com/apache/airflow/pull/24654#issuecomment-1168863349

   Shall we merge for now? 


-- 
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: commits-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] potiuk commented on a diff in pull request #24654: Script to filter candidates for PR of the month based on heuristics

Posted by GitBox <gi...@apache.org>.
potiuk commented on code in PR #24654:
URL: https://github.com/apache/airflow/pull/24654#discussion_r908662666


##########
dev/stats/get_important_pr_candidates.py:
##########
@@ -0,0 +1,187 @@
+#!/usr/bin/env python3
+# 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
+import math
+import sys
+import textwrap
+from copy import deepcopy
+from datetime import date, datetime, timedelta
+from typing import List, Set
+
+import rich_click as click
+from github import Github
+from github.PullRequest import PullRequest
+from rich.console import Console
+
+if sys.version_info >= (3, 8):
+    from functools import cached_property
+else:
+    from cached_property import cached_property
+
+PROVIDER_LABEL = "area:providers"
+
+logger = logging.getLogger(__name__)
+
+console = Console(width=400, color_system="standard")
+
+option_github_token = click.option(
+    "--github-token",
+    type=str,
+    required=True,
+    help=textwrap.dedent(
+        """
+        GitHub token used to authenticate.
+        You can set omit it if you have GITHUB_TOKEN env variable set
+        Can be generated with:
+        https://github.com/settings/tokens/new?description=Read%20issues&scopes=repo:status"""
+    ),
+    envvar='GITHUB_TOKEN',
+)
+
+PROVIDER_SCORE = 0.5
+REGULAR_SCORE = 1.0
+
+REVIEW_INTERACTION_VALUE = 1.0
+COMMENT_INTERACTION_VALUE = 1.0
+REACTION_INTERACTION_VALUE = 0.1
+
+
+class PrStat:
+    def __init__(self, pull_request: PullRequest):
+        self.pull_request = pull_request
+        self._users: Set[str] = set()
+
+    @cached_property
+    def label_score(self) -> float:
+        for label in self.pull_request.labels:
+            if "provider" in label.name:
+                return PROVIDER_SCORE
+        return REGULAR_SCORE
+
+    @cached_property
+    def num_interactions(self) -> float:
+        interactions = 0.0
+        for comment in self.pull_request.get_comments():
+            interactions += COMMENT_INTERACTION_VALUE
+            self._users.add(comment.user.login)
+            for _ in comment.get_reactions():
+                interactions += REACTION_INTERACTION_VALUE
+        for review in self.pull_request.get_reviews():
+            interactions += REVIEW_INTERACTION_VALUE
+            self._users.add(review.user.login)
+        return interactions
+
+    @cached_property
+    def num_interacting_users(self) -> int:
+        _ = self.num_interactions  # make sure the _users set is populated
+        return len(self._users)
+
+    @cached_property
+    def num_changed_files(self) -> float:
+        return self.pull_request.changed_files
+
+    @cached_property
+    def score(self):
+        return (
+            1.0
+            * self.num_interactions
+            * self.label_score
+            * self.num_interacting_users
+            / (math.log10(self.num_changed_files) if self.num_changed_files > 10 else 1.0)
+        )
+
+    def __str__(self) -> str:
+        return (
+            f"Score: {self.score:.2f}: PR{self.pull_request.number} by @{self.pull_request.user.login}: "
+            f"`{self.pull_request.title}. "
+            f"Merged at {self.pull_request.merged_at}: {self.pull_request.html_url}"
+        )
+
+
+DAYS_BACK = 5
+# Current (or previous during first few days of the next month)
+DEFAULT_BEGINNING_OF_MONTH = (date.today() - timedelta(days=DAYS_BACK)).replace(day=1)
+DEFAULT_END_OF_MONTH = (
+    deepcopy(DEFAULT_BEGINNING_OF_MONTH)
+    .replace(month=1 if DEFAULT_BEGINNING_OF_MONTH == 12 else DEFAULT_BEGINNING_OF_MONTH.month + 1)
+    .replace(
+        year=DEFAULT_BEGINNING_OF_MONTH.year + 1
+        if DEFAULT_BEGINNING_OF_MONTH.month == 12
+        else DEFAULT_BEGINNING_OF_MONTH.year
+    )
+)

Review Comment:
   I try to avoid adding new dependencies to "dev scripts" because they make necessary to update "dev/requirements.txt" and generally update/refresh the venv. It's always a little bit of a hassle for anyone who has the env created before :) (one of the reasons we have self-upgrade check in Breeze)..
   
   We do not have pendulum yet in there. Do you think it's worth 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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] potiuk commented on a diff in pull request #24654: Script to filter candidates for PR of the month based on heuristics

Posted by GitBox <gi...@apache.org>.
potiuk commented on code in PR #24654:
URL: https://github.com/apache/airflow/pull/24654#discussion_r908662666


##########
dev/stats/get_important_pr_candidates.py:
##########
@@ -0,0 +1,187 @@
+#!/usr/bin/env python3
+# 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
+import math
+import sys
+import textwrap
+from copy import deepcopy
+from datetime import date, datetime, timedelta
+from typing import List, Set
+
+import rich_click as click
+from github import Github
+from github.PullRequest import PullRequest
+from rich.console import Console
+
+if sys.version_info >= (3, 8):
+    from functools import cached_property
+else:
+    from cached_property import cached_property
+
+PROVIDER_LABEL = "area:providers"
+
+logger = logging.getLogger(__name__)
+
+console = Console(width=400, color_system="standard")
+
+option_github_token = click.option(
+    "--github-token",
+    type=str,
+    required=True,
+    help=textwrap.dedent(
+        """
+        GitHub token used to authenticate.
+        You can set omit it if you have GITHUB_TOKEN env variable set
+        Can be generated with:
+        https://github.com/settings/tokens/new?description=Read%20issues&scopes=repo:status"""
+    ),
+    envvar='GITHUB_TOKEN',
+)
+
+PROVIDER_SCORE = 0.5
+REGULAR_SCORE = 1.0
+
+REVIEW_INTERACTION_VALUE = 1.0
+COMMENT_INTERACTION_VALUE = 1.0
+REACTION_INTERACTION_VALUE = 0.1
+
+
+class PrStat:
+    def __init__(self, pull_request: PullRequest):
+        self.pull_request = pull_request
+        self._users: Set[str] = set()
+
+    @cached_property
+    def label_score(self) -> float:
+        for label in self.pull_request.labels:
+            if "provider" in label.name:
+                return PROVIDER_SCORE
+        return REGULAR_SCORE
+
+    @cached_property
+    def num_interactions(self) -> float:
+        interactions = 0.0
+        for comment in self.pull_request.get_comments():
+            interactions += COMMENT_INTERACTION_VALUE
+            self._users.add(comment.user.login)
+            for _ in comment.get_reactions():
+                interactions += REACTION_INTERACTION_VALUE
+        for review in self.pull_request.get_reviews():
+            interactions += REVIEW_INTERACTION_VALUE
+            self._users.add(review.user.login)
+        return interactions
+
+    @cached_property
+    def num_interacting_users(self) -> int:
+        _ = self.num_interactions  # make sure the _users set is populated
+        return len(self._users)
+
+    @cached_property
+    def num_changed_files(self) -> float:
+        return self.pull_request.changed_files
+
+    @cached_property
+    def score(self):
+        return (
+            1.0
+            * self.num_interactions
+            * self.label_score
+            * self.num_interacting_users
+            / (math.log10(self.num_changed_files) if self.num_changed_files > 10 else 1.0)
+        )
+
+    def __str__(self) -> str:
+        return (
+            f"Score: {self.score:.2f}: PR{self.pull_request.number} by @{self.pull_request.user.login}: "
+            f"`{self.pull_request.title}. "
+            f"Merged at {self.pull_request.merged_at}: {self.pull_request.html_url}"
+        )
+
+
+DAYS_BACK = 5
+# Current (or previous during first few days of the next month)
+DEFAULT_BEGINNING_OF_MONTH = (date.today() - timedelta(days=DAYS_BACK)).replace(day=1)
+DEFAULT_END_OF_MONTH = (
+    deepcopy(DEFAULT_BEGINNING_OF_MONTH)
+    .replace(month=1 if DEFAULT_BEGINNING_OF_MONTH == 12 else DEFAULT_BEGINNING_OF_MONTH.month + 1)
+    .replace(
+        year=DEFAULT_BEGINNING_OF_MONTH.year + 1
+        if DEFAULT_BEGINNING_OF_MONTH.month == 12
+        else DEFAULT_BEGINNING_OF_MONTH.year
+    )
+)

Review Comment:
   I try to avoid adding new dependencies to "dev scripts" because they make necessary to update "dev/requirements.txt" generally update the viratualenv.  We do not have pendulum yet in there. Do you think it's worth 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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] potiuk commented on pull request #24654: Script to filter candidates for PR of the month based on heuristics

Posted by GitBox <gi...@apache.org>.
potiuk commented on PR #24654:
URL: https://github.com/apache/airflow/pull/24654#issuecomment-1166298994

   Top 10 PRs:
   * Score: 155.50: PR #24284 by @ashb: `Speed up grid_data endpoint by 10x. Merged at 2022-06-15 12:02:23: https://github.com/apache/airflow/pull/24284
   * Score: 135.00: PR #24496 by @Aakcht: `Use sql_alchemy_conn for celery result backend when result_backend is not set. Merged at 2022-06-23 15:34:21: https://github.com/apache/airflow/pull/24496
   * Score: 106.20: PR #24236 by @potiuk: `Add CI-friendly progress output for tests. Merged at 2022-06-14 20:32:49: https://github.com/apache/airflow/pull/24236
   * Score: 92.00: PR #24065 by @jhtimmins: `Rename Permissions to Permission Pairs.. Merged at 2022-06-02 18:04:52: https://github.com/apache/airflow/pull/24065
   * Score: 86.61: PR #24415 by @phanikumv: `Add TrinoOperator. Merged at 2022-06-19 23:08:14: https://github.com/apache/airflow/pull/24415
   * Score: 77.20: PR #24185 by @potiuk: `Better diagnostics for ARM for MySQL and MSSQL. Merged at 2022-06-12 15:14:09: https://github.com/apache/airflow/pull/24185
   * Score: 76.80: PR #24590 by @blag: `Lay the groundwork for migrating Airflow CLI to Rich+Click. Merged at 2022-06-23 16:28:18: https://github.com/apache/airflow/pull/24590
   * Score: 75.50: PR #24335 by @fritz-astronomer: ``TI.log_url` fix for `map_index`. Merged at 2022-06-14 20:15:50: https://github.com/apache/airflow/pull/24335
   * Score: 73.52: PR #24399 by @potiuk: `Upgrade FAB to 4.1.1. Merged at 2022-06-22 21:26:28: https://github.com/apache/airflow/pull/24399
   * Score: 66.00: PR #24260 by @jedcunningham: `Use `get_hostname` instead of `socket.getfqdn`. Merged at 2022-06-15 19:45:15: https://github.com/apache/airflow/pull/24260


-- 
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: commits-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] potiuk merged pull request #24654: Script to filter candidates for PR of the month based on heuristics

Posted by GitBox <gi...@apache.org>.
potiuk merged PR #24654:
URL: https://github.com/apache/airflow/pull/24654


-- 
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: commits-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] ashb commented on a diff in pull request #24654: Script to filter candidates for PR of the month based on heuristics

Posted by GitBox <gi...@apache.org>.
ashb commented on code in PR #24654:
URL: https://github.com/apache/airflow/pull/24654#discussion_r908673880


##########
dev/stats/get_important_pr_candidates.py:
##########
@@ -0,0 +1,187 @@
+#!/usr/bin/env python3
+# 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
+import math
+import sys
+import textwrap
+from copy import deepcopy
+from datetime import date, datetime, timedelta
+from typing import List, Set
+
+import rich_click as click
+from github import Github
+from github.PullRequest import PullRequest
+from rich.console import Console
+
+if sys.version_info >= (3, 8):
+    from functools import cached_property
+else:
+    from cached_property import cached_property
+
+PROVIDER_LABEL = "area:providers"
+
+logger = logging.getLogger(__name__)
+
+console = Console(width=400, color_system="standard")
+
+option_github_token = click.option(
+    "--github-token",
+    type=str,
+    required=True,
+    help=textwrap.dedent(
+        """
+        GitHub token used to authenticate.
+        You can set omit it if you have GITHUB_TOKEN env variable set
+        Can be generated with:
+        https://github.com/settings/tokens/new?description=Read%20issues&scopes=repo:status"""
+    ),
+    envvar='GITHUB_TOKEN',
+)
+
+PROVIDER_SCORE = 0.5
+REGULAR_SCORE = 1.0
+
+REVIEW_INTERACTION_VALUE = 1.0
+COMMENT_INTERACTION_VALUE = 1.0
+REACTION_INTERACTION_VALUE = 0.1
+
+
+class PrStat:
+    def __init__(self, pull_request: PullRequest):
+        self.pull_request = pull_request
+        self._users: Set[str] = set()
+
+    @cached_property
+    def label_score(self) -> float:
+        for label in self.pull_request.labels:
+            if "provider" in label.name:
+                return PROVIDER_SCORE
+        return REGULAR_SCORE
+
+    @cached_property
+    def num_interactions(self) -> float:
+        interactions = 0.0
+        for comment in self.pull_request.get_comments():
+            interactions += COMMENT_INTERACTION_VALUE
+            self._users.add(comment.user.login)
+            for _ in comment.get_reactions():
+                interactions += REACTION_INTERACTION_VALUE
+        for review in self.pull_request.get_reviews():
+            interactions += REVIEW_INTERACTION_VALUE
+            self._users.add(review.user.login)
+        return interactions
+
+    @cached_property
+    def num_interacting_users(self) -> int:
+        _ = self.num_interactions  # make sure the _users set is populated
+        return len(self._users)
+
+    @cached_property
+    def num_changed_files(self) -> float:
+        return self.pull_request.changed_files
+
+    @cached_property
+    def score(self):
+        return (
+            1.0
+            * self.num_interactions
+            * self.label_score
+            * self.num_interacting_users
+            / (math.log10(self.num_changed_files) if self.num_changed_files > 10 else 1.0)
+        )
+
+    def __str__(self) -> str:
+        return (
+            f"Score: {self.score:.2f}: PR{self.pull_request.number} by @{self.pull_request.user.login}: "
+            f"`{self.pull_request.title}. "
+            f"Merged at {self.pull_request.merged_at}: {self.pull_request.html_url}"
+        )
+
+
+DAYS_BACK = 5
+# Current (or previous during first few days of the next month)
+DEFAULT_BEGINNING_OF_MONTH = (date.today() - timedelta(days=DAYS_BACK)).replace(day=1)
+DEFAULT_END_OF_MONTH = (
+    deepcopy(DEFAULT_BEGINNING_OF_MONTH)
+    .replace(month=1 if DEFAULT_BEGINNING_OF_MONTH == 12 else DEFAULT_BEGINNING_OF_MONTH.month + 1)
+    .replace(
+        year=DEFAULT_BEGINNING_OF_MONTH.year + 1
+        if DEFAULT_BEGINNING_OF_MONTH.month == 12
+        else DEFAULT_BEGINNING_OF_MONTH.year
+    )
+)

Review Comment:
   Oh I assumed that dev deps were on top of an airflow's corre deps. But that's only "for me" because I dev via a virtualenv.
   
   Your call. Pendulum isn't difficult to install (doesn't have many/any extra deps) and I think it's a lot easier to understand the pendulum code)



-- 
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: commits-unsubscribe@airflow.apache.org

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