This is an automated email from the ASF dual-hosted git repository.

taragolis pushed a commit to branch bump-importlib-metadata
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit b143ad6d84f80909b20bc1732361ddee8d9ddd94
Author: Andrey Anshin <[email protected]>
AuthorDate: Thu Mar 21 14:38:05 2024 +0400

    Use `importlib_metadata` with compat to Pythin 3.10/3.12 stdlib
---
 airflow/utils/entry_points.py | 9 +++++----
 pyproject.toml                | 2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/airflow/utils/entry_points.py b/airflow/utils/entry_points.py
index aff4c0a9f9..12dad840ad 100644
--- a/airflow/utils/entry_points.py
+++ b/airflow/utils/entry_points.py
@@ -18,13 +18,14 @@ from __future__ import annotations
 
 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, 10):
+    from importlib import metadata
+else:
+    import importlib_metadata as metadata  # type: ignore[no-redef]
 
 log = logging.getLogger(__name__)
 
diff --git a/pyproject.toml b/pyproject.toml
index 04b5b7d197..f8a2097d74 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -107,7 +107,7 @@ dependencies = [
     "google-re2>=1.0",
     "gunicorn>=20.1.0",
     "httpx",
-    "importlib_metadata>=1.7;python_version<\"3.9\"",
+    "importlib_metadata>=4.6;python_version<\"3.10\"",
     # Importib_resources 6.2.0-6.3.1 break pytest_rewrite
     # see https://github.com/python/importlib_resources/issues/299
     "importlib_resources>=5.2,!=6.2.0,!=6.3.0,!=6.3.1;python_version<\"3.9\"",

Reply via email to