Skip to content

Commit 4b6f199

Browse files
Rishav KumarRishav Kumar
authored andcommitted
fix: importlib-metadata
1 parent fb73220 commit 4b6f199

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

zulip_bots/zulip_bots/finder.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@
22
import importlib.abc
33
import importlib.util
44
import os
5+
import sys
56
from pathlib import Path
67
from types import ModuleType
78
from typing import Any, Optional, Tuple
89

910
current_dir = os.path.dirname(os.path.abspath(__file__))
1011

11-
import importlib_metadata as metadata
12+
if sys.version_info >= (3, 10):
13+
from importlib.metadata import metadata # Python 3.10+ standard library
14+
else:
15+
from importlib_metadata import metadata # External package for Python < 3.10
1216

1317

1418
def import_module_from_source(path: str, name: str) -> Any:

0 commit comments

Comments
 (0)