Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing circular import error in providers caused by airflow version check #31379

Merged
merged 10 commits into from
May 18, 2023
9 changes: 6 additions & 3 deletions airflow/providers/airbyte/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@

import packaging.version

import airflow

__all__ = ["version"]

version = "3.3.0"

if packaging.version.parse(airflow.version.version) < packaging.version.parse("2.4.0"):
try:
from airflow import __version__ as airflow_version
except ImportError:
from airflow.version import version as airflow_version

if packaging.version.parse(airflow_version) < packaging.version.parse("2.4.0"):
raise RuntimeError(
f"The package `apache-airflow-providers-airbyte:{version}` requires Apache Airflow 2.4.0+"
)
9 changes: 6 additions & 3 deletions airflow/providers/alibaba/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@

import packaging.version

import airflow

__all__ = ["version"]

version = "2.4.0"

if packaging.version.parse(airflow.version.version) < packaging.version.parse("2.4.0"):
try:
from airflow import __version__ as airflow_version
except ImportError:
from airflow.version import version as airflow_version

if packaging.version.parse(airflow_version) < packaging.version.parse("2.4.0"):
raise RuntimeError(
f"The package `apache-airflow-providers-alibaba:{version}` requires Apache Airflow 2.4.0+"
)
9 changes: 6 additions & 3 deletions airflow/providers/amazon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@

import packaging.version

import airflow

__all__ = ["version"]

version = "8.1.0"

if packaging.version.parse(airflow.version.version) < packaging.version.parse("2.4.0"):
try:
from airflow import __version__ as airflow_version
except ImportError:
from airflow.version import version as airflow_version

if packaging.version.parse(airflow_version) < packaging.version.parse("2.4.0"):
raise RuntimeError(
f"The package `apache-airflow-providers-amazon:{version}` requires Apache Airflow 2.4.0+"
)
9 changes: 6 additions & 3 deletions airflow/providers/apache/beam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@

import packaging.version

import airflow

__all__ = ["version"]

version = "5.1.0"

if packaging.version.parse(airflow.version.version) < packaging.version.parse("2.4.0"):
try:
from airflow import __version__ as airflow_version
except ImportError:
from airflow.version import version as airflow_version

if packaging.version.parse(airflow_version) < packaging.version.parse("2.4.0"):
raise RuntimeError(
f"The package `apache-airflow-providers-apache-beam:{version}` requires Apache Airflow 2.4.0+"
)
9 changes: 6 additions & 3 deletions airflow/providers/apache/cassandra/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@

import packaging.version

import airflow

__all__ = ["version"]

version = "3.2.0"

if packaging.version.parse(airflow.version.version) < packaging.version.parse("2.4.0"):
try:
from airflow import __version__ as airflow_version
except ImportError:
from airflow.version import version as airflow_version

if packaging.version.parse(airflow_version) < packaging.version.parse("2.4.0"):
raise RuntimeError(
f"The package `apache-airflow-providers-apache-cassandra:{version}` requires Apache Airflow 2.4.0+"
)
9 changes: 6 additions & 3 deletions airflow/providers/apache/drill/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@

import packaging.version

import airflow

__all__ = ["version"]

version = "2.4.0"

if packaging.version.parse(airflow.version.version) < packaging.version.parse("2.4.0"):
try:
from airflow import __version__ as airflow_version
except ImportError:
from airflow.version import version as airflow_version

if packaging.version.parse(airflow_version) < packaging.version.parse("2.4.0"):
raise RuntimeError(
f"The package `apache-airflow-providers-apache-drill:{version}` requires Apache Airflow 2.4.0+"
)
9 changes: 6 additions & 3 deletions airflow/providers/apache/druid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@

import packaging.version

import airflow

__all__ = ["version"]

version = "3.4.0"

if packaging.version.parse(airflow.version.version) < packaging.version.parse("2.4.0"):
try:
from airflow import __version__ as airflow_version
except ImportError:
from airflow.version import version as airflow_version

if packaging.version.parse(airflow_version) < packaging.version.parse("2.4.0"):
raise RuntimeError(
f"The package `apache-airflow-providers-apache-druid:{version}` requires Apache Airflow 2.4.0+"
)
9 changes: 6 additions & 3 deletions airflow/providers/apache/flink/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@

import packaging.version

import airflow

__all__ = ["version"]

version = "1.1.0"

if packaging.version.parse(airflow.version.version) < packaging.version.parse("2.4.0"):
try:
from airflow import __version__ as airflow_version
except ImportError:
from airflow.version import version as airflow_version

if packaging.version.parse(airflow_version) < packaging.version.parse("2.4.0"):
raise RuntimeError(
f"The package `apache-airflow-providers-apache-flink:{version}` requires Apache Airflow 2.4.0+"
)
9 changes: 6 additions & 3 deletions airflow/providers/apache/hdfs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@

import packaging.version

import airflow

__all__ = ["version"]

version = "4.0.0"

if packaging.version.parse(airflow.version.version) < packaging.version.parse("2.4.0"):
try:
from airflow import __version__ as airflow_version
except ImportError:
from airflow.version import version as airflow_version

if packaging.version.parse(airflow_version) < packaging.version.parse("2.4.0"):
raise RuntimeError(
f"The package `apache-airflow-providers-apache-hdfs:{version}` requires Apache Airflow 2.4.0+"
)
9 changes: 6 additions & 3 deletions airflow/providers/apache/hive/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@

import packaging.version

import airflow

__all__ = ["version"]

version = "6.1.0"

if packaging.version.parse(airflow.version.version) < packaging.version.parse("2.4.0"):
try:
from airflow import __version__ as airflow_version
except ImportError:
from airflow.version import version as airflow_version

if packaging.version.parse(airflow_version) < packaging.version.parse("2.4.0"):
raise RuntimeError(
f"The package `apache-airflow-providers-apache-hive:{version}` requires Apache Airflow 2.4.0+"
)
9 changes: 6 additions & 3 deletions airflow/providers/apache/impala/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@

import packaging.version

import airflow

__all__ = ["version"]

version = "1.1.0"

if packaging.version.parse(airflow.version.version) < packaging.version.parse("2.4.0"):
try:
from airflow import __version__ as airflow_version
except ImportError:
from airflow.version import version as airflow_version

if packaging.version.parse(airflow_version) < packaging.version.parse("2.4.0"):
raise RuntimeError(
f"The package `apache-airflow-providers-apache-impala:{version}` requires Apache Airflow 2.4.0+"
)
9 changes: 6 additions & 3 deletions airflow/providers/apache/kafka/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@

import packaging.version

import airflow

__all__ = ["version"]

version = "1.1.0"

if packaging.version.parse(airflow.version.version) < packaging.version.parse("2.4.0"):
try:
from airflow import __version__ as airflow_version
except ImportError:
from airflow.version import version as airflow_version

if packaging.version.parse(airflow_version) < packaging.version.parse("2.4.0"):
raise RuntimeError(
f"The package `apache-airflow-providers-apache-kafka:{version}` requires Apache Airflow 2.4.0+"
)
9 changes: 6 additions & 3 deletions airflow/providers/apache/kylin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@

import packaging.version

import airflow

__all__ = ["version"]

version = "3.2.0"

if packaging.version.parse(airflow.version.version) < packaging.version.parse("2.4.0"):
try:
from airflow import __version__ as airflow_version
except ImportError:
from airflow.version import version as airflow_version

if packaging.version.parse(airflow_version) < packaging.version.parse("2.4.0"):
raise RuntimeError(
f"The package `apache-airflow-providers-apache-kylin:{version}` requires Apache Airflow 2.4.0+"
)
9 changes: 6 additions & 3 deletions airflow/providers/apache/livy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@

import packaging.version

import airflow

__all__ = ["version"]

version = "3.5.0"

if packaging.version.parse(airflow.version.version) < packaging.version.parse("2.4.0"):
try:
from airflow import __version__ as airflow_version
except ImportError:
from airflow.version import version as airflow_version

if packaging.version.parse(airflow_version) < packaging.version.parse("2.4.0"):
raise RuntimeError(
f"The package `apache-airflow-providers-apache-livy:{version}` requires Apache Airflow 2.4.0+"
)
9 changes: 6 additions & 3 deletions airflow/providers/apache/pig/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@

import packaging.version

import airflow

__all__ = ["version"]

version = "4.1.0"

if packaging.version.parse(airflow.version.version) < packaging.version.parse("2.4.0"):
try:
from airflow import __version__ as airflow_version
except ImportError:
from airflow.version import version as airflow_version

if packaging.version.parse(airflow_version) < packaging.version.parse("2.4.0"):
raise RuntimeError(
f"The package `apache-airflow-providers-apache-pig:{version}` requires Apache Airflow 2.4.0+"
)
9 changes: 6 additions & 3 deletions airflow/providers/apache/pinot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@

import packaging.version

import airflow

__all__ = ["version"]

version = "4.1.0"

if packaging.version.parse(airflow.version.version) < packaging.version.parse("2.4.0"):
try:
from airflow import __version__ as airflow_version
except ImportError:
from airflow.version import version as airflow_version

if packaging.version.parse(airflow_version) < packaging.version.parse("2.4.0"):
raise RuntimeError(
f"The package `apache-airflow-providers-apache-pinot:{version}` requires Apache Airflow 2.4.0+"
)
9 changes: 6 additions & 3 deletions airflow/providers/apache/spark/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@

import packaging.version

import airflow

__all__ = ["version"]

version = "4.1.0"

if packaging.version.parse(airflow.version.version) < packaging.version.parse("2.4.0"):
try:
from airflow import __version__ as airflow_version
except ImportError:
from airflow.version import version as airflow_version

if packaging.version.parse(airflow_version) < packaging.version.parse("2.4.0"):
raise RuntimeError(
f"The package `apache-airflow-providers-apache-spark:{version}` requires Apache Airflow 2.4.0+"
)
9 changes: 6 additions & 3 deletions airflow/providers/apache/sqoop/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@

import packaging.version

import airflow

__all__ = ["version"]

version = "3.2.0"

if packaging.version.parse(airflow.version.version) < packaging.version.parse("2.4.0"):
try:
from airflow import __version__ as airflow_version
except ImportError:
from airflow.version import version as airflow_version

if packaging.version.parse(airflow_version) < packaging.version.parse("2.4.0"):
raise RuntimeError(
f"The package `apache-airflow-providers-apache-sqoop:{version}` requires Apache Airflow 2.4.0+"
)
9 changes: 6 additions & 3 deletions airflow/providers/arangodb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@

import packaging.version

import airflow

__all__ = ["version"]

version = "2.2.0"

if packaging.version.parse(airflow.version.version) < packaging.version.parse("2.4.0"):
try:
from airflow import __version__ as airflow_version
except ImportError:
from airflow.version import version as airflow_version

if packaging.version.parse(airflow_version) < packaging.version.parse("2.4.0"):
raise RuntimeError(
f"The package `apache-airflow-providers-arangodb:{version}` requires Apache Airflow 2.4.0+"
)
9 changes: 6 additions & 3 deletions airflow/providers/asana/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@

import packaging.version

import airflow

__all__ = ["version"]

version = "2.2.0"

if packaging.version.parse(airflow.version.version) < packaging.version.parse("2.4.0"):
try:
from airflow import __version__ as airflow_version
except ImportError:
from airflow.version import version as airflow_version

if packaging.version.parse(airflow_version) < packaging.version.parse("2.4.0"):
raise RuntimeError(
f"The package `apache-airflow-providers-asana:{version}` requires Apache Airflow 2.4.0+"
)
Loading