You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "MichaReiser (via GitHub)" <gi...@apache.org> on 2024/02/12 10:56:33 UTC

[PR] Preview Ruff 2024 style guide [airflow]

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

   <!--
    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.
    -->
   
   <!--
   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 an 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/
   -->
   
   
   
   <!-- Please keep an empty line above the dashes. -->
   ---
   **^ Add meaningful description above**
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information.
   In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+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 newsfragment file, named `{pr_number}.significant.rst` or `{issue_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


Re: [PR] Preview Ruff 2024 style guide (DO NOT MERGE) [airflow]

Posted by "MichaReiser (via GitHub)" <gi...@apache.org>.
MichaReiser commented on PR #37355:
URL: https://github.com/apache/airflow/pull/37355#issuecomment-1938643311

   Thank you for the feedback, @potiuk, and I'm sorry I stepped into that hornet's nest. Your explanation makes sense to me, and I didn't intend to expose you to any formatting decisions and drain your energy. My intention was to avoid any negative surprises in terms of formatting when upgrading to the next version of ruff. But I see now how I removed one of Ruff's value propositions by exactly doing this. 
   
   I'll close this PR. Sorry for taking your time and thanks for your feedback.


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


Re: [PR] Preview Ruff 2024 style guide (DO NOT MERGE) [airflow]

Posted by "Taragolis (via GitHub)" <gi...@apache.org>.
Taragolis commented on PR #37355:
URL: https://github.com/apache/airflow/pull/37355#issuecomment-1938971739

   > The nicest thing about Black (and ruff-format now) is that we do not have to discuss it and have opinions. It is, what it is.
   
   + 1. There is no to discuss and start holly war about `"` vs `'` in case if it formatted automatically, so we could spend a time to a real discussion rather than personal preferences 🤣 


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


Re: [PR] Preview Ruff 2024 style guide (DO NOT MERGE) [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #37355:
URL: https://github.com/apache/airflow/pull/37355#issuecomment-1938704041

   And yes. NOT having to discuss anything was - from the very beginning - the most important Black's value proposal, hands down. the lack of configuration in Black and people arguing about formatting was  - I think - the most important `feature`.


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


Re: [PR] Preview Ruff 2024 style guide (DO NOT MERGE) [airflow]

Posted by "MichaReiser (via GitHub)" <gi...@apache.org>.
MichaReiser commented on code in PR #37355:
URL: https://github.com/apache/airflow/pull/37355#discussion_r1486051191


##########
airflow/providers/google/cloud/hooks/bigquery.py:
##########
@@ -1934,9 +1934,11 @@ def run_copy(
                 default_project_id=self.project_id,
                 var_name="source_project_dataset_table",
             )
-            source_project_dataset_tables_fixup.append(
-                {"projectId": source_project, "datasetId": source_dataset, "tableId": source_table}
-            )
+            source_project_dataset_tables_fixup.append({
+                "projectId": source_project,
+                "datasetId": source_dataset,
+                "tableId": source_table,
+            })

Review Comment:
   Another instance where hugging expands the entire *hugged* expression.



##########
airflow/jobs/scheduler_job_runner.py:
##########
@@ -286,9 +286,9 @@ def __get_concurrency_maps(self, states: Iterable[TaskInstanceState], session: S
             .where(TI.state.in_(states))
             .group_by(TI.task_id, TI.run_id, TI.dag_id)
         )
-        return ConcurrencyMap.from_concurrency_map(
-            {(dag_id, run_id, task_id): count for task_id, run_id, dag_id, count in ti_concurrency_query}
-        )
+        return ConcurrencyMap.from_concurrency_map({
+            (dag_id, run_id, task_id): count for task_id, run_id, dag_id, count in ti_concurrency_query
+        })

Review Comment:
   Any opinions on whether you prefer the old formatting over the new in this specific instance where the entire dictionary expression fits on its own line would be great because that's one outstanding [style issue](https://github.com/astral-sh/ruff/issues/9029).



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


Re: [PR] Preview Ruff 2024 style guide (DO NOT MERGE) [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #37355:
URL: https://github.com/apache/airflow/pull/37355#issuecomment-1938695288

   No worries. No time taken, but It could have taken a lot of energy and effort of multiple people if we start dicussing it (again) :D


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


Re: [PR] Preview Ruff 2024 style guide (DO NOT MERGE) [airflow]

Posted by "MichaReiser (via GitHub)" <gi...@apache.org>.
MichaReiser closed pull request #37355: Preview Ruff 2024 style guide (DO NOT MERGE)
URL: https://github.com/apache/airflow/pull/37355


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


Re: [PR] Preview Ruff 2024 style guide (DO NOT MERGE) [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #37355:
URL: https://github.com/apache/airflow/pull/37355#issuecomment-1938577716

   To be honest, you are opening hornet's nest with that question. The nicest thing about Black (and ruff-format now) is that we do not have to discuss it and have opinions. It is, what it is. To be a little profane, my friend often said in Polish - "lepiej ch*wo ale jednakowo" - which roughly translates to "even if f*ing bad, it's great it's the same". 
   
   I really love in black and ruff-format that we do not have to discsuss formatting at all :). So my advice - just make opinionated choices and go for it. If you ask people for opinions about individual choices, it's a lot of time and energy lost for such discussions - there is no way people are going to agree on those and the amount of hostilty created by such discussion is usually disproportionaly huge comparing to benefits/drawbacks they bring.
   
   What I do not particularly like about this change is the number of changes it introduces in general. Sounds quite a bit unnecessary, and if I were you, I'd optimise on minimising number of changes it brings rather than asking for opinions of peoplel


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


Re: [PR] Preview Ruff 2024 style guide [airflow]

Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on PR #37355:
URL: https://github.com/apache/airflow/pull/37355#issuecomment-1938450609

   Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
   Here are some useful points:
   - Pay attention to the quality of your code (ruff, mypy and type annotations). Our [pre-commits]( https://github.com/apache/airflow/blob/main/contributing-docs/08_static_code_checks.rst#prerequisites-for-pre-commit-hooks) will help you with that.
   - In case of a new feature add useful documentation (in docstrings or in `docs/` directory). Adding a new operator? Check this short [guide](https://github.com/apache/airflow/blob/main/docs/apache-airflow/howto/custom-operator.rst) Consider adding an example DAG that shows how users should use it.
   - Consider using [Breeze environment](https://github.com/apache/airflow/blob/main/dev/breeze/doc/README.rst) for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
   - Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
   - Please follow [ASF Code of Conduct](https://www.apache.org/foundation/policies/conduct) for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
   - Be sure to read the [Airflow Coding style]( https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#coding-style-and-best-practices).
   - Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
   Apache Airflow is a community-driven project and together we are making it better 🚀.
   In case of doubts contact the developers at:
   Mailing List: dev@airflow.apache.org
   Slack: https://s.apache.org/airflow-slack
   


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