Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecation warnings in v3 #1240

Merged
merged 2 commits into from
Aug 15, 2024
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
16 changes: 8 additions & 8 deletions ci/start_weaviate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
set -eou pipefail

echo "Run Docker compose"
nohup docker-compose -f ci/docker-compose.yml up -d
nohup docker-compose -f ci/docker-compose-async.yml up -d
nohup docker-compose -f ci/docker-compose-azure.yml up -d
nohup docker-compose -f ci/docker-compose-okta-cc.yml up -d
nohup docker-compose -f ci/docker-compose-okta-users.yml up -d
nohup docker-compose -f ci/docker-compose-wcs.yml up -d
nohup docker-compose -f ci/docker-compose-openai.yml up -d
nohup docker-compose -f ci/docker-compose-cluster.yml up -d
nohup docker compose -f ci/docker-compose.yml up -d
nohup docker compose -f ci/docker-compose-async.yml up -d
nohup docker compose -f ci/docker-compose-azure.yml up -d
nohup docker compose -f ci/docker-compose-okta-cc.yml up -d
nohup docker compose -f ci/docker-compose-okta-users.yml up -d
nohup docker compose -f ci/docker-compose-wcs.yml up -d
nohup docker compose -f ci/docker-compose-openai.yml up -d
nohup docker compose -f ci/docker-compose-cluster.yml up -d
16 changes: 8 additions & 8 deletions ci/stop_weaviate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

set -eou pipefail

docker-compose -f ci/docker-compose.yml down --remove-orphans
docker-compose -f ci/docker-compose-async.yml down --remove-orphans
docker-compose -f ci/docker-compose-azure.yml down --remove-orphans
docker-compose -f ci/docker-compose-okta-cc.yml down --remove-orphans
docker-compose -f ci/docker-compose-okta-users.yml down --remove-orphans
docker-compose -f ci/docker-compose-wcs.yml down --remove-orphans
docker-compose -f ci/docker-compose-openai.yml down --remove-orphans
docker-compose -f ci/docker-compose-cluster.yml down --remove-orphans
docker compose -f ci/docker-compose.yml down --remove-orphans
docker compose -f ci/docker-compose-async.yml down --remove-orphans
docker compose -f ci/docker-compose-azure.yml down --remove-orphans
docker compose -f ci/docker-compose-okta-cc.yml down --remove-orphans
docker compose -f ci/docker-compose-okta-users.yml down --remove-orphans
docker compose -f ci/docker-compose-wcs.yml down --remove-orphans
docker compose -f ci/docker-compose-openai.yml down --remove-orphans
docker compose -f ci/docker-compose-cluster.yml down --remove-orphans
21 changes: 0 additions & 21 deletions mock_tests/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,6 @@ def handler(request: Request):
client.schema.delete_all() # some call that includes headers


@pytest.mark.parametrize("version,warning", [("1.13", True), ("1.14", False)])
def test_warning_old_weaviate(recwarn, ready_mock: HTTPServer, version: str, warning: bool):
"""Test that we warn if a new client version is using an old weaviate server."""
ready_mock.expect_request("/v1/meta").respond_with_json({"version": version})
weaviate.Client(url=MOCK_SERVER_URL)

if warning:
assert len(recwarn) == 2
w = recwarn.pop()
assert issubclass(w.category, DeprecationWarning)
assert str(w.message).startswith("Dep001")
w = recwarn.pop()
assert issubclass(w.category, DeprecationWarning)
assert str(w.message).startswith("Dep004")
else:
assert len(recwarn) == 1
w = recwarn.pop()
assert issubclass(w.category, DeprecationWarning)
assert str(w.message).startswith("Dep004")


def test_wait_for_weaviate(httpserver: HTTPServer):
def handler(request: Request):
time.sleep(0.01)
Expand Down
2 changes: 1 addition & 1 deletion weaviate/batch/crud_batch.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Batch class definitions.
"""

import datetime
import sys
import threading
Expand Down Expand Up @@ -349,7 +350,6 @@ def __call__(self, **kwargs: Any) -> "Batch":
ValueError
If the value of one of the arguments is wrong.
"""
_Warnings.use_of_client_batch_will_be_removed_in_next_major_release()
return self.configure(**kwargs)

def configure(
Expand Down
17 changes: 1 addition & 16 deletions weaviate/connect/connection.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Connection class definition.
"""

from __future__ import annotations

import datetime
Expand All @@ -18,7 +19,6 @@
from requests.exceptions import HTTPError as RequestsHTTPError
from requests.exceptions import JSONDecodeError

from weaviate import __version__ as client_version
from weaviate.auth import AuthCredentials, AuthClientCredentials, AuthApiKey
from weaviate.config import ConnectionConfig
from weaviate.connect.authentication import _Auth
Expand All @@ -31,14 +31,10 @@
from weaviate.util import (
_check_positive_num,
is_weaviate_domain,
is_weaviate_too_old,
is_weaviate_client_too_old,
PYPI_PACKAGE_URL,
_decode_json_response_dict,
)
from weaviate.warnings import _Warnings


try:
import grpc # type: ignore
from weaviate.proto.v1 import weaviate_pb2_grpc
Expand Down Expand Up @@ -171,17 +167,6 @@ def __init__(
self._server_version = self.get_meta()["version"]
if self._server_version < "1.14":
_Warnings.weaviate_server_older_than_1_14(self._server_version)
if is_weaviate_too_old(self._server_version):
_Warnings.weaviate_too_old_vs_latest(self._server_version)

try:
pkg_info = requests.get(PYPI_PACKAGE_URL, timeout=INIT_CHECK_TIMEOUT).json()
pkg_info = pkg_info.get("info", {})
latest_version = pkg_info.get("version", "unknown version")
if is_weaviate_client_too_old(client_version, latest_version):
_Warnings.weaviate_client_too_old_vs_latest(client_version, latest_version)
except requests.exceptions.RequestException:
pass # ignore any errors related to requests, it is a best-effort warning

def _create_sessions(self, auth_client_secret: Optional[AuthCredentials]) -> None:
"""Creates a async httpx session and a sync request session.
Expand Down
28 changes: 0 additions & 28 deletions weaviate/warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,31 +106,3 @@ def token_refresh_failed(exc: Exception) -> None:
category=UserWarning,
stacklevel=1,
)

@staticmethod
def weaviate_too_old_vs_latest(server_version: str) -> None:
warnings.warn(
message=f"""Dep004: You are connected to Weaviate {server_version}.
Please consider upgrading to the latest version. See https://www.weaviate.io/developers/weaviate for details.""",
category=DeprecationWarning,
stacklevel=1,
)

@staticmethod
def weaviate_client_too_old_vs_latest(client_version: str, latest_version: str) -> None:
warnings.warn(
message=f"""Dep005: You are using weaviate-client version {client_version}. The latest version is {latest_version}.
Please consider upgrading to the latest version. See https://weaviate.io/developers/weaviate/client-libraries/python for details.""",
category=DeprecationWarning,
stacklevel=1,
)

@staticmethod
def use_of_client_batch_will_be_removed_in_next_major_release() -> None:
warnings.warn(
message="""Dep006: You are using the `client.batch()` method, which will be removed in the next major release.
Please instead use the `client.batch.configure()` method to configure your batch and `client.batch` to enter the context manager.
See https://weaviate.io/developers/weaviate/client-libraries/python for details.""",
category=DeprecationWarning,
stacklevel=1,
)
Loading