You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "potiuk (via GitHub)" <gi...@apache.org> on 2025/08/25 14:12:29 UTC

[PR] Switch all our prek python hooks to use PEP-723 inline dependencies [airflow]

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

   Following the change in https://github.com/j178/prek/pull/529 and release of prek 0.1.3, we convert all our Python scripts to use PEP-723-compliant inline scripts.
   
   This will remove decoupling of scripts from their dependencies, and will allow to run them easily by `uv run` as well as easier debugging and testing.
   
   <!--
    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 [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/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] Switch all our prek python hooks to use PEP-723 inline dependencies [airflow]

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

   Green. GitHyb Copilot (mostly) and I would love to get it merged :). I guess @j178 as well :)


-- 
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] Switch all our prek python hooks to use PEP-723 inline dependencies [airflow]

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


##########
airflow-core/docs/img/diagram_auth_manager_airflow_architecture.png:
##########


Review Comment:
   Nit after-the-fact here: why did this change? The new padding around text looks a bit worse



-- 
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] Switch all our prek python hooks to use PEP-723 inline dependencies [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk merged PR #54917:
URL: https://github.com/apache/airflow/pull/54917


-- 
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] Switch all our prek python hooks to use PEP-723 inline dependencies [airflow]

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

   > Do we have some kind of dependabot to update dependencies in the scripts as well? Or how do we not forget to bump dependencies in there? Need to add a new automation for this (follow-up PR)?
   
   My thoughts exactly. I think we should check if dependabot supports bumping inline-script metadata deps and if not .... contribute it ...we have a precedent @gopidesupavan :) 


-- 
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] Switch all our prek python hooks to use PEP-723 inline dependencies [airflow]

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

   Looks like accidental issue with building airflow - 503 on NPM. Will retry when finished.


-- 
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] Switch all our prek python hooks to use PEP-723 inline dependencies [airflow]

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


##########
airflow-core/docs/img/diagram_auth_manager_airflow_architecture.png:
##########


Review Comment:
   Oh yeah, that would track.



-- 
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] Switch all our prek python hooks to use PEP-723 inline dependencies [airflow]

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

   ### Backport failed to create: v3-0-test. View the failure log <a href='https://github.com/apache/airflow/actions/runs/17219312980'> Run details </a>
   
   <table>
       <tr>
           <th>Status</th>
           <th>Branch</th>
           <th>Result</th>
       </tr>
       <tr>
           <td>❌</td>
           <td>v3-0-test</td>
           <td><a href="https://github.com/apache/airflow/commit/0df08334cd1c6272db09d95b94aa250a3340630b"><img src='https://img.shields.io/badge/Commit-0df0833-red' alt='Commit Link'></a></td>
       </tr>
   </table>
   
   You can attempt to backport this manually by running:
   
   ```bash
   cherry_picker 0df0833 v3-0-test
   ```
   
   This should apply the commit to the v3-0-test branch and leave the commit in conflict state marking
   the files that need manual conflict resolution.
   
   After you have resolved the conflicts, you can continue the backport process by running:
   
   ```bash
   cherry_picker --continue
   ```
   


-- 
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] Switch all our prek python hooks to use PEP-723 inline dependencies [airflow]

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


##########
scripts/ci/prek/update_providers_dependencies.py:
##########
@@ -18,9 +18,9 @@
 # /// script
 # requires-python = ">=3.10"
 # dependencies = [
-#   "rich>=12.4.4",
-#   "pyyaml>=6.0.2",
-#   "tomli>=2.0.1; python_version < '3.11'"
+#    "rich>=13.6.0",
+#    "pyyaml>=6.0.2",
+#    "tomli>=2.0.1"

Review Comment:
   Why 4 chars? In all other scripts you indent by 3 spaces.
   ```suggestion
   #   "rich>=13.6.0",
   #   "pyyaml>=6.0.2",
   #   "tomli>=2.0.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


Re: [PR] Switch all our prek python hooks to use PEP-723 inline dependencies [airflow]

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

   I made all of the requirements consistent: 2 space ident and `"` - some of them used `'`
   Also I added trailing `,` to all lines and this also allowed  to sort all the lines. Now all of them should be nicely consistent.
   
   BTW: https://github.com/dependabot/dependabot-core/issues/11946 -> inline script data is not suported. But I've also learned that `uv` supports .... locking dependencies for scripts: https://docs.astral.sh/uv/guides/scripts/#locking-dependencies 


-- 
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] Switch all our prek python hooks to use PEP-723 inline dependencies [airflow]

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

   > Green. GitHyb Copilot (mostly) and I would love to get it merged :). I guess @j178 as well :)
   
   Just in time was reviewing :) cool thanks Both


-- 
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] Switch all our prek python hooks to use PEP-723 inline dependencies [airflow]

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


##########
airflow-core/docs/img/diagram_auth_manager_airflow_architecture.png:
##########


Review Comment:
   Likely because it was generated on a different OS. Rendering of graphviz might be dependent on fonts and other system dependent parameters or even graphics card available on the system (this is why we do not regenerate the images always but only after hash of the python file changes which was the case here because of inline deps). 
   
   All it needs is to delete the hash and try to regenerate it again on a different machine likely



-- 
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] Switch all our prek python hooks to use PEP-723 inline dependencies [airflow]

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


##########
scripts/ci/prek/upgrade_important_versions.py:
##########
@@ -15,6 +15,15 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+# /// script
+# requires-python = ">=3.10"
+# dependencies = [
+#    "pyyaml>=6.0.2",
+#    "rich>=13.6.0",
+#    "requests>=2.31.0",
+#    "packaging>=25"

Review Comment:
   Mhm, here you also indent by 4 chars :-D - is there a standard for this?



-- 
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] Switch all our prek python hooks to use PEP-723 inline dependencies [airflow]

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


##########
scripts/ci/prek/upgrade_important_versions.py:
##########
@@ -15,6 +15,15 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+# /// script
+# requires-python = ">=3.10"
+# dependencies = [
+#    "pyyaml>=6.0.2",
+#    "rich>=13.6.0",
+#    "requests>=2.31.0",
+#    "packaging>=25"

Review Comment:
   It's mostly Copilot somehow hallucinating :), I was merelly telling it to do it.... So maybe sometimes it did it with a little more enthusiasm and added one more space. Let me straighten this up :)



-- 
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] Switch all our prek python hooks to use PEP-723 inline dependencies [airflow]

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

   Random issue. All static checks passed.


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