Skip to content

Commit b3fe019

Browse files
committed
fix: pkg_resources has been deprecated and changed importlib
1 parent 11d2fc0 commit b3fe019

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Diff for: pymilvus/client/__init__.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@
33
import subprocess
44
from contextlib import suppress
55

6-
from pkg_resources import DistributionNotFound, get_distribution
6+
try:
7+
from importlib.metadata import version, PackageNotFoundError
8+
except ImportError:
9+
# For Python versions < 3.8
10+
from importlib_metadata import version, PackageNotFoundError
711

812
log = logging.getLogger(__name__)
913

10-
1114
__version__ = "0.0.0.dev"
1215

13-
14-
with suppress(DistributionNotFound):
15-
__version__ = get_distribution("pymilvus").version
16+
with suppress(PackageNotFoundError):
17+
__version__ = version("pymilvus")
1618

1719

1820
def get_commit(version: str = "", short: bool = True) -> str:

0 commit comments

Comments
 (0)