diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 3a98930b3..3488f0260 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -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 @@ -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 diff --git a/mock_tests/conftest.py b/mock_tests/conftest.py index 5ba147764..c1a57bbe1 100644 --- a/mock_tests/conftest.py +++ b/mock_tests/conftest.py @@ -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( diff --git a/mock_tests/test_collection.py b/mock_tests/test_collection.py index e165c5050..8164d27e5 100644 --- a/mock_tests/test_collection.py +++ b/mock_tests/test_collection.py @@ -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 @@ -17,6 +17,7 @@ CLIENT_ID, MockRetriesWeaviateService, ) +from weaviate.backup.backup import BackupStorage from weaviate.collections.classes.config import ( CollectionConfig, VectorIndexConfigFlat, @@ -30,6 +31,7 @@ Vectorizers, VectorIndexType, ShardingConfig, + ReplicationDeletionStrategy, ) from weaviate.connect.base import ConnectionParams, ProtocolParams from weaviate.connect.integrations import _IntegrationConfig @@ -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="", @@ -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, @@ -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"}) @@ -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, ) diff --git a/setup.cfg b/setup.cfg index 65d2536b6..6fc607ed0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 diff --git a/weaviate/collections/cluster/executor.py b/weaviate/collections/cluster/executor.py index 43cd275f4..bd9bb3872 100644 --- a/weaviate/collections/cluster/executor.py +++ b/weaviate/collections/cluster/executor.py @@ -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, diff --git a/weaviate/collections/cluster/sync.pyi b/weaviate/collections/cluster/sync.pyi index bcc89193d..24ab5f255 100644 --- a/weaviate/collections/cluster/sync.pyi +++ b/weaviate/collections/cluster/sync.pyi @@ -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]]]: ... diff --git a/weaviate/collections/config/async_.pyi b/weaviate/collections/config/async_.pyi index ad6698a06..01370830a 100644 --- a/weaviate/collections/config/async_.pyi +++ b/weaviate/collections/config/async_.pyi @@ -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 ( @@ -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]: ... diff --git a/weaviate/collections/config/executor.py b/weaviate/collections/config/executor.py index 95ebc56ed..b4f75d163 100644 --- a/weaviate/collections/config/executor.py +++ b/weaviate/collections/config/executor.py @@ -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 @@ -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, diff --git a/weaviate/collections/config/sync.pyi b/weaviate/collections/config/sync.pyi index 5f6bde159..759c438d0 100644 --- a/weaviate/collections/config/sync.pyi +++ b/weaviate/collections/config/sync.pyi @@ -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 ( @@ -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,