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

[PR] Use sys.version_info to get the python version [airflow]

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

   I have a customized image that uses `continuumio/miniconda3:4.12.0` as its `PYTHON_BASE_IMAGE`. The `python --version` in the said Conda distribution outputs:
   ```
   Python 3.9.18 | packaged by conda-forge | (9c4f8ef1, Jan 30 2024, 18:27:40)
   [PyPy 7.3.15 with GCC 12.3.0]
   ```
   
   In the `Dockerfile` this is piped to `cut -d " " -f 2 | cut -d "." -f 1-2`. The result is this:
   ```
   3.9
   7.3
   ```
   
   As a result the `AIRFLOW_CONSTRAINTS_LOCATION` becomes:
   ```
   https://raw.githubusercontent.com/apache/airflow/constraints-2.5.3/constraints-3.9%0A7.3.txt
   ```
   
   The python version is retrieved in 3 places in the `Dockerfile`. One uses `sys.version_info`, two use `python --version` with pipe/cut. I suggest for `sys.version_info` to be used consistently in all 3 places, as it gives a more predictable result.
   
   <!--
    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. -->
   
   


-- 
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] Use sys.version_info to get the python version [airflow]

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

   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


Re: [PR] Use sys.version_info to get the python version [airflow]

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

   While the change is good, his is wrong place where to update it. The dockerfile scripts are inlined automatically by pre-commit from `scripts/docker/*.sh` - and you should modify them there, then (after installing pre-commit) they will be automatically inlined to the Dockerfiles by the pre-commit.


-- 
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] Use sys.version_info to get the python version [airflow]

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

   > https://github.com/apache/airflow/blob/main/scripts/docker/common.sh#L102 -> this is where it should be modified.
   
   And also in `scripts/docker/entrypoint_prod.sh`.
   
   I suppose I should run the pre-commit hooks locally too?


-- 
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] Use sys.version_info to get the python version [airflow]

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

   IF you really really really want to avoid installing things locally, you could just apply the changes suggested by the CI manually yourself.


-- 
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] Use sys.version_info to get the python version [airflow]

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


-- 
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] Use sys.version_info to get the python version [airflow]

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

   https://github.com/apache/airflow/blob/main/scripts/docker/common.sh#L102 -> this is where it should be modified.


-- 
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] Use sys.version_info to get the python version [airflow]

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

   Awesome work, congrats on your first merged pull request! You are invited to check our [Issue Tracker](https://github.com/apache/airflow/issues) for additional contributions.
   


-- 
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] Use sys.version_info to get the python version [airflow]

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

   I run hook locally and push changes into the branch: https://github.com/apache/airflow/pull/37750/commits/c0d2041aa663ecd169cc999b1e19e6a147ee6931


-- 
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] Use sys.version_info to get the python version [airflow]

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

   > I suppose I should run the pre-commit hooks locally too?
   
   Yep


-- 
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] Use sys.version_info to get the python version [airflow]

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

   > I suppose I should run the pre-commit hooks locally too? 
   
   This is what pre-commit is for (`pre-` + `commit`). You should run `pre-commit install` and since then it will be run automatically for you whenever you make commit - this is the way you do not have to send PR to CI to find out if your PR passess the first gate of static checks


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