Skip to content

Commit c8e1ab1

Browse files
authored
Merge pull request #1649 from weaviate/chore/fix-small-pkg-issues
Fix a few issues:
2 parents 95ede7f + 75621eb commit c8e1ab1

9 files changed

Lines changed: 63 additions & 27 deletions

File tree

.github/workflows/main.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
fail-fast: false
5858
matrix:
5959
version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
60-
folder: ["weaviate"]
60+
folder: ["weaviate", "integration", "integration_embedded"]
6161
steps:
6262
- uses: actions/checkout@v4
6363
- uses: actions/setup-python@v5
@@ -67,7 +67,8 @@ jobs:
6767
- run: pip install -r requirements-devel.txt
6868
- uses: jakebailey/pyright-action@v2
6969
with:
70-
version: 1.1.398
70+
version: 1.1.399
71+
working-directory: ${{ matrix.folder }}
7172

7273
unit-tests:
7374
name: Run Unit Tests

mock_tests/conftest.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,8 @@ class MockWeaviateService(weaviate_pb2_grpc.WeaviateServicer):
214214
def Search(
215215
self, request: search_get_pb2.SearchRequest, context: grpc.ServicerContext
216216
) -> search_get_pb2.SearchReply:
217-
zero_date: properties_pb2.Value.date_value = properties_pb2.Value(
218-
date_value="0000-01-30T00:00:00Z"
219-
)
220-
date_prop: Mapping[str, properties_pb2.Value.date_value] = {"date": zero_date}
217+
zero_date = properties_pb2.Value(date_value="0000-01-30T00:00:00Z")
218+
date_prop: Mapping[str, properties_pb2.Value] = {"date": zero_date}
221219
return search_get_pb2.SearchReply(
222220
results=[
223221
search_get_pb2.SearchResult(

mock_tests/test_collection.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import datetime
22
import json
33
import time
4-
from typing import Any, Dict
4+
from typing import Any, Dict, Literal
55

66
import grpc
77
import pytest
@@ -17,6 +17,7 @@
1717
CLIENT_ID,
1818
MockRetriesWeaviateService,
1919
)
20+
from weaviate.backup.backup import BackupStorage
2021
from weaviate.collections.classes.config import (
2122
CollectionConfig,
2223
VectorIndexConfigFlat,
@@ -30,6 +31,7 @@
3031
Vectorizers,
3132
VectorIndexType,
3233
ShardingConfig,
34+
ReplicationDeletionStrategy,
3335
)
3436
from weaviate.connect.base import ConnectionParams, ProtocolParams
3537
from weaviate.connect.integrations import _IntegrationConfig
@@ -171,7 +173,7 @@ def test_missing_multi_tenancy_config(
171173
vector_cache_max_objects=10,
172174
multi_vector=None,
173175
)
174-
vic.distance = vic.distance_metric
176+
vic.distance = vic.distance_metric # type: ignore
175177
response_json = CollectionConfig(
176178
name="Test",
177179
description="",
@@ -202,7 +204,11 @@ def test_missing_multi_tenancy_config(
202204
),
203205
properties=[],
204206
references=[],
205-
replication_config=ReplicationConfig(factor=0, async_enabled=False, deletion_strategy=None),
207+
replication_config=ReplicationConfig(
208+
factor=0,
209+
async_enabled=False,
210+
deletion_strategy=ReplicationDeletionStrategy.NO_AUTOMATED_RESOLUTION,
211+
),
206212
vector_index_config=vic,
207213
vector_index_type=VectorIndexType.FLAT,
208214
vectorizer=Vectorizers.NONE,
@@ -361,7 +367,7 @@ def test_year_zero(year_zero_collection: weaviate.collections.Collection) -> Non
361367

362368
@pytest.mark.parametrize("output", ["minimal", "verbose"])
363369
def test_node_with_timeout(
364-
httpserver: HTTPServer, start_grpc_server: grpc.Server, output: str
370+
httpserver: HTTPServer, start_grpc_server: grpc.Server, output: Literal["minimal", "verbose"]
365371
) -> None:
366372
httpserver.expect_request("/v1/.well-known/ready").respond_with_json({})
367373
httpserver.expect_request("/v1/meta").respond_with_json({"version": "1.24"})
@@ -423,14 +429,14 @@ def test_backup_cancel_while_create_and_restore(
423429
with pytest.raises(BackupCanceledError):
424430
client.backup.create(
425431
backup_id=backup_id,
426-
backend="filesystem",
432+
backend=BackupStorage.FILESYSTEM,
427433
wait_for_completion=True,
428434
)
429435

430436
with pytest.raises(BackupCanceledError):
431437
client.backup.restore(
432438
backup_id=backup_id,
433-
backend="filesystem",
439+
backend=BackupStorage.FILESYSTEM,
434440
wait_for_completion=True,
435441
)
436442

setup.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,17 @@ zip_safe = False
1919
packages =
2020
weaviate
2121
weaviate.backup
22+
weaviate.classes
2223
weaviate.cluster
2324
weaviate.collections
2425
weaviate.connect
26+
weaviate.debug
2527
weaviate.gql
2628
weaviate.outputs
2729
weaviate.proto
2830
weaviate.proto.v1
2931
weaviate.rbac
32+
weaviate.users
3033

3134
platforms = any
3235
include_package_data = True

weaviate/collections/cluster/executor.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,36 +18,36 @@ def __init__(self, connection: ConnectionType):
1818
self._connection = connection
1919

2020
@overload
21-
async def nodes(
21+
def nodes(
2222
self,
2323
collection: Optional[str] = None,
2424
*,
2525
output: Literal[None] = None,
26-
) -> List[Node[None, None]]: ...
26+
) -> executor.Result[List[Node[None, None]]]: ...
2727

2828
@overload
29-
async def nodes(
29+
def nodes(
3030
self,
3131
collection: Optional[str] = None,
3232
*,
3333
output: Literal["minimal"],
34-
) -> List[Node[None, None]]: ...
34+
) -> executor.Result[List[Node[None, None]]]: ...
3535

3636
@overload
37-
async def nodes(
37+
def nodes(
3838
self,
3939
collection: Optional[str] = None,
4040
*,
4141
output: Literal["verbose"],
42-
) -> List[Node[Shards, Stats]]: ...
42+
) -> executor.Result[List[Node[Shards, Stats]]]: ...
4343

4444
@overload
45-
async def nodes(
45+
def nodes(
4646
self,
4747
collection: Optional[str] = None,
4848
*,
4949
output: Optional[Verbosity] = None,
50-
) -> Union[List[Node[None, None]], List[Node[Shards, Stats]]]: ...
50+
) -> executor.Result[Union[List[Node[None, None]], List[Node[Shards, Stats]]]]: ...
5151

5252
def nodes(
5353
self,

weaviate/collections/cluster/sync.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ from .executor import _ClusterExecutor
1111

1212
class _Cluster(_ClusterExecutor[ConnectionSync]):
1313
@overload
14-
async def nodes(
14+
def nodes(
1515
self, collection: Optional[str] = None, *, output: Literal[None] = None
1616
) -> List[Node[None, None]]: ...
1717
@overload
18-
async def nodes(
18+
def nodes(
1919
self, collection: Optional[str] = None, *, output: Literal["minimal"]
2020
) -> List[Node[None, None]]: ...
2121
@overload
22-
async def nodes(
22+
def nodes(
2323
self, collection: Optional[str] = None, *, output: Literal["verbose"]
2424
) -> List[Node[Shards, Stats]]: ...
2525
@overload
26-
async def nodes(
26+
def nodes(
2727
self, collection: Optional[str] = None, *, output: Optional[Verbosity] = None
2828
) -> Union[List[Node[None, None]], List[Node[Shards, Stats]]]: ...

weaviate/collections/config/async_.pyi

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import asyncio
2-
from typing import Any, Dict, Generic, List, Literal, Optional, Tuple, Union, cast
2+
from typing import Any, Dict, Generic, List, Literal, Optional, Tuple, Union, cast, overload
33
from httpx import Response
44
from pydantic_core import ValidationError
55
from weaviate.collections.classes.config import (
@@ -37,6 +37,11 @@ from weaviate.connect.v4 import ConnectionAsync
3737
from .executor import _ConfigCollectionExecutor
3838

3939
class _ConfigCollectionAsync(_ConfigCollectionExecutor[ConnectionAsync]):
40+
@overload
41+
async def get(self, simple: Literal[False] = False) -> CollectionConfig: ...
42+
@overload
43+
async def get(self, simple: Literal[True]) -> CollectionConfigSimple: ...
44+
@overload
4045
async def get(
4146
self, simple: bool = False
4247
) -> Union[CollectionConfig, CollectionConfigSimple]: ...

weaviate/collections/config/executor.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import asyncio
2-
from typing import Any, Dict, Generic, List, Literal, Optional, Tuple, Union, cast
2+
from typing import Any, Dict, Generic, List, Literal, Optional, Tuple, Union, cast, overload
33

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

65+
@overload
66+
def get(
67+
self,
68+
simple: Literal[False] = False,
69+
) -> executor.Result[CollectionConfig]: ...
70+
71+
@overload
72+
def get(
73+
self,
74+
simple: Literal[True],
75+
) -> executor.Result[CollectionConfigSimple]: ...
76+
77+
@overload
78+
def get(
79+
self,
80+
simple: bool = False,
81+
) -> executor.Result[Union[CollectionConfig, CollectionConfigSimple]]: ...
82+
6583
def get(
6684
self,
6785
simple: bool = False,

weaviate/collections/config/sync.pyi

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import asyncio
2-
from typing import Any, Dict, Generic, List, Literal, Optional, Tuple, Union, cast
2+
from typing import Any, Dict, Generic, List, Literal, Optional, Tuple, Union, cast, overload
33
from httpx import Response
44
from pydantic_core import ValidationError
55
from weaviate.collections.classes.config import (
@@ -37,6 +37,11 @@ from weaviate.connect.v4 import ConnectionSync
3737
from .executor import _ConfigCollectionExecutor
3838

3939
class _ConfigCollection(_ConfigCollectionExecutor[ConnectionSync]):
40+
@overload
41+
def get(self, simple: Literal[False] = False) -> CollectionConfig: ...
42+
@overload
43+
def get(self, simple: Literal[True]) -> CollectionConfigSimple: ...
44+
@overload
4045
def get(self, simple: bool = False) -> Union[CollectionConfig, CollectionConfigSimple]: ...
4146
def update(
4247
self,

0 commit comments

Comments
 (0)