chore: replace semver dependency with packaging (#1311)

Fixes #1296 per title. See
https://github.com/lancedb/lancedb/pull/1298#discussion_r1603931457 Cc
@wjones127

---------

Co-authored-by: Will Jones <willjones127@gmail.com>
This commit is contained in:
Philip Meier
2024-05-28 19:05:16 +02:00
committed by GitHub
parent db712b0f99
commit 1ad1c0820d
8 changed files with 14 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
import os
import semver
from packaging.version import Version
from functools import cached_property
from typing import Union
@@ -44,9 +44,8 @@ class CohereReranker(Reranker):
def _client(self):
cohere = attempt_import_or_raise("cohere")
# ensure version is at least 0.5.0
if (
hasattr(cohere, "__version__")
and semver.compare(cohere.__version__, "5.0.0") < 0
if hasattr(cohere, "__version__") and Version(cohere.__version__) < Version(
"0.5.0"
):
raise ValueError(
f"cohere version must be at least 0.5.0, found {cohere.__version__}"