potiuk commented on code in PR #40197:
URL: https://github.com/apache/airflow/pull/40197#discussion_r1639518411
##########
airflow/providers/openlineage/utils/utils.py:
##########
@@ -57,6 +59,7 @@
log = logging.getLogger(__name__)
_NOMINAL_TIME_FORMAT = "%Y-%m-%dT%H:%M:%S.%fZ"
+_IS_AIRFLOW_2_10_OR_HIGHER = Version(Version(AIRFLOW_VERSION).base_version) >=
Version("2.10.0")
Review Comment:
> I think it won't work for dev0, rc1 etc. without that, correct? Do we
want it to work for those versions as well?
Yes. We need it.
```python
>>> from packaging.version import Version
>>> Version("2.10.0b1") >= Version("2.10.0")
False
>>> Version(Version("2.10.0b1").base_version) >= Version("2.10.0")
True
```
The problem is that ordering of versioning specification PEP-440 is designed
for a different purpose
https://peps.python.org/pep-0440/#summary-of-permitted-suffixes-and-relative-ordering
:
```
.devN, aN, bN, rcN, <no suffix>, .postN
````
This is **logically** correct - because dev0, a, b, rc come before the
"final" version - and this is fine for - for example - sorting versions in PyPI
release history: https://pypi.org/project/apache-airflow/#history but it is
also useless when you compare capabilities.
We have a different need here - we do not want to order the releases
according to which one was before and after, we want to check if we have a
capability that was added in particular version. And capabilities are already
added in alpha/betas/rcs. So while natural ordering of the versions is `dev0
-> a -> b-> rc -> [no suffix]` - what we need is we normalize everything to
base version and compare it then.
Unfortunately `base_version` in `Version` is a string not a `Version`, so we
have to wrap it in another `Version` to make comparision. That's unfortunate.
but that's how `packaging.Version` API is designed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]