Skip to content

Commit c57bd9c

Browse files
github-actions[bot]potiuk
authored andcommitted
[v3-0-test] Move --no-binary flag to uv command line from pyproject.toml (#53179) (#53185)
When the flag is specified in pyproject toml, it also forces no binary installation of xmlsec and lxml for local uv sync which might fail if some system libraries are not installed, so it is better to do it in the image by passing the right flags to installer directly. (cherry picked from commit 47bbe55) Co-authored-by: Jarek Potiuk <[email protected]>
1 parent 63c581e commit c57bd9c

File tree

5 files changed

+64
-19
lines changed

5 files changed

+64
-19
lines changed

Dockerfile

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -473,11 +473,14 @@ function common::get_packaging_tool() {
473473
echo
474474
export PACKAGING_TOOL="uv"
475475
export PACKAGING_TOOL_CMD="uv pip"
476-
if [[ ${AIRFLOW_INSTALLATION_METHOD=} == "." && -f "./pyproject.toml" ]]; then
476+
# --no-binary is needed in order to avoid libxml and xmlsec using different version of libxml2
477+
# (binary lxml embeds its own libxml2, while xmlsec uses system one).
478+
# See https://bugs.launchpad.net/lxml/+bug/2110068
479+
if [[ ${AIRFLOW_INSTALLATION_METHOD=} == "." && -f "./pyproject.toml" ]]; then
477480
# for uv only install dev group when we install from sources
478-
export EXTRA_INSTALL_FLAGS="--group=dev"
481+
export EXTRA_INSTALL_FLAGS="--group=dev --no-binary lxml --no-binary xmlsec"
479482
else
480-
export EXTRA_INSTALL_FLAGS=""
483+
export EXTRA_INSTALL_FLAGS="--no-binary lxml --no-binary xmlsec"
481484
fi
482485
export EXTRA_UNINSTALL_FLAGS=""
483486
export UPGRADE_TO_HIGHEST_RESOLUTION="--upgrade --resolution highest"
@@ -875,8 +878,12 @@ function install_from_sources() {
875878
echo
876879
echo "${COLOR_BLUE}Attempting to upgrade all packages to highest versions.${COLOR_RESET}"
877880
echo
881+
# --no-binary is needed in order to avoid libxml and xmlsec using different version of libxml2
882+
# (binary lxml embeds its own libxml2, while xmlsec uses system one).
883+
# See https://bugs.launchpad.net/lxml/+bug/2110068
878884
set -x
879-
uv sync --all-packages --resolution highest --group dev --group docs --group docs-gen --group leveldb ${extra_sync_flags}
885+
uv sync --all-packages --resolution highest --group dev --group docs --group docs-gen \
886+
--group leveldb ${extra_sync_flags} --no-binary-package lxml --no-binary-package xmlsec
880887
else
881888
# We only use uv here but Installing using constraints is not supported with `uv sync`, so we
882889
# do not use ``uv sync`` because we are not committing and using uv.lock yet.
@@ -933,8 +940,12 @@ function install_from_sources() {
933940
echo
934941
echo "${COLOR_BLUE}Falling back to no-constraints installation.${COLOR_RESET}"
935942
echo
943+
# --no-binary is needed in order to avoid libxml and xmlsec using different version of libxml2
944+
# (binary lxml embeds its own libxml2, while xmlsec uses system one).
945+
# See https://bugs.launchpad.net/lxml/+bug/2110068
936946
set -x
937-
uv sync --all-packages --group dev --group docs --group docs-gen --group leveldb ${extra_sync_flags}
947+
uv sync --all-packages --group dev --group docs --group docs-gen \
948+
--group leveldb ${extra_sync_flags} --no-binary-package lxml --no-binary-packag xmlsec
938949
set +x
939950
fi
940951
fi

Dockerfile.ci

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -412,11 +412,14 @@ function common::get_packaging_tool() {
412412
echo
413413
export PACKAGING_TOOL="uv"
414414
export PACKAGING_TOOL_CMD="uv pip"
415-
if [[ ${AIRFLOW_INSTALLATION_METHOD=} == "." && -f "./pyproject.toml" ]]; then
415+
# --no-binary is needed in order to avoid libxml and xmlsec using different version of libxml2
416+
# (binary lxml embeds its own libxml2, while xmlsec uses system one).
417+
# See https://bugs.launchpad.net/lxml/+bug/2110068
418+
if [[ ${AIRFLOW_INSTALLATION_METHOD=} == "." && -f "./pyproject.toml" ]]; then
416419
# for uv only install dev group when we install from sources
417-
export EXTRA_INSTALL_FLAGS="--group=dev"
420+
export EXTRA_INSTALL_FLAGS="--group=dev --no-binary lxml --no-binary xmlsec"
418421
else
419-
export EXTRA_INSTALL_FLAGS=""
422+
export EXTRA_INSTALL_FLAGS="--no-binary lxml --no-binary xmlsec"
420423
fi
421424
export EXTRA_UNINSTALL_FLAGS=""
422425
export UPGRADE_TO_HIGHEST_RESOLUTION="--upgrade --resolution highest"
@@ -628,8 +631,12 @@ function install_from_sources() {
628631
echo
629632
echo "${COLOR_BLUE}Attempting to upgrade all packages to highest versions.${COLOR_RESET}"
630633
echo
634+
# --no-binary is needed in order to avoid libxml and xmlsec using different version of libxml2
635+
# (binary lxml embeds its own libxml2, while xmlsec uses system one).
636+
# See https://bugs.launchpad.net/lxml/+bug/2110068
631637
set -x
632-
uv sync --all-packages --resolution highest --group dev --group docs --group docs-gen --group leveldb ${extra_sync_flags}
638+
uv sync --all-packages --resolution highest --group dev --group docs --group docs-gen \
639+
--group leveldb ${extra_sync_flags} --no-binary-package lxml --no-binary-package xmlsec
633640
else
634641
# We only use uv here but Installing using constraints is not supported with `uv sync`, so we
635642
# do not use ``uv sync`` because we are not committing and using uv.lock yet.
@@ -686,8 +693,12 @@ function install_from_sources() {
686693
echo
687694
echo "${COLOR_BLUE}Falling back to no-constraints installation.${COLOR_RESET}"
688695
echo
696+
# --no-binary is needed in order to avoid libxml and xmlsec using different version of libxml2
697+
# (binary lxml embeds its own libxml2, while xmlsec uses system one).
698+
# See https://bugs.launchpad.net/lxml/+bug/2110068
689699
set -x
690-
uv sync --all-packages --group dev --group docs --group docs-gen --group leveldb ${extra_sync_flags}
700+
uv sync --all-packages --group dev --group docs --group docs-gen \
701+
--group leveldb ${extra_sync_flags} --no-binary-package lxml --no-binary-packag xmlsec
691702
set +x
692703
fi
693704
fi
@@ -1125,13 +1136,19 @@ function check_force_lowest_dependencies() {
11251136
exit 0
11261137
fi
11271138
cd "${AIRFLOW_SOURCES}/providers/${provider_id/.//}" || exit 1
1128-
uv sync --resolution lowest-direct
1139+
# --no-binary is needed in order to avoid libxml and xmlsec using different version of libxml2
1140+
# (binary lxml embeds its own libxml2, while xmlsec uses system one).
1141+
# See https://bugs.launchpad.net/lxml/+bug/2110068
1142+
uv sync --resolution lowest-direct --no-binary-package lxml --no-binary-package xmlsec
11291143
else
11301144
echo
11311145
echo "${COLOR_BLUE}Forcing dependencies to lowest versions for Airflow.${COLOR_RESET}"
11321146
echo
11331147
cd "${AIRFLOW_SOURCES}/airflow-core"
1134-
uv sync --resolution lowest-direct
1148+
# --no-binary is needed in order to avoid libxml and xmlsec using different version of libxml2
1149+
# (binary lxml embeds its own libxml2, while xmlsec uses system one).
1150+
# See https://bugs.launchpad.net/lxml/+bug/2110068
1151+
uv sync --resolution lowest-direct --no-binary-package lxml --no-binary-package xmlsec
11351152
fi
11361153
}
11371154

scripts/docker/common.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,14 @@ function common::get_packaging_tool() {
4242
echo
4343
export PACKAGING_TOOL="uv"
4444
export PACKAGING_TOOL_CMD="uv pip"
45-
if [[ ${AIRFLOW_INSTALLATION_METHOD=} == "." && -f "./pyproject.toml" ]]; then
45+
# --no-binary is needed in order to avoid libxml and xmlsec using different version of libxml2
46+
# (binary lxml embeds its own libxml2, while xmlsec uses system one).
47+
# See https://bugs.launchpad.net/lxml/+bug/2110068
48+
if [[ ${AIRFLOW_INSTALLATION_METHOD=} == "." && -f "./pyproject.toml" ]]; then
4649
# for uv only install dev group when we install from sources
47-
export EXTRA_INSTALL_FLAGS="--group=dev"
50+
export EXTRA_INSTALL_FLAGS="--group=dev --no-binary lxml --no-binary xmlsec"
4851
else
49-
export EXTRA_INSTALL_FLAGS=""
52+
export EXTRA_INSTALL_FLAGS="--no-binary lxml --no-binary xmlsec"
5053
fi
5154
export EXTRA_UNINSTALL_FLAGS=""
5255
export UPGRADE_TO_HIGHEST_RESOLUTION="--upgrade --resolution highest"

scripts/docker/entrypoint_ci.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,13 +336,19 @@ function check_force_lowest_dependencies() {
336336
exit 0
337337
fi
338338
cd "${AIRFLOW_SOURCES}/providers/${provider_id/.//}" || exit 1
339-
uv sync --resolution lowest-direct
339+
# --no-binary is needed in order to avoid libxml and xmlsec using different version of libxml2
340+
# (binary lxml embeds its own libxml2, while xmlsec uses system one).
341+
# See https://bugs.launchpad.net/lxml/+bug/2110068
342+
uv sync --resolution lowest-direct --no-binary-package lxml --no-binary-package xmlsec
340343
else
341344
echo
342345
echo "${COLOR_BLUE}Forcing dependencies to lowest versions for Airflow.${COLOR_RESET}"
343346
echo
344347
cd "${AIRFLOW_SOURCES}/airflow-core"
345-
uv sync --resolution lowest-direct
348+
# --no-binary is needed in order to avoid libxml and xmlsec using different version of libxml2
349+
# (binary lxml embeds its own libxml2, while xmlsec uses system one).
350+
# See https://bugs.launchpad.net/lxml/+bug/2110068
351+
uv sync --resolution lowest-direct --no-binary-package lxml --no-binary-package xmlsec
346352
fi
347353
}
348354

scripts/docker/install_airflow_when_building_images.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,12 @@ function install_from_sources() {
5656
echo
5757
echo "${COLOR_BLUE}Attempting to upgrade all packages to highest versions.${COLOR_RESET}"
5858
echo
59+
# --no-binary is needed in order to avoid libxml and xmlsec using different version of libxml2
60+
# (binary lxml embeds its own libxml2, while xmlsec uses system one).
61+
# See https://bugs.launchpad.net/lxml/+bug/2110068
5962
set -x
60-
uv sync --all-packages --resolution highest --group dev --group docs --group docs-gen --group leveldb ${extra_sync_flags}
63+
uv sync --all-packages --resolution highest --group dev --group docs --group docs-gen \
64+
--group leveldb ${extra_sync_flags} --no-binary-package lxml --no-binary-package xmlsec
6165
else
6266
# We only use uv here but Installing using constraints is not supported with `uv sync`, so we
6367
# do not use ``uv sync`` because we are not committing and using uv.lock yet.
@@ -114,8 +118,12 @@ function install_from_sources() {
114118
echo
115119
echo "${COLOR_BLUE}Falling back to no-constraints installation.${COLOR_RESET}"
116120
echo
121+
# --no-binary is needed in order to avoid libxml and xmlsec using different version of libxml2
122+
# (binary lxml embeds its own libxml2, while xmlsec uses system one).
123+
# See https://bugs.launchpad.net/lxml/+bug/2110068
117124
set -x
118-
uv sync --all-packages --group dev --group docs --group docs-gen --group leveldb ${extra_sync_flags}
125+
uv sync --all-packages --group dev --group docs --group docs-gen \
126+
--group leveldb ${extra_sync_flags} --no-binary-package lxml --no-binary-packag xmlsec
119127
set +x
120128
fi
121129
fi

0 commit comments

Comments
 (0)