Skip to content

Commit

Permalink
Merge pull request #1336 from weaviate/merge_main
Browse files Browse the repository at this point in the history
Sync dev/1.27 with main
  • Loading branch information
dirkkul authored Oct 15, 2024
2 parents b30e8f4 + 1a44c5c commit d2803d7
Show file tree
Hide file tree
Showing 40 changed files with 482 additions and 273 deletions.
38 changes: 27 additions & 11 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ on:

env:
WEAVIATE_123: 1.23.16
WEAVIATE_124: 1.24.21
WEAVIATE_125: 1.25.8
WEAVIATE_126: preview-allow-multiple-inputs-for-a-single-target-vector-199cd7e
WEAVIATE_127: 1.27.0-rc.0

WEAVIATE_124: preview-rename-object-deletion-to-deletion-strategy-727ecf7
WEAVIATE_125: stable-v1.25-d9f6cbb
WEAVIATE_126: stable-v1.26-6a411a4
WEAVIATE_127: preview-merge-stable-v1-27-into-main-33adc57

jobs:
lint-and-format:
Expand Down Expand Up @@ -47,7 +46,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
version: ["3.9", "3.10", "3.11", "3.12"]
folder: ["weaviate"]
steps:
- uses: actions/checkout@v4
Expand All @@ -68,7 +67,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
version: ["3.9", "3.10", "3.11", "3.12"]
folder: ["test", "mock_tests"]
steps:
- uses: actions/checkout@v4
Expand All @@ -91,7 +90,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
version: ["3.9", "3.10", "3.11", "3.12"]
optional_dependencies: [false]
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -122,7 +121,6 @@ jobs:
fail-fast: false
matrix:
versions: [
{ py: "3.8", weaviate: $WEAVIATE_126},
{ py: "3.9", weaviate: $WEAVIATE_126},
{ py: "3.10", weaviate: $WEAVIATE_126},
{ py: "3.11", weaviate: $WEAVIATE_123},
Expand All @@ -141,6 +139,11 @@ jobs:
with:
python-version: ${{ matrix.versions.py }}
cache: 'pip' # caching pip dependencies
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{secrets.DOCKER_USERNAME}}
password: ${{secrets.DOCKER_PASSWORD}}
- run: |
pip install -r requirements-devel.txt
pip install .
Expand Down Expand Up @@ -174,7 +177,6 @@ jobs:
fail-fast: false
matrix:
versions: [
{ py: "3.8", weaviate: $WEAVIATE_126},
{ py: "3.9", weaviate: $WEAVIATE_126},
{ py: "3.10", weaviate: $WEAVIATE_126},
{ py: "3.11", weaviate: $WEAVIATE_123},
Expand All @@ -193,6 +195,11 @@ jobs:
with:
python-version: ${{ matrix.versions.py }}
cache: 'pip' # caching pip dependencies
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{secrets.DOCKER_USERNAME}}
password: ${{secrets.DOCKER_PASSWORD}}
- run: |
pip install -r requirements-devel.txt
pip install .
Expand Down Expand Up @@ -226,7 +233,6 @@ jobs:
fail-fast: false
matrix:
versions: [
{ py: "3.8", weaviate: $WEAVIATE_125},
{ py: "3.9", weaviate: $WEAVIATE_125},
{ py: "3.10", weaviate: $WEAVIATE_125},
{ py: "3.11", weaviate: $WEAVIATE_125},
Expand All @@ -239,6 +245,11 @@ jobs:
with:
python-version: "3.11"
cache: 'pip' # caching pip dependencies
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{secrets.DOCKER_USERNAME}}
password: ${{secrets.DOCKER_PASSWORD}}
- run: pip install -r requirements-devel.txt
- run: pip install .
- name: free space
Expand Down Expand Up @@ -325,6 +336,11 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{secrets.DOCKER_USERNAME}}
password: ${{secrets.DOCKER_PASSWORD}}
- name: Download build artifact to append to release
uses: actions/download-artifact@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
exclude: ^proto/
repos:
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.8.0
rev: 24.10.0
hooks:
- id: black
language_version: python3.12
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Weaviate python client

A python native client for easy interaction with a Weaviate instance.

The client is tested for python 3.8 and higher.
The client is tested for python 3.9 and higher.

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

Expand Down
8 changes: 4 additions & 4 deletions integration/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ def test_collection_config_get(collection_factory: CollectionFactory) -> None:
assert config.vectorizer == Vectorizers.NONE


@pytest.mark.parametrize("return_properties", [None, [], ["name"]])
@pytest.mark.parametrize("return_properties", [None, [], ["name"], False, True])
@pytest.mark.parametrize(
"return_metadata",
[
Expand All @@ -983,7 +983,7 @@ def test_collection_config_get(collection_factory: CollectionFactory) -> None:
@pytest.mark.parametrize("include_vector", [False, True])
def test_return_properties_metadata_references_combos(
collection_factory: CollectionFactory,
return_properties: Optional[List[PROPERTY]],
return_properties: Union[List[PROPERTY], bool, None],
return_metadata: Optional[MetadataQuery],
return_references: Optional[List[REFERENCE]],
include_vector: bool,
Expand Down Expand Up @@ -1022,12 +1022,12 @@ def test_return_properties_metadata_references_combos(

assert obj.uuid is not None

if return_properties is None:
if return_properties is None or return_properties is True:
assert "name" in obj.properties
assert "age" in obj.properties
assert obj.properties["name"] == "John"
assert obj.properties["age"] == 43
elif len(return_properties) == 0:
elif return_properties is False or len(return_properties) == 0:
assert "name" not in obj.properties
assert "age" not in obj.properties
else:
Expand Down
19 changes: 18 additions & 1 deletion integration/test_collection_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from _pytest.fixtures import SubRequest

import weaviate
import weaviate.classes as wvc
from integration.conftest import OpenAICollection, CollectionFactory
from integration.conftest import _sanitize_collection_name
from weaviate.collections.classes.config import (
Expand Down Expand Up @@ -255,7 +256,11 @@ def test_collection_config_full(collection_factory: CollectionFactory) -> None:
multi_tenancy_config=Configure.multi_tenancy(
enabled=True, auto_tenant_activation=True, auto_tenant_creation=True
),
replication_config=Configure.replication(factor=2, async_enabled=True),
replication_config=Configure.replication(
factor=2,
async_enabled=True,
deletion_strategy=wvc.config.DeletionStrategy.DELETE_ON_CONFLICT,
),
vector_index_config=Configure.VectorIndex.hnsw(
cleanup_interval_seconds=10,
distance_metric=VectorDistances.DOT,
Expand Down Expand Up @@ -339,6 +344,18 @@ def test_collection_config_full(collection_factory: CollectionFactory) -> None:
else:
assert config.replication_config.async_enabled is False

if collection._connection._weaviate_version.is_at_least(1, 24, 25):
assert (
config.replication_config.deletion_strategy
== wvc.config.DeletionStrategy.DELETE_ON_CONFLICT
)
else:
# default value if not present in schema
assert (
config.replication_config.deletion_strategy
== wvc.config.DeletionStrategy.NO_AUTOMATED_RESOLUTION
)

assert isinstance(config.vector_index_config, _VectorIndexConfigHNSW)
assert isinstance(config.vector_index_config.quantizer, _PQConfig)
assert config.vector_index_config.cleanup_interval_seconds == 10
Expand Down
35 changes: 35 additions & 0 deletions integration_v3/test_backup_v4.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def test_create_and_restore_backup_with_waiting(client: weaviate.WeaviateClient)
# check create status
create_status = client.backup.get_create_status(backup_id, BACKEND)
assert create_status.status == BackupStatus.SUCCESS
assert create_status.backup_id == backup_id

# remove existing class
client.collections.delete("Article")
Expand Down Expand Up @@ -449,3 +450,37 @@ def test_backup_and_restore_with_collection_and_config_1_23_x(
wait_for_completion=True,
config=BackupConfigRestore(cpu_percentage=70),
)


# did not make it into 1.27, will come later
# def test_list_backup(client: weaviate.WeaviateClient) -> None:
# """Create and restore backup without waiting."""
# backup_id = _create_backup_id()
# if client._connection._weaviate_version.is_lower_than(1, 27, 0):
# pytest.skip("List backups is only supported from 1.27.0")
#
# resp = client.backup.create(backup_id=backup_id, backend=BACKEND)
# assert resp.status == BackupStatus.STARTED
#
# backups = client.backup.list_backups(backend=BACKEND)
# assert backup_id in [b.backup_id for b in backups]


def test_cancel_backup(client: weaviate.WeaviateClient) -> None:
"""Create and restore backup without waiting."""
backup_id = _create_backup_id()
if client._connection._weaviate_version.is_lower_than(1, 24, 25):
pytest.skip("Cancel backups is only supported from 1.24.25")

resp = client.backup.create(backup_id=backup_id, backend=BACKEND)
assert resp.status == BackupStatus.STARTED

assert client.backup.cancel_backup(backup_id=backup_id, backend=BACKEND)

# async process
start = time.time()
while time.time() - start < 5:
status_resp = client.backup.get_create_status(backup_id=backup_id, backend=BACKEND)
if status_resp.status == BackupStatus.CANCELED:
break
time.sleep(0.1)
2 changes: 1 addition & 1 deletion mock_tests/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def test_missing_multi_tenancy_config(
),
properties=[],
references=[],
replication_config=ReplicationConfig(factor=0, async_enabled=False),
replication_config=ReplicationConfig(factor=0, async_enabled=False, deletion_strategy=None),
vector_index_config=vic,
vector_index_type=VectorIndexType.FLAT,
vectorizer=Vectorizers.NONE,
Expand Down
2 changes: 1 addition & 1 deletion requirements-devel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ flake8
flake8-bugbear==24.8.19
flake8-comprehensions==3.15.0
flake8-builtins==2.5.0
black==24.8.0
black==24.10.0
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ install_requires =
grpcio>=1.57.0,<2.0.0
grpcio-tools>=1.57.0,<2.0.0
grpcio-health-checking>=1.57.0,<2.0.0
python_requires = >=3.8
python_requires = >=3.9


[options.package_data]
Expand Down
Loading

0 comments on commit d2803d7

Please sign in to comment.