Skip to content

Commit

Permalink
Add back eval-type-backport to entrypoint_ci.sh as pydantic workaro…
Browse files Browse the repository at this point in the history
…und (apache#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.
  • Loading branch information
potiuk authored Dec 3, 2024
1 parent a537d9c commit c0ca2d7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Dockerfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
16 changes: 16 additions & 0 deletions scripts/docker/entrypoint_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down

0 comments on commit c0ca2d7

Please sign in to comment.