Skip to content

Commit 9ddab38

Browse files
Replace pkg_resources with importlib.metadata for version retrieval in install.py
1 parent 47bcb65 commit 9ddab38

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

guardrails/hub/install.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from string import Template
44
from typing import Callable, cast, List
55

6-
import pkg_resources
6+
import importlib.metadata
77

88
from guardrails.hub.validator_package_service import (
99
ValidatorPackageService,
@@ -149,7 +149,7 @@ def install(
149149
installed_version_message = ""
150150
with contextlib.suppress(Exception):
151151
package_name = ValidatorPackageService.get_normalized_package_name(validator_id)
152-
installed_version = pkg_resources.get_distribution(package_name).version
152+
installed_version = importlib.metadata.version(package_name)
153153
if installed_version:
154154
installed_version_message = f" version {installed_version}"
155155

0 commit comments

Comments
 (0)