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

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

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


##########
airflow/version.py:
##########
@@ -17,20 +17,5 @@
 # under the License.
 from __future__ import annotations
 
-__all__ = ["version"]
-
-try:
-    import importlib_metadata as metadata
-except ImportError:
-    from importlib import metadata  # type: ignore[no-redef]
-
-try:
-    version = metadata.version("apache-airflow")
-except metadata.PackageNotFoundError:
-    import logging
-
-    log = logging.getLogger(__name__)
-    log.warning("Package metadata could not be found. Overriding it with version found in setup.py")
-    from setup import version
-
-del metadata
+# Compat -- somethings access `airflow.version.version` directly
+from airflow import __version__ as version  # noqa: F401

Review Comment:
   Don’t need to `noqa` if you keep the `__all__` line



-- 
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