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 b8cdd284dd Add better instructions to constraint files (#33367)
b8cdd284dd is described below
commit b8cdd284dd6e7197c8045cbce614b83b235d23a9
Author: Jarek Potiuk <[email protected]>
AuthorDate: Mon Aug 14 17:59:26 2023 +0200
Add better instructions to constraint files (#33367)
Following up after discussion in #33241 this PR adds more
straightforward instructions on how constraints should (or should
not) be used.
Having the instructions in the constraint files increases the
chance that users will use the constraints as intended.
---
scripts/in_container/run_generate_constraints.sh | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/scripts/in_container/run_generate_constraints.sh
b/scripts/in_container/run_generate_constraints.sh
index e6f8a95458..717db01339 100755
--- a/scripts/in_container/run_generate_constraints.sh
+++ b/scripts/in_container/run_generate_constraints.sh
@@ -81,6 +81,26 @@ elif [[ ${AIRFLOW_CONSTRAINTS_MODE} == "constraints" ]]; then
# We also use those constraints after "apache-airflow" is released and the
constraints are tagged with
# "constraints-X.Y.Z" tag to build the production image for that version.
#
+# This constraints file is meant to be used only in the "apache-airflow"
installation command and not
+# in all subsequent pip commands. By using a constraints.txt file, we ensure
that solely the Airflow
+# installation step is reproducible. Subsequent pip commands may install
packages that would have
+# been incompatible with the constraints used in Airflow reproducible
installation step. Finally, pip
+# commands that might change the installed version of apache-airflow should
include "apache-airflow==X.Y.Z"
+# in the list of install targets to prevent Airflow accidental upgrade or
downgrade.
+#
+# Typical installation process of airflow for Python 3.8 is (with random
selection of extras and custom
+# dependencies added), usually consists of two steps:
+#
+# 1. Reproducible installation of airflow with selected providers (note
constraints are used):
+#
+# pip install
"apache-airflow[celery,cncf.kubernetes,google,amazon,snowflake]==X.Y.Z" \
+# --constraint
"https://raw.githubusercontent.com/apache/airflow/constraints-X.Y.Z/constraints-3.8.txt"
+#
+# 2. Installing own dependencies that are potentially not matching the
constraints (note constraints are not
+# used, and apache-airflow==X.Y.Z is used to make sure there is no
accidental airflow upgrade/downgrade.
+#
+# pip install "apache-airflow==X.Y.Z"
"snowflake-connector-python[pandas]==2.9.0"
+#
EOF
else
echo