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

Deprecate v3 in v4 #1239

Merged
merged 7 commits into from
Sep 2, 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
10 changes: 9 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ The client is tested for python 3.8 and higher.

Visit the official `Weaviate <https://weaviate.io/>`_ website for more information about the Weaviate and how to use it in production.

Client Versions
---------------
We currently support the following versions client versions:

- 4.X: actively supported
- 3.X: deprecated, receives only critical bug fixes and dependency updates
- copy of the 3.X branch in v4 releases: Will be removed on 2024-11-30


Articles
--------

Expand All @@ -32,7 +41,6 @@ Here are some articles on Weaviate:
- `Getting Started with Weaviate Python Library <https://towardsdatascience.com/getting-started-with-weaviate-python-client-e85d14f19e4f>`_
- `A sub-50ms neural search with DistilBERT and Weaviate <https://towardsdatascience.com/a-sub-50ms-neural-search-with-distilbert-and-weaviate-4857ae390154>`_


Documentation
-------------

Expand Down
23 changes: 16 additions & 7 deletions weaviate/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,22 @@

from httpx import HTTPError as HttpxError
from requests.exceptions import ConnectionError as RequestsConnectionError
from typing_extensions import deprecated

from weaviate import syncify
from weaviate.backup.backup import _BackupAsync
from weaviate.backup.sync import _Backup


from weaviate import syncify
from weaviate.event_loop import _EventLoopSingleton, _EventLoop
from .auth import AuthCredentials
from .backup import Backup
from .batch import Batch
from .classification import Classification

from .client_base import _WeaviateClientBase
from .cluster import Cluster
from .collections.collections.async_ import _CollectionsAsync
from .collections.collections.sync import _Collections
from .collections.batch.client import _BatchClientWrapper
from .collections.cluster import _Cluster, _ClusterAsync
from .collections.collections.async_ import _CollectionsAsync
from .collections.collections.sync import _Collections
from .config import AdditionalConfig, Config
from .connect import Connection
from .connect.base import (
Expand All @@ -40,7 +39,6 @@
)
from .gql import Query
from .schema import Schema
from weaviate.event_loop import _EventLoopSingleton, _EventLoop
from .types import NUMBER
from .util import _get_valid_timeout_config, _type_request_response
from .warnings import _Warnings
Expand Down Expand Up @@ -175,6 +173,17 @@ async def __aexit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None
await self.close()


@deprecated(
"""
Python client v3 `weaviate.Client(...)` connections and methods are deprecated and will
be removed by 2024-11-30.

Upgrade your code to use Python client v4 `weaviate.WeaviateClient` connections and methods.
- For Python Client v4 usage, see: https://weaviate.io/developers/weaviate/client-libraries/python
- For code migration, see: https://weaviate.io/developers/weaviate/client-libraries/python/v3_v4_migration

If you have to use v3 code, install the v3 client and pin the v3 dependency in your requirements file: `weaviate-client>=3.26.7;<4.0.0`"""
)
class Client:
"""
The v3 Python-native Weaviate Client class that encapsulates Weaviate functionalities in one object.
Expand Down
12 changes: 7 additions & 5 deletions weaviate/warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,14 @@ def root_module_import(name: str, loc: str) -> None:
@staticmethod
def weaviate_v3_client_is_deprecated() -> None:
warnings.warn(
message="""Dep016: Python client v3 `weaviate.Client(...)` connections and methods are deprecated. Update
your code to use Python client v4 `weaviate.WeaviateClient` connections and methods.
message="""Dep016: Python client v3 `weaviate.Client(...)` connections and methods are deprecated and will
be removed by 2024-11-30.

For Python Client v4 usage, see: https://weaviate.io/developers/weaviate/client-libraries/python
For code migration, see: https://weaviate.io/developers/weaviate/client-libraries/python/v3_v4_migration
""",
Upgrade your code to use Python client v4 `weaviate.WeaviateClient` connections and methods.
- For Python Client v4 usage, see: https://weaviate.io/developers/weaviate/client-libraries/python
- For code migration, see: https://weaviate.io/developers/weaviate/client-libraries/python/v3_v4_migration

If you have to use v3 code, install the v3 client and pin the v3 dependency in your requirements file: `weaviate-client>=3.26.7;<4.0.0`""",
category=DeprecationWarning,
stacklevel=1,
)
Expand Down