Skip to content

Commit b9245ca

Browse files
potiukCloud Composer Team
authored and
Cloud Composer Team
committed
Bring back min-airflow-version for preinstalled providers (#31469)
In the last wave of providers #31416 we bumped min-airlfow-version to 2.4 and added mechanism to verify min-airflow version is ok while importing, but it turned out that there are cases where installing just old version of airflow (with no constraints) brings the latest version of those providers and causes new installation of airflow to fail. This is far too common to ignore or require to use constraints, unfortunately  We do not have min-airlfow-version in the preinstalled providers for one reason only. For some tools that are NOT conforming to standards (such as bazel), having min-airflow-version for those providers causes circular dependency (even though technically dependencies in PyPI can - and often are - circular, because dependencies in Python are not DAG and can contain cycles. This was in response to this issue in 2021 #17795. However, this is really bazel issue, and on top of it - it's recognized as such and being fixed very recently in bazelbuild/rules_python#1188 because there are other packages that have similar problems (pytorch and triton being popular couple). Also Bazel is not that popular in the Python world.  Therefore, rather than trying to workaround the problem of bazel, we encourage them to merge and release the fix bazelbuild/rules_python#1166 (comment) and call it out in our installation instructions, that bazel installation might lead to problems like that. If bazel does not fix it, this will only be a problem for Future installations of airflow in a few months most likely. It will not impact current bazel users installing old versions of Airflow (actually they might start having problems now if we do not fix it and yank the 5 providers released yesterday) GitOrigin-RevId: 547e352578fac92f072b269dc257d21cdc279d97
1 parent e042d67 commit b9245ca

File tree

16 files changed

+88
-35
lines changed

16 files changed

+88
-35
lines changed

CONTRIBUTING.rst

+10
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,11 @@ Airflow dependencies
593593
``pip`` - especially when it comes to constraint vs. requirements management.
594594
Installing via ``Poetry`` or ``pip-tools`` is not currently supported.
595595

596+
There are known issues with ``bazel`` that might lead to circular dependencies when using it to install
597+
Airflow. Please switch to ``pip`` if you encounter such problems. ``Bazel`` community works on fixing
598+
the problem in `this PR <https://github.com/bazelbuild/rules_python/pull/1166>`_ so it might be that
599+
newer versions of ``bazel`` will handle it.
600+
596601
If you wish to install airflow using those tools you should use the constraint files and convert
597602
them to appropriate format and workflow that your tool requires.
598603

@@ -796,6 +801,11 @@ Pinned constraint files
796801
``pip`` - especially when it comes to constraint vs. requirements management.
797802
Installing via ``Poetry`` or ``pip-tools`` is not currently supported.
798803

804+
There are known issues with ``bazel`` that might lead to circular dependencies when using it to install
805+
Airflow. Please switch to ``pip`` if you encounter such problems. ``Bazel`` community works on fixing
806+
the problem in `this PR <https://github.com/bazelbuild/rules_python/pull/1166>`_ so it might be that
807+
newer versions of ``bazel`` will handle it.
808+
799809
If you wish to install airflow using those tools you should use the constraint files and convert
800810
them to appropriate format and workflow that your tool requires.
801811

IMAGES.rst

+5
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@ This will build the image using command similar to:
147147
``pip`` - especially when it comes to constraint vs. requirements management.
148148
Installing via ``Poetry`` or ``pip-tools`` is not currently supported.
149149

150+
There are known issues with ``bazel`` that might lead to circular dependencies when using it to install
151+
Airflow. Please switch to ``pip`` if you encounter such problems. ``Bazel`` community works on fixing
152+
the problem in `this PR <https://github.com/bazelbuild/rules_python/pull/1166>`_ so it might be that
153+
newer versions of ``bazel`` will handle it.
154+
150155
If you wish to install airflow using those tools you should use the constraint files and convert
151156
them to appropriate format and workflow that your tool requires.
152157

LOCAL_VIRTUALENV.rst

+10
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ Extra Packages
7070
``pip`` - especially when it comes to constraint vs. requirements management.
7171
Installing via ``Poetry`` or ``pip-tools`` is not currently supported.
7272

73+
There are known issues with ``bazel`` that might lead to circular dependencies when using it to install
74+
Airflow. Please switch to ``pip`` if you encounter such problems. ``Bazel`` community works on fixing
75+
the problem in `this PR <https://github.com/bazelbuild/rules_python/pull/1166>`_ so it might be that
76+
n ewer versions of ``bazel`` will handle it.
77+
7378
If you wish to install airflow using those tools you should use the constraint files and convert
7479
them to appropriate format and workflow that your tool requires.
7580

@@ -136,6 +141,11 @@ To create and initialize the local virtualenv:
136141
``pip`` - especially when it comes to constraint vs. requirements management.
137142
Installing via ``Poetry`` or ``pip-tools`` is not currently supported.
138143

144+
There are known issues with ``bazel`` that might lead to circular dependencies when using it to install
145+
Airflow. Please switch to ``pip`` if you encounter such problems. ``Bazel`` community works on fixing
146+
the problem in `this PR <https://github.com/bazelbuild/rules_python/pull/1166>`_ so it might be that
147+
newer versions of ``bazel`` will handle it.
148+
139149
If you wish to install airflow using those tools you should use the constraint files and convert
140150
them to appropriate format and workflow that your tool requires.
141151

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,11 @@ While it is possible to install Airflow with tools like [Poetry](https://python-
153153
`pip` - especially when it comes to constraint vs. requirements management.
154154
Installing via `Poetry` or `pip-tools` is not currently supported.
155155

156+
There are known issues with ``bazel`` that might lead to circular dependencies when using it to install
157+
Airflow. Please switch to ``pip`` if you encounter such problems. ``Bazel`` community works on fixing
158+
the problem in `this PR <https://github.com/bazelbuild/rules_python/pull/1166>`_ so it might be that
159+
newer versions of ``bazel`` will handle it.
160+
156161
If you wish to install Airflow using those tools, you should use the constraint files and convert
157162
them to the appropriate format and workflow that your tool requires.
158163

airflow/providers/common/sql/provider.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ versions:
3535
- 1.0.0
3636

3737
dependencies:
38+
- apache-airflow>=2.4.0
3839
- sqlparse>=0.4.2
3940

4041
additional-extras:

airflow/providers/ftp/provider.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ versions:
3838
- 1.0.1
3939
- 1.0.0
4040

41-
dependencies: []
41+
dependencies:
42+
- apache-airflow>=2.4.0
4243

4344
integrations:
4445
- integration-name: File Transfer Protocol (FTP)

airflow/providers/http/provider.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ versions:
4242
- 1.0.0
4343

4444
dependencies:
45+
- apache-airflow>=2.4.0
4546
# The 2.26.0 release of requests got rid of the chardet LGPL mandatory dependency, allowing us to
4647
# release it as a requirement for airflow
4748
- requests>=2.26.0

airflow/providers/imap/provider.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ versions:
3838
- 1.0.1
3939
- 1.0.0
4040

41-
dependencies: []
41+
dependencies:
42+
- apache-airflow>=2.4.0
4243

4344
integrations:
4445
- integration-name: Internet Message Access Protocol (IMAP)

airflow/providers/sqlite/provider.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ versions:
4242
- 1.0.0
4343

4444
dependencies:
45+
- apache-airflow>=2.4.0
4546
- apache-airflow-providers-common-sql>=1.3.1
4647

4748
integrations:

dev/provider_packages/PROVIDER_INDEX_TEMPLATE.rst.jinja2

-14
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,6 @@ Requirements
5656

5757
The minimum Apache Airflow version supported by this provider package is ``{{ MIN_AIRFLOW_VERSION }}``.
5858

59-
{%- if PREINSTALLED_PROVIDER %}
60-
61-
This provider package is preinstalled by default when Apache Airflow is installed. You do not need to
62-
install it separately. You can upgrade and downgrade it independently of Apache Airflow package though.
63-
64-
.. note::
65-
66-
The minimum Apache Airflow version for this package is {{ MIN_AIRFLOW_VERSION }} and it will fail
67-
import at runtime if the version of Airflow is lower even if there is no requirement specified in
68-
the dependencies - this is because the provider is preinstalled and specifying minimum Apache
69-
Airflow version would create a dependency cycle, which confuses dependency tools.
70-
71-
{%- endif %}
72-
7359
{%- if PIP_REQUIREMENTS %}
7460

7561
{{ PIP_REQUIREMENTS_TABLE_RST | safe}}

dev/provider_packages/prepare_provider_packages.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1348,10 +1348,9 @@ def update_min_airflow_version(provider_package_id: str, version_suffix: str):
13481348
context=jinja_context,
13491349
target_path=provider_details.source_provider_package_path,
13501350
)
1351-
if not jinja_context["PREINSTALLED_PROVIDER"]:
1352-
replace_min_airflow_version_in_provider_yaml(
1353-
context=jinja_context, target_path=provider_details.source_provider_package_path
1354-
)
1351+
replace_min_airflow_version_in_provider_yaml(
1352+
context=jinja_context, target_path=provider_details.source_provider_package_path
1353+
)
13551354

13561355

13571356
def update_setup_files(

docs/apache-airflow-providers/installing-from-pypi.rst

+14-6
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,20 @@ Installation tools
2626

2727
Only ``pip`` installation is currently officially supported.
2828

29-
While there are some successes with using other tools like `poetry <https://python-poetry.org/>`_ or
30-
`pip-tools <https://pypi.org/project/pip-tools/>`_, they do not share the same workflow as
31-
``pip`` - especially when it comes to constraint vs. requirements management.
32-
Installing via ``Poetry`` or ``pip-tools`` is not currently supported. If you wish to install airflow
33-
using those tools you should use the constraints and convert them to appropriate
34-
format and workflow that your tool requires.
29+
.. note::
30+
31+
While there are some successes with using other tools like `poetry <https://python-poetry.org/>`_ or
32+
`pip-tools <https://pypi.org/project/pip-tools/>`_, they do not share the same workflow as
33+
``pip`` - especially when it comes to constraint vs. requirements management.
34+
Installing via ``Poetry`` or ``pip-tools`` is not currently supported. If you wish to install airflow
35+
using those tools you should use the constraints and convert them to appropriate
36+
format and workflow that your tool requires.
37+
38+
There are known issues with ``bazel`` that might lead to circular dependencies when using it to install
39+
Airflow. Please switch to ``pip`` if you encounter such problems. ``Bazel`` community works on fixing
40+
the problem in `this PR <https://github.com/bazelbuild/rules_python/pull/1166>`_ so it might be that
41+
newer versions of ``bazel`` will handle it.
42+
3543

3644
Typical command to install airflow from PyPI looks like below (you need to use the right Airflow version and Python version):
3745

docs/apache-airflow/howto/upgrading-from-1-10/upgrade-check.rst

+6
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ time of writing: 1.10.15) and then to download this package and run the script a
4343
``pip`` - especially when it comes to constraint vs. requirements management.
4444
Installing via ``Poetry`` or ``pip-tools`` is not currently supported.
4545

46+
There are known issues with ``bazel`` that might lead to circular dependencies when using it to install
47+
Airflow. Please switch to ``pip`` if you encounter such problems. ``Bazel`` community works on fixing
48+
the problem in `this PR <https://github.com/bazelbuild/rules_python/pull/1166>`_ so it might be that
49+
newer versions of ``bazel`` will handle it.
50+
51+
4652
If you wish to install airflow using those tools you should use the constraint files and convert
4753
them to appropriate format and workflow that your tool requires.
4854

docs/apache-airflow/installation/installing-from-pypi.rst

+13-6
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,19 @@ Installation tools
2626

2727
Only ``pip`` installation is currently officially supported.
2828

29-
While there are some successes with using other tools like `poetry <https://python-poetry.org/>`_ or
30-
`pip-tools <https://pypi.org/project/pip-tools/>`_, they do not share the same workflow as
31-
``pip`` - especially when it comes to constraint vs. requirements management.
32-
Installing via ``Poetry`` or ``pip-tools`` is not currently supported. If you wish to install airflow
33-
using those tools you should use the constraints and convert them to appropriate
34-
format and workflow that your tool requires.
29+
.. note::
30+
31+
While there are some successes with using other tools like `poetry <https://python-poetry.org/>`_ or
32+
`pip-tools <https://pypi.org/project/pip-tools/>`_, they do not share the same workflow as
33+
``pip`` - especially when it comes to constraint vs. requirements management.
34+
Installing via ``Poetry`` or ``pip-tools`` is not currently supported. If you wish to install airflow
35+
using those tools you should use the constraints and convert them to appropriate
36+
format and workflow that your tool requires.
37+
38+
There are known issues with ``bazel`` that might lead to circular dependencies when using it to install
39+
Airflow. Please switch to ``pip`` if you encounter such problems. ``Bazel`` community works on fixing
40+
the problem in `this PR <https://github.com/bazelbuild/rules_python/pull/1166>`_ so it might be that
41+
newer versions of ``bazel`` will handle it.
3542

3643
Typical command to install airflow from PyPI looks like below:
3744

docs/apache-airflow/start.rst

+5
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ This quick start guide will help you bootstrap an Airflow standalone instance on
3434
``pip`` - especially when it comes to constraint vs. requirements management.
3535
Installing via ``Poetry`` or ``pip-tools`` is not currently supported.
3636

37+
There are known issues with ``bazel`` that might lead to circular dependencies when using it to install
38+
Airflow. Please switch to ``pip`` if you encounter such problems. ``Bazel`` community works on fixing
39+
the problem in `this PR <https://github.com/bazelbuild/rules_python/pull/1166>`_ so it might be that
40+
newer versions of ``bazel`` will handle it.
41+
3742
If you wish to install Airflow using those tools you should use the constraint files and convert
3843
them to appropriate format and workflow that your tool requires.
3944

generated/provider_dependencies.json

+10-3
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@
255255
},
256256
"common.sql": {
257257
"deps": [
258+
"apache-airflow>=2.4.0",
258259
"sqlparse>=0.4.2"
259260
],
260261
"cross-providers-deps": [],
@@ -356,7 +357,9 @@
356357
"excluded-python-versions": []
357358
},
358359
"ftp": {
359-
"deps": [],
360+
"deps": [
361+
"apache-airflow>=2.4.0"
362+
],
360363
"cross-providers-deps": [],
361364
"excluded-python-versions": []
362365
},
@@ -467,6 +470,7 @@
467470
"http": {
468471
"deps": [
469472
"aiohttp",
473+
"apache-airflow>=2.4.0",
470474
"asgiref",
471475
"requests>=2.26.0",
472476
"requests_toolbelt"
@@ -475,7 +479,9 @@
475479
"excluded-python-versions": []
476480
},
477481
"imap": {
478-
"deps": [],
482+
"deps": [
483+
"apache-airflow>=2.4.0"
484+
],
479485
"cross-providers-deps": [],
480486
"excluded-python-versions": []
481487
},
@@ -795,7 +801,8 @@
795801
},
796802
"sqlite": {
797803
"deps": [
798-
"apache-airflow-providers-common-sql>=1.3.1"
804+
"apache-airflow-providers-common-sql>=1.3.1",
805+
"apache-airflow>=2.4.0"
799806
],
800807
"cross-providers-deps": [
801808
"common.sql"

0 commit comments

Comments
 (0)