potiuk commented on code in PR #38366:
URL: https://github.com/apache/airflow/pull/38366#discussion_r1535529678


##########
airflow/utils/entry_points.py:
##########
@@ -18,13 +18,14 @@
 
 import functools
 import logging
+import sys
 from collections import defaultdict
 from typing import Iterator, Tuple
 
-try:
-    import importlib_metadata as metadata
-except ImportError:
-    from importlib import metadata  # type: ignore[no-redef]
+if sys.version_info >= (3, 12):
+    from importlib import metadata
+else:
+    import importlib_metadata as metadata  # type: ignore[no-redef]

Review Comment:
   To explain this-one:
   
   From: https://docs.python.org/3/library/importlib.metadata.html#entry-points
   
   > Compatibility Note
   
   > The “selectable” entry points were introduced in importlib_metadata 3.6 
and Python 3.10. Prior to those changes, entry_points accepted no parameters 
and always returned a dictionary of entry points, keyed by group. With 
importlib_metadata 5.0 and Python 3.12, entry_points always returns an 
EntryPoints object. See 
[backports.entry_points_selectable](https://pypi.org/project/backports.entry-points-selectable)
 for compatibility options.



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

Reply via email to