Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
fail-fast: false
matrix:
version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
folder: ["weaviate"]
folder: ["weaviate", "integration", "integration_embedded"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand All @@ -67,7 +67,8 @@ jobs:
- run: pip install -r requirements-devel.txt
- uses: jakebailey/pyright-action@v2
with:
version: 1.1.398
version: 1.1.399
working-directory: ${{ matrix.folder }}

unit-tests:
name: Run Unit Tests
Expand Down
6 changes: 2 additions & 4 deletions mock_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,8 @@ class MockWeaviateService(weaviate_pb2_grpc.WeaviateServicer):
def Search(
self, request: search_get_pb2.SearchRequest, context: grpc.ServicerContext
) -> search_get_pb2.SearchReply:
zero_date: properties_pb2.Value.date_value = properties_pb2.Value(
date_value="0000-01-30T00:00:00Z"
)
date_prop: Mapping[str, properties_pb2.Value.date_value] = {"date": zero_date}
zero_date = properties_pb2.Value(date_value="0000-01-30T00:00:00Z")
date_prop: Mapping[str, properties_pb2.Value] = {"date": zero_date}
return search_get_pb2.SearchReply(
results=[
search_get_pb2.SearchResult(
Expand Down
18 changes: 12 additions & 6 deletions mock_tests/test_collection.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import datetime
import json
import time
from typing import Any, Dict
from typing import Any, Dict, Literal

import grpc
import pytest
Expand All @@ -17,6 +17,7 @@
CLIENT_ID,
MockRetriesWeaviateService,
)
from weaviate.backup.backup import BackupStorage
from weaviate.collections.classes.config import (
CollectionConfig,
VectorIndexConfigFlat,
Expand All @@ -30,6 +31,7 @@
Vectorizers,
VectorIndexType,
ShardingConfig,
ReplicationDeletionStrategy,
)
from weaviate.connect.base import ConnectionParams, ProtocolParams
from weaviate.connect.integrations import _IntegrationConfig
Expand Down Expand Up @@ -171,7 +173,7 @@ def test_missing_multi_tenancy_config(
vector_cache_max_objects=10,
multi_vector=None,
)
vic.distance = vic.distance_metric
vic.distance = vic.distance_metric # type: ignore
response_json = CollectionConfig(
name="Test",
description="",
Expand Down Expand Up @@ -202,7 +204,11 @@ def test_missing_multi_tenancy_config(
),
properties=[],
references=[],
replication_config=ReplicationConfig(factor=0, async_enabled=False, deletion_strategy=None),
replication_config=ReplicationConfig(
factor=0,
async_enabled=False,
deletion_strategy=ReplicationDeletionStrategy.NO_AUTOMATED_RESOLUTION,
),
vector_index_config=vic,
vector_index_type=VectorIndexType.FLAT,
vectorizer=Vectorizers.NONE,
Expand Down Expand Up @@ -361,7 +367,7 @@ def test_year_zero(year_zero_collection: weaviate.collections.Collection) -> Non

@pytest.mark.parametrize("output", ["minimal", "verbose"])
def test_node_with_timeout(
httpserver: HTTPServer, start_grpc_server: grpc.Server, output: str
httpserver: HTTPServer, start_grpc_server: grpc.Server, output: Literal["minimal", "verbose"]
) -> None:
httpserver.expect_request("/v1/.well-known/ready").respond_with_json({})
httpserver.expect_request("/v1/meta").respond_with_json({"version": "1.24"})
Expand Down Expand Up @@ -423,14 +429,14 @@ def test_backup_cancel_while_create_and_restore(
with pytest.raises(BackupCanceledError):
client.backup.create(
backup_id=backup_id,
backend="filesystem",
backend=BackupStorage.FILESYSTEM,
wait_for_completion=True,
)

with pytest.raises(BackupCanceledError):
client.backup.restore(
backup_id=backup_id,
backend="filesystem",
backend=BackupStorage.FILESYSTEM,
wait_for_completion=True,
)

Expand Down
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@ zip_safe = False
packages =
weaviate
weaviate.backup
weaviate.classes
weaviate.cluster
weaviate.collections
weaviate.connect
weaviate.debug
weaviate.gql
weaviate.outputs
weaviate.proto
weaviate.proto.v1
weaviate.rbac
weaviate.users

platforms = any
include_package_data = True
Expand Down
16 changes: 8 additions & 8 deletions weaviate/collections/cluster/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,36 @@ def __init__(self, connection: ConnectionType):
self._connection = connection

@overload
async def nodes(
def nodes(
self,
collection: Optional[str] = None,
*,
output: Literal[None] = None,
) -> List[Node[None, None]]: ...
) -> executor.Result[List[Node[None, None]]]: ...

@overload
async def nodes(
def nodes(
self,
collection: Optional[str] = None,
*,
output: Literal["minimal"],
) -> List[Node[None, None]]: ...
) -> executor.Result[List[Node[None, None]]]: ...

@overload
async def nodes(
def nodes(
self,
collection: Optional[str] = None,
*,
output: Literal["verbose"],
) -> List[Node[Shards, Stats]]: ...
) -> executor.Result[List[Node[Shards, Stats]]]: ...

@overload
async def nodes(
def nodes(
self,
collection: Optional[str] = None,
*,
output: Optional[Verbosity] = None,
) -> Union[List[Node[None, None]], List[Node[Shards, Stats]]]: ...
) -> executor.Result[Union[List[Node[None, None]], List[Node[Shards, Stats]]]]: ...

def nodes(
self,
Expand Down
8 changes: 4 additions & 4 deletions weaviate/collections/cluster/sync.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ from .executor import _ClusterExecutor

class _Cluster(_ClusterExecutor[ConnectionSync]):
@overload
async def nodes(
def nodes(
self, collection: Optional[str] = None, *, output: Literal[None] = None
) -> List[Node[None, None]]: ...
@overload
async def nodes(
def nodes(
self, collection: Optional[str] = None, *, output: Literal["minimal"]
) -> List[Node[None, None]]: ...
@overload
async def nodes(
def nodes(
self, collection: Optional[str] = None, *, output: Literal["verbose"]
) -> List[Node[Shards, Stats]]: ...
@overload
async def nodes(
def nodes(
self, collection: Optional[str] = None, *, output: Optional[Verbosity] = None
) -> Union[List[Node[None, None]], List[Node[Shards, Stats]]]: ...
7 changes: 6 additions & 1 deletion weaviate/collections/config/async_.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import asyncio
from typing import Any, Dict, Generic, List, Literal, Optional, Tuple, Union, cast
from typing import Any, Dict, Generic, List, Literal, Optional, Tuple, Union, cast, overload
from httpx import Response
from pydantic_core import ValidationError
from weaviate.collections.classes.config import (
Expand Down Expand Up @@ -37,6 +37,11 @@ from weaviate.connect.v4 import ConnectionAsync
from .executor import _ConfigCollectionExecutor

class _ConfigCollectionAsync(_ConfigCollectionExecutor[ConnectionAsync]):
@overload
async def get(self, simple: Literal[False] = False) -> CollectionConfig: ...
@overload
async def get(self, simple: Literal[True]) -> CollectionConfigSimple: ...
@overload
async def get(
self, simple: bool = False
) -> Union[CollectionConfig, CollectionConfigSimple]: ...
Expand Down
20 changes: 19 additions & 1 deletion weaviate/collections/config/executor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import asyncio
from typing import Any, Dict, Generic, List, Literal, Optional, Tuple, Union, cast
from typing import Any, Dict, Generic, List, Literal, Optional, Tuple, Union, cast, overload

from httpx import Response
from pydantic_core import ValidationError
Expand Down Expand Up @@ -62,6 +62,24 @@ def resp(res: Response) -> Dict[str, Any]:
status_codes=_ExpectedStatusCodes(ok_in=200, error="Get collection configuration"),
)

@overload
def get(
self,
simple: Literal[False] = False,
) -> executor.Result[CollectionConfig]: ...

@overload
def get(
self,
simple: Literal[True],
) -> executor.Result[CollectionConfigSimple]: ...

@overload
def get(
self,
simple: bool = False,
) -> executor.Result[Union[CollectionConfig, CollectionConfigSimple]]: ...

def get(
self,
simple: bool = False,
Expand Down
7 changes: 6 additions & 1 deletion weaviate/collections/config/sync.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import asyncio
from typing import Any, Dict, Generic, List, Literal, Optional, Tuple, Union, cast
from typing import Any, Dict, Generic, List, Literal, Optional, Tuple, Union, cast, overload
from httpx import Response
from pydantic_core import ValidationError
from weaviate.collections.classes.config import (
Expand Down Expand Up @@ -37,6 +37,11 @@ from weaviate.connect.v4 import ConnectionSync
from .executor import _ConfigCollectionExecutor

class _ConfigCollection(_ConfigCollectionExecutor[ConnectionSync]):
@overload
def get(self, simple: Literal[False] = False) -> CollectionConfig: ...
@overload
def get(self, simple: Literal[True]) -> CollectionConfigSimple: ...
@overload
def get(self, simple: bool = False) -> Union[CollectionConfig, CollectionConfigSimple]: ...
def update(
self,
Expand Down
Loading