This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new c0ca2d72bb1 Add back `eval-type-backport` to entrypoint_ci.sh as 
pydantic workaround (#44589)
c0ca2d72bb1 is described below

commit c0ca2d72bb1d312a17b2ee9fa9c89389f873c629
Author: Jarek Potiuk <[email protected]>
AuthorDate: Tue Dec 3 15:29:11 2024 +0100

    Add back `eval-type-backport` to entrypoint_ci.sh as pydantic workaround 
(#44589)
    
    We need to install `eval-type-backport` to avoid problems with Pydantic
    2.10.+ released in November 2024 for python 3.8 and 3.9. While
    Pydantic 2.10.0/2.10.1 completely broke Airflow 2 installation and
    Pydantic 2.10.2 fixed the issue for past versions of Airflow, there are
    still Some Typing constructs that are not handled well by Pydantic and
    in case Pydantic fails with those errors, it will STILL fall back to
    `eval-type-backport` to handle those cases (if if `eval-type-backport`
    is installed. Therefore - until we have Airflow 2.10.3 for backwards
    compatibility tests and we attempt to install "edge" provider that might
    use such breaking constructs, we need to install `eval-type-backport` to
    avoid problems with Pydantic 2.10.2+ as well. As soon as we move to
    Airflow 2.10.4, we can remove this workaround because Airflow 2.10.4
    adds "eval-type-backport" as a dependency and it will be installed
    automatically.
---
 Dockerfile.ci                   | 16 ++++++++++++++++
 scripts/docker/entrypoint_ci.sh | 16 ++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/Dockerfile.ci b/Dockerfile.ci
index c0d1e3b06e3..44664dba2d5 100644
--- a/Dockerfile.ci
+++ b/Dockerfile.ci
@@ -993,6 +993,22 @@ function determine_airflow_to_use() {
            --constraint 
https://raw.githubusercontent.com/apache/airflow/constraints-main/constraints-${PYTHON_MAJOR_MINOR_VERSION}.txt
         # Some packages might leave legacy typing module which causes test 
issues
         pip uninstall -y typing || true
+        # We need to install `eval-type-backport` to avoid problems with 
Pydantic 2.10.+ released in
+        # November 2024 for python 3.8 and 3.9. While Pydantic 2.10.0/2.10.1 
completely broke Airflow 2
+        # installation and Pydantic 2.10.2 fixed the issue for past versions 
of Airflow, there are still
+        # Some Typing constructs that are not handled well by Pydantic and in 
case Pydantic fails with
+        # those errors, it will STILL fall back to `eval-type-backport` to 
handle those cases (if
+        # if `eval-type-backport` is installed. Therefore - until we have 
Airflow 2.10.3 for backwards
+        # compatibility tests and we attempt to install "edge" provider that 
might use such breaking
+        # constructs, we need to install `eval-type-backport` to avoid 
problems with Pydantic 2.10.2+
+        # as well. As soon as we move to Airflow 2.10.4, we can remove this 
workaround because Airflow
+        # 2.10.4 adds "eval-type-backport" as a dependency and it will be 
installed automatically.
+        if [[ ${PYTHON_MAJOR_MINOR_VERSION} == "3.8" || 
${PYTHON_MAJOR_MINOR_VERSION} == "3.9" ]]; then
+            echo
+            echo "${COLOR_BLUE}Installing eval-type-backport for Python 
${PYTHON_MAJOR_MINOR_VERSION} to workaround Pydantic 2.10.0/2.10.1 issue with 
new typing style.${COLOR_RESET}"
+            echo
+            pip install eval-type-backport>=0.2.0
+        fi
         if [[ ${LINK_PROVIDERS_TO_AIRFLOW_PACKAGE=} == "true" ]]; then
             echo
             echo "${COLOR_BLUE}Linking providers to airflow package as we are 
using them from mounted sources.${COLOR_RESET}"
diff --git a/scripts/docker/entrypoint_ci.sh b/scripts/docker/entrypoint_ci.sh
index 2289d202433..12aa6da8dec 100755
--- a/scripts/docker/entrypoint_ci.sh
+++ b/scripts/docker/entrypoint_ci.sh
@@ -226,6 +226,22 @@ function determine_airflow_to_use() {
            --constraint 
https://raw.githubusercontent.com/apache/airflow/constraints-main/constraints-${PYTHON_MAJOR_MINOR_VERSION}.txt
         # Some packages might leave legacy typing module which causes test 
issues
         pip uninstall -y typing || true
+        # We need to install `eval-type-backport` to avoid problems with 
Pydantic 2.10.+ released in
+        # November 2024 for python 3.8 and 3.9. While Pydantic 2.10.0/2.10.1 
completely broke Airflow 2
+        # installation and Pydantic 2.10.2 fixed the issue for past versions 
of Airflow, there are still
+        # Some Typing constructs that are not handled well by Pydantic and in 
case Pydantic fails with
+        # those errors, it will STILL fall back to `eval-type-backport` to 
handle those cases (if
+        # if `eval-type-backport` is installed. Therefore - until we have 
Airflow 2.10.3 for backwards
+        # compatibility tests and we attempt to install "edge" provider that 
might use such breaking
+        # constructs, we need to install `eval-type-backport` to avoid 
problems with Pydantic 2.10.2+
+        # as well. As soon as we move to Airflow 2.10.4, we can remove this 
workaround because Airflow
+        # 2.10.4 adds "eval-type-backport" as a dependency and it will be 
installed automatically.
+        if [[ ${PYTHON_MAJOR_MINOR_VERSION} == "3.8" || 
${PYTHON_MAJOR_MINOR_VERSION} == "3.9" ]]; then
+            echo
+            echo "${COLOR_BLUE}Installing eval-type-backport for Python 
${PYTHON_MAJOR_MINOR_VERSION} to workaround Pydantic 2.10.0/2.10.1 issue with 
new typing style.${COLOR_RESET}"
+            echo
+            pip install eval-type-backport>=0.2.0
+        fi
         if [[ ${LINK_PROVIDERS_TO_AIRFLOW_PACKAGE=} == "true" ]]; then
             echo
             echo "${COLOR_BLUE}Linking providers to airflow package as we are 
using them from mounted sources.${COLOR_RESET}"

Reply via email to