Skip to content

Commit dac8ced

Browse files
Copilotjfrancoa
andcommitted
Fix namespace_manager import guard and pin requirements to specific SHA
Agent-Logs-Url: https://github.com/weaviate/weaviate-cli/sessions/885f6e27-f122-407c-8e0b-e5228dacd9fc Co-authored-by: jfrancoa <23482278+jfrancoa@users.noreply.github.com>
1 parent b2aa0a4 commit dac8ced

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

requirements-dev.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
weaviate-client @ git+https://github.com/weaviate/weaviate-python-client.git@jose/namespaces
1+
# TODO: revert to a released version pin (e.g. weaviate-client>=4.x.x) once
2+
# weaviate-python-client PR #2033 merges and a release is cut.
3+
weaviate-client @ git+https://github.com/weaviate/weaviate-python-client.git@f2babd27670729677c7784a0e30a27d4f8ec7328
24
click==8.1.7
35
twine
46
pytest

weaviate_cli/managers/namespace_manager.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,23 @@
33

44
import click
55
from weaviate.client import WeaviateClient
6-
from weaviate.namespaces.models import Namespace
6+
7+
try:
8+
from weaviate.namespaces.models import Namespace
9+
10+
_NAMESPACE_SUPPORT = True
11+
except ImportError:
12+
Namespace = None # type: ignore[assignment,misc]
13+
_NAMESPACE_SUPPORT = False
714

815

916
class NamespaceManager:
1017
def __init__(self, client: WeaviateClient):
18+
if not _NAMESPACE_SUPPORT:
19+
raise RuntimeError(
20+
"Namespace support requires a weaviate-client version that includes "
21+
"the namespaces module. Please upgrade your weaviate-client package."
22+
)
1123
self.client = client
1224

1325
def create_namespace(self, name: str, json_output: bool = False) -> Namespace:

0 commit comments

Comments
 (0)