Hi Dennis,

The constants do not grow infinitely; they roll. When we bump the
min_version, we remove the lowest constants to force the removal of all
obsolete compatibility code. This approach ensures no "harness" is left
behind, preventing us from forgetting to delete code for unsupported
versions.

This standard was established after extensive discussion in December 2024 (
https://lists.apache.org/thread/px36w3ph2mf0pmv377dtfc2nhpq8dqw1) and is
documented here:
https://github.com/apache/airflow/blob/main/contributing-docs/testing/unit_tests.rst#implementing-compatibility-for-provider-tests-for-older-airflow-versions

The main drawback of using helpers is losing the compilation errors that
mandate removing old compatibility logic when constants are deleted.



Best,
Jarek

On Wed, May 13, 2026 at 10:03 PM Ferruzzi, Dennis <[email protected]>
wrote:

> RE:
> https://github.com/apache/airflow/blob/main/providers/common/compat/src/airflow/providers/common/compat/version_compat.py
>
>
> Curious if there is a reason we went with the constants like this?
> There's likely a reason, but if not, we are now adding a constant for 3.3
> and that will continue to grow.  I'm wondering if there is a reason not to
> replace those constants with a helper like
>
> def airflow_version_at_least(major: int, minor:int,  patch:int = 0) ->
> bool:
>      return get_base_airflow_version_tuple() >= (major, minor, patch)
>
>
> Then in code instead of importing the constant it would be `if
> airflow_version_at_least(3, 3):` which seems just as clear and easy.
>
> - ferruzzi
>

Reply via email to