There are multiple different issues implicated here but the only one I am
interested in is these version constants.  And that's what I'll address
here.

My take is that adding constants like this in ... all? ... providers is
unnecessary and overkill and very bloaty.

PROVIDERS_{{ PROVIDER_CONSTANT_PREFIX }}_AIRFLOW_IS_2_9_PLUS

All we're really after is, "what is the airflow version?"

The context here is when providers are implementing conditional logic based
on airflow core version.  Let's also remember that there will soon be a
SDK... shall we add constants for that too?

I think we're better off if we simply provide a simple way to answer the
question, "what is the core version?"

We can do this in one place instead of many.

I have offered two ways we could do that.

One is #44607 <https://github.com/apache/airflow/pull/44607> which adds a
get version function that gives the base version, which is what all of
these comparisons use.

Usage example:

if get_airflow_version() > Version("3.0.0"):
    do_something()

Another, which I think I like better is, #44743
<https://github.com/apache/airflow/pull/44743>, which returns an
AIRFLOW_BASE_VERSION constant that can be compared both with Version
objects and with strings.

Usage example:

if AIRFLOW_BASE_VERSION >= "2.10.0":
    do_something()

This way we don't need to add such constants in every provider, for every
version, for both "greater equals" and "greater than".

You just give the info and the call site does the evaluation.

Yes we will have to wait some time before all providers can use such a
helper, but time flies, and there's no emergency here.

The other issue, overwriting the autogen file has now already been fixed,
thanks to Jarek.  And the cross provider import thing, I will leave that
for others to debate.

Reply via email to