You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "ashb (via GitHub)" <gi...@apache.org> on 2023/02/23 13:52:55 UTC

[GitHub] [airflow] ashb commented on a diff in pull request #29723: Don't use importlib.metadata to get Version for speed

ashb commented on code in PR #29723:
URL: https://github.com/apache/airflow/pull/29723#discussion_r1115729277


##########
airflow/operators/python.py:
##########
@@ -690,9 +689,11 @@ def _is_pendulum_installed_in_target_env(self) -> bool:
             return False
 
     def _get_airflow_version_from_target_env(self) -> str | None:
+        from airflow import __version__ as airflow_version
+
         try:
             result = subprocess.check_output(
-                [self.python, "-c", "from airflow import version; print(version.version)"], text=True
+                [self.python, "-c", "from airflow import __version__; print(__version__)"], text=True

Review Comment:
   This worked in 2.0.0
   
   ```
   $ docker run --rm -ti --entrypoint python apache/airflow:2.0.0 -c "from airflow import __version__; print(__version__)"
   2.0.0
   ```
   
   I didn't test any older, but I think this is fine.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org