Skip to content

Commit

Permalink
Workaround Pydantic 2.10.0/2.10.1 for compatibility tests (#44317)
Browse files Browse the repository at this point in the history
Our compatibility tests started to fail after Pydantic 2.10.0/2.10.1
have been released due to change in the way they are handling base
classes for Pydantic classes and their protected members, when
the base class uses PEP 563 ('from __future__ import annotations`)
on Python 3.8 / 3.9.

This is tracked in pydantic/pydantic#10958
and hopefully will be solved by adding eval-type-backport as
required Pydantic 2.10.2+ dependency, but until it is released,
manually installing `eval-type-backport` in compatibility tests
should workaround the failing canary tests.
  • Loading branch information
potiuk authored Nov 24, 2024
1 parent f0da8ee commit 33afa8f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Dockerfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,15 @@ 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.0/2.10.1 released in
# November 2024 for python 3.8 and 3.9. Hopefully this is only a temporary measure that will be
# solved in Pydantic 2.10.2 by addressing https://github.com/pydantic/pydantic/issues/10958
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
9 changes: 9 additions & 0 deletions scripts/docker/entrypoint_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,15 @@ 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.0/2.10.1 released in
# November 2024 for python 3.8 and 3.9. Hopefully this is only a temporary measure that will be
# solved in Pydantic 2.10.2 by addressing https://github.com/pydantic/pydantic/issues/10958
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 33afa8f

Please sign in to comment.