potiuk commented on code in PR #38366:
URL: https://github.com/apache/airflow/pull/38366#discussion_r1535391600
##########
airflow/operators/python.py:
##########
@@ -900,16 +900,15 @@ def _external_airflow_version_script(self):
On the other hand, `importlib.metadata.version` will retrieve the
package version pretty fast
something below 100ms; this includes new subprocess overhead.
- Possible side effect: it might be a situation that backport package is
not available
- in Python 3.8 and below, which indicates that venv doesn't contain an
`apache-airflow`
+ Possible side effect: It might be a situation that
`importlib.metadata` is not available (Python < 3.8),
+ as well as backport `importlib_metadata` which might indicate that
venv doesn't contain an `apache-airflow`
or something wrong with the environment.
"""
return textwrap.dedent(
"""
- import sys
- if sys.version_info >= (3, 9):
+ try:
from importlib.metadata import version
- else:
+ except ImportError:
from importlib_metadata import version
print(version("apache-airflow"))
Review Comment:
Agree.
--
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]