Skip to content

Commit eef5bc7

Browse files
authored
Add full automation for min Airflow version for providers (#30994)
This change adds full automation for keeping and updating min airflow version for all community providers. It makes sure that: * all non-preinstalled providers have min-airflow-version set properly * all providers (including the preinstalled ones) additionally perform a runtime check on whether correct version of Airflow is installed. * allows for exceptional cases for some providers to be set * all providers have `version` added and exported in their `__init__.py` Usually just setting the airflow version in requirements should be enough, but since we have to install runtime check for preinstalled providers, it's easier to add the runtime check for all providers, and it will be additional verification that airflow version is properly set. Additionally, we can export correct version in the automatically generated `__init__.py` for all providers. The pre-installed providers cannot have explicit minimum airflow version specified as requirement, because this would create a dependency cycle with Airflow, and while such dependency cycle is fine for `pip`, other tools that analyse dependencies get confused and produce errors, claiming there cannot be dependenc cycles in the dependency tree (which is not generally a hard requirement, package dependency graph does not have to be DAG and it can contain cycles). This is why we have to add runtime check in the preinstalled providers to fail when they are installed with older Airflow versions than the ones that are supported by our policy. This PR automates maintenance of all the versions involved during prepearation of release documentation - it has been somewhat manual procedure so far, because it was only set in provider.yaml, but since now we set it in several places, it requires automation and single source of truth (which is prepare_provider_packages.py script that is used for preparation of provider documenation and packages.
1 parent 20b4789 commit eef5bc7

File tree

105 files changed

+2010
-201
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+2010
-201
lines changed

β€Žairflow/providers/airbyte/__init__.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,24 @@
1515
# KIND, either express or implied. See the License for the
1616
# specific language governing permissions and limitations
1717
# under the License.
18+
#
19+
# NOTE! THIS FILE IS AUTOMATICALLY GENERATED AND WILL BE
20+
# OVERWRITTEN WHEN PREPARING DOCUMENTATION FOR THE PACKAGES.
21+
#
22+
# IF YOU WANT TO MODIFY IT, YOU SHOULD MODIFY THE TEMPLATE
23+
# `PROVIDER__INIT__PY_TEMPLATE.py.jinja2` IN the `dev/provider_packages` DIRECTORY
24+
#
25+
from __future__ import annotations
26+
27+
import packaging.version
28+
29+
import airflow
30+
31+
__all__ = ["version"]
32+
33+
version = "3.2.1"
34+
35+
if packaging.version.parse(airflow.version.version) < packaging.version.parse("2.4.0"):
36+
raise RuntimeError(
37+
f"The package `apache-airflow-providers-airbyte:{version}` requires Apache Airflow 2.4.0+"
38+
)

β€Žairflow/providers/alibaba/__init__.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,24 @@
1515
# KIND, either express or implied. See the License for the
1616
# specific language governing permissions and limitations
1717
# under the License.
18+
#
19+
# NOTE! THIS FILE IS AUTOMATICALLY GENERATED AND WILL BE
20+
# OVERWRITTEN WHEN PREPARING DOCUMENTATION FOR THE PACKAGES.
21+
#
22+
# IF YOU WANT TO MODIFY IT, YOU SHOULD MODIFY THE TEMPLATE
23+
# `PROVIDER__INIT__PY_TEMPLATE.py.jinja2` IN the `dev/provider_packages` DIRECTORY
24+
#
25+
from __future__ import annotations
26+
27+
import packaging.version
28+
29+
import airflow
30+
31+
__all__ = ["version"]
32+
33+
version = "2.3.0"
34+
35+
if packaging.version.parse(airflow.version.version) < packaging.version.parse("2.4.0"):
36+
raise RuntimeError(
37+
f"The package `apache-airflow-providers-alibaba:{version}` requires Apache Airflow 2.4.0+"
38+
)

β€Žairflow/providers/amazon/__init__.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#
12
# Licensed to the Apache Software Foundation (ASF) under one
23
# or more contributor license agreements. See the NOTICE file
34
# distributed with this work for additional information
@@ -14,3 +15,24 @@
1415
# KIND, either express or implied. See the License for the
1516
# specific language governing permissions and limitations
1617
# under the License.
18+
#
19+
# NOTE! THIS FILE IS AUTOMATICALLY GENERATED AND WILL BE
20+
# OVERWRITTEN WHEN PREPARING DOCUMENTATION FOR THE PACKAGES.
21+
#
22+
# IF YOU WANT TO MODIFY IT, YOU SHOULD MODIFY THE TEMPLATE
23+
# `PROVIDER__INIT__PY_TEMPLATE.py.jinja2` IN the `dev/provider_packages` DIRECTORY
24+
#
25+
from __future__ import annotations
26+
27+
import packaging.version
28+
29+
import airflow
30+
31+
__all__ = ["version"]
32+
33+
version = "8.0.0"
34+
35+
if packaging.version.parse(airflow.version.version) < packaging.version.parse("2.4.0"):
36+
raise RuntimeError(
37+
f"The package `apache-airflow-providers-amazon:{version}` requires Apache Airflow 2.4.0+"
38+
)

β€Žairflow/providers/apache/beam/__init__.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,24 @@
1515
# KIND, either express or implied. See the License for the
1616
# specific language governing permissions and limitations
1717
# under the License.
18+
#
19+
# NOTE! THIS FILE IS AUTOMATICALLY GENERATED AND WILL BE
20+
# OVERWRITTEN WHEN PREPARING DOCUMENTATION FOR THE PACKAGES.
21+
#
22+
# IF YOU WANT TO MODIFY IT, YOU SHOULD MODIFY THE TEMPLATE
23+
# `PROVIDER__INIT__PY_TEMPLATE.py.jinja2` IN the `dev/provider_packages` DIRECTORY
24+
#
25+
from __future__ import annotations
26+
27+
import packaging.version
28+
29+
import airflow
30+
31+
__all__ = ["version"]
32+
33+
version = "5.0.0"
34+
35+
if packaging.version.parse(airflow.version.version) < packaging.version.parse("2.4.0"):
36+
raise RuntimeError(
37+
f"The package `apache-airflow-providers-apache-beam:{version}` requires Apache Airflow 2.4.0+"
38+
)

β€Žairflow/providers/apache/cassandra/__init__.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#
12
# Licensed to the Apache Software Foundation (ASF) under one
23
# or more contributor license agreements. See the NOTICE file
34
# distributed with this work for additional information
@@ -14,3 +15,24 @@
1415
# KIND, either express or implied. See the License for the
1516
# specific language governing permissions and limitations
1617
# under the License.
18+
#
19+
# NOTE! THIS FILE IS AUTOMATICALLY GENERATED AND WILL BE
20+
# OVERWRITTEN WHEN PREPARING DOCUMENTATION FOR THE PACKAGES.
21+
#
22+
# IF YOU WANT TO MODIFY IT, YOU SHOULD MODIFY THE TEMPLATE
23+
# `PROVIDER__INIT__PY_TEMPLATE.py.jinja2` IN the `dev/provider_packages` DIRECTORY
24+
#
25+
from __future__ import annotations
26+
27+
import packaging.version
28+
29+
import airflow
30+
31+
__all__ = ["version"]
32+
33+
version = "3.1.1"
34+
35+
if packaging.version.parse(airflow.version.version) < packaging.version.parse("2.4.0"):
36+
raise RuntimeError(
37+
f"The package `apache-airflow-providers-apache-cassandra:{version}` requires Apache Airflow 2.4.0+"
38+
)

β€Žairflow/providers/apache/drill/__init__.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,24 @@
1515
# KIND, either express or implied. See the License for the
1616
# specific language governing permissions and limitations
1717
# under the License.
18+
#
19+
# NOTE! THIS FILE IS AUTOMATICALLY GENERATED AND WILL BE
20+
# OVERWRITTEN WHEN PREPARING DOCUMENTATION FOR THE PACKAGES.
21+
#
22+
# IF YOU WANT TO MODIFY IT, YOU SHOULD MODIFY THE TEMPLATE
23+
# `PROVIDER__INIT__PY_TEMPLATE.py.jinja2` IN the `dev/provider_packages` DIRECTORY
24+
#
25+
from __future__ import annotations
26+
27+
import packaging.version
28+
29+
import airflow
30+
31+
__all__ = ["version"]
32+
33+
version = "2.3.2"
34+
35+
if packaging.version.parse(airflow.version.version) < packaging.version.parse("2.4.0"):
36+
raise RuntimeError(
37+
f"The package `apache-airflow-providers-apache-drill:{version}` requires Apache Airflow 2.4.0+"
38+
)

β€Žairflow/providers/apache/druid/__init__.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,24 @@
1515
# KIND, either express or implied. See the License for the
1616
# specific language governing permissions and limitations
1717
# under the License.
18+
#
19+
# NOTE! THIS FILE IS AUTOMATICALLY GENERATED AND WILL BE
20+
# OVERWRITTEN WHEN PREPARING DOCUMENTATION FOR THE PACKAGES.
21+
#
22+
# IF YOU WANT TO MODIFY IT, YOU SHOULD MODIFY THE TEMPLATE
23+
# `PROVIDER__INIT__PY_TEMPLATE.py.jinja2` IN the `dev/provider_packages` DIRECTORY
24+
#
25+
from __future__ import annotations
26+
27+
import packaging.version
28+
29+
import airflow
30+
31+
__all__ = ["version"]
32+
33+
version = "3.3.1"
34+
35+
if packaging.version.parse(airflow.version.version) < packaging.version.parse("2.4.0"):
36+
raise RuntimeError(
37+
f"The package `apache-airflow-providers-apache-druid:{version}` requires Apache Airflow 2.4.0+"
38+
)

β€Žairflow/providers/apache/flink/__init__.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,24 @@
1515
# KIND, either express or implied. See the License for the
1616
# specific language governing permissions and limitations
1717
# under the License.
18+
#
19+
# NOTE! THIS FILE IS AUTOMATICALLY GENERATED AND WILL BE
20+
# OVERWRITTEN WHEN PREPARING DOCUMENTATION FOR THE PACKAGES.
21+
#
22+
# IF YOU WANT TO MODIFY IT, YOU SHOULD MODIFY THE TEMPLATE
23+
# `PROVIDER__INIT__PY_TEMPLATE.py.jinja2` IN the `dev/provider_packages` DIRECTORY
24+
#
25+
from __future__ import annotations
26+
27+
import packaging.version
28+
29+
import airflow
30+
31+
__all__ = ["version"]
32+
33+
version = "1.0.1"
34+
35+
if packaging.version.parse(airflow.version.version) < packaging.version.parse("2.4.0"):
36+
raise RuntimeError(
37+
f"The package `apache-airflow-providers-apache-flink:{version}` requires Apache Airflow 2.4.0+"
38+
)

β€Žairflow/providers/apache/hdfs/__init__.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,24 @@
1515
# KIND, either express or implied. See the License for the
1616
# specific language governing permissions and limitations
1717
# under the License.
18+
#
19+
# NOTE! THIS FILE IS AUTOMATICALLY GENERATED AND WILL BE
20+
# OVERWRITTEN WHEN PREPARING DOCUMENTATION FOR THE PACKAGES.
21+
#
22+
# IF YOU WANT TO MODIFY IT, YOU SHOULD MODIFY THE TEMPLATE
23+
# `PROVIDER__INIT__PY_TEMPLATE.py.jinja2` IN the `dev/provider_packages` DIRECTORY
24+
#
25+
from __future__ import annotations
26+
27+
import packaging.version
28+
29+
import airflow
30+
31+
__all__ = ["version"]
32+
33+
version = "3.2.1"
34+
35+
if packaging.version.parse(airflow.version.version) < packaging.version.parse("2.4.0"):
36+
raise RuntimeError(
37+
f"The package `apache-airflow-providers-apache-hdfs:{version}` requires Apache Airflow 2.4.0+"
38+
)

β€Žairflow/providers/apache/hive/__init__.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,24 @@
1515
# KIND, either express or implied. See the License for the
1616
# specific language governing permissions and limitations
1717
# under the License.
18+
#
19+
# NOTE! THIS FILE IS AUTOMATICALLY GENERATED AND WILL BE
20+
# OVERWRITTEN WHEN PREPARING DOCUMENTATION FOR THE PACKAGES.
21+
#
22+
# IF YOU WANT TO MODIFY IT, YOU SHOULD MODIFY THE TEMPLATE
23+
# `PROVIDER__INIT__PY_TEMPLATE.py.jinja2` IN the `dev/provider_packages` DIRECTORY
24+
#
25+
from __future__ import annotations
26+
27+
import packaging.version
28+
29+
import airflow
30+
31+
__all__ = ["version"]
32+
33+
version = "6.0.0"
34+
35+
if packaging.version.parse(airflow.version.version) < packaging.version.parse("2.4.0"):
36+
raise RuntimeError(
37+
f"The package `apache-airflow-providers-apache-hive:{version}` requires Apache Airflow 2.4.0+"
38+
)

0 commit comments

Comments
 (0)