Skip to content

Commit a41055d

Browse files
authored
Merge branch 'master' into addCertforREST
2 parents b98ce78 + b39aeef commit a41055d

38 files changed

+2527
-1127
lines changed

.github/mergify.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ pull_request_rules:
44
- or:
55
- base=master
66
- base~=2\.\d
7-
- "status-success=Run Python Tests (3.8, windows-2022)"
8-
- "status-success=Run Python Tests (3.12, windows-2022)"
9-
- "status-success=Run Python Tests (3.8, ubuntu-22.04)"
10-
- "status-success=Run Python Tests (3.12, ubuntu-22.04)"
11-
- "status-success=Run Check Proto (3.8)"
12-
- "status-success=Code lint check (3.8)"
13-
- "status-success=Run Check Proto (3.12)"
14-
- "status-success=Code lint check (3.12)"
7+
# Require that Python tests succeed on Windows (any Python version, any Windows build)
8+
- "status-success~=Run Python Tests \\(\\d+\\.\\d+, windows-\\S+\\)"
9+
# Require that Python tests succeed on Ubuntu (any Python version, any Ubuntu build)
10+
- "status-success~=Run Python Tests \\(\\d+\\.\\d+, ubuntu-\\S+\\)"
11+
# Require that proto checks pass for any Python version
12+
- "status-success~=Run Check Proto \\(\\d+\\.\\d+\\)"
13+
# Require that code lint checks pass for any Python version
14+
- "status-success~=Code lint check \\(\\d+\\.\\d+\\)"
1515
actions:
1616
label:
1717
add:

.github/workflows/check_milvus_proto.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-22.04
1212
strategy:
1313
matrix:
14-
python-version: [3.8, 3.12]
14+
python-version: [3.8, 3.13]
1515
steps:
1616
- uses: actions/checkout@v4
1717
- name: Set up Python ${{ matrix.python-version }}

.github/workflows/code_checker.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-22.04
1212
strategy:
1313
matrix:
14-
python-version: [3.8, 3.12]
14+
python-version: [3.8, 3.13]
1515
steps:
1616
- name: Checkout code
1717
uses: actions/checkout@v4

.github/workflows/publish_dev_package.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020
run: |
2121
git fetch --prune --unshallow
2222
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
23-
- name: Set up Python 3.12
23+
- name: Set up Python 3.13
2424
uses: actions/setup-python@v5
2525
with:
26-
python-version: 3.12
26+
python-version: 3.13
2727
- name: Install pypa/build
2828
run: >-
2929
python -m

.github/workflows/publish_on_release.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ jobs:
1919
run: |
2020
git fetch --prune --unshallow
2121
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
22-
- name: Set up Python 3.12
22+
- name: Set up Python 3.13
2323
uses: actions/setup-python@v5
2424
with:
25-
python-version: 3.12
25+
python-version: 3.13
2626
- name: Install pypa/build
2727
run: >-
2828
python -m

.github/workflows/pull_request.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
name: Run Python Tests
1111
strategy:
1212
matrix:
13-
python-version: [3.8, 3.12]
13+
python-version: [3.8, 3.13]
1414
os: [ubuntu-22.04, windows-2022]
1515
runs-on: ${{ matrix.os }}
1616

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ TODO
2929
# GitHub
3030
.coverage
3131
htmlcov/
32-
debug/
32+
**/debug/
3333
.codecov.yml
3434
coverage.xml
3535

examples/hybrid_search.py

-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
milvus_client.load_collection(collection_name)
5050

5151
field_names = ["embeddings", "embeddings2"]
52-
field_names = ["embeddings"]
5352

5453
req_list = []
5554
nq = 1

examples/hybrid_search/hybrid_search.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
req_list.append(req)
8181

8282
print(fmt.format("rank by WightedRanker"))
83-
hybrid_res = hello_milvus.hybrid_search(req_list, WeightedRanker(*weights), default_limit, output_fields=["random"])
83+
hybrid_res = hello_milvus.hybrid_search(req_list, WeightedRanker(*weights, norm_score=True), default_limit, output_fields=["random"])
8484
for hits in hybrid_res:
8585
for hit in hits:
8686
print(f" hybrid search hit: {hit}")

examples/simple_async.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,4 @@ async def other_async_task(collection_name):
122122

123123
results = loop.run_until_complete(other_async_task(collection_name))
124124
for r in results:
125-
print(r)
125+
print(r)

pymilvus/bulk_writer/bulk_import.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ def bulk_import(
140140
"secretKey": secret_key,
141141
}
142142

143+
options = kwargs.pop("options", {})
144+
if isinstance(options, dict):
145+
params["options"] = options
146+
143147
resp = _post_request(url=request_url, api_key=api_key, params=params, verify=verify, cert=cert, **kwargs)
144148
_handle_response(request_url, resp.json())
145149
return resp
@@ -218,4 +222,4 @@ def list_import_jobs(
218222

219223
resp = _post_request(url=request_url, api_key=api_key, params=params, verify=verify, cert=cert, **kwargs)
220224
_handle_response(request_url, resp.json())
221-
return resp
225+
return resp

pymilvus/client/abstract.py

+8-21
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import abc
2-
from typing import Any, Dict, List, Optional, Sequence, Tuple, Union
2+
from typing import Any, Dict, List, Optional, Tuple, Union
33

44
import ujson
55

@@ -351,19 +351,6 @@ def _pack(self, raw: Any):
351351
)
352352

353353

354-
class SequenceIterator:
355-
def __init__(self, seq: Sequence[Any]):
356-
self._seq = seq
357-
self._idx = 0
358-
359-
def __next__(self) -> Any:
360-
if self._idx < len(self._seq):
361-
res = self._seq[self._idx]
362-
self._idx += 1
363-
return res
364-
raise StopIteration
365-
366-
367354
class BaseRanker:
368355
def __int__(self):
369356
return
@@ -394,16 +381,22 @@ def dict(self):
394381

395382

396383
class WeightedRanker(BaseRanker):
397-
def __init__(self, *nums):
384+
def __init__(self, *nums, norm_score: bool = True):
398385
self._strategy = RANKER_TYPE_WEIGHTED
399386
weights = []
400387
for num in nums:
388+
# isinstance(True, int) is True, thus we need to check bool first
389+
if isinstance(num, bool) or not isinstance(num, (int, float)):
390+
error_msg = f"Weight must be a number, got {type(num)}"
391+
raise TypeError(error_msg)
401392
weights.append(num)
402393
self._weights = weights
394+
self._norm_score = norm_score
403395

404396
def dict(self):
405397
params = {
406398
"weights": self._weights,
399+
"norm_score": self._norm_score,
407400
}
408401
return {
409402
"strategy": self._strategy,
@@ -660,9 +653,6 @@ def get_fields_by_range(
660653
continue
661654
return field2data
662655

663-
def __iter__(self) -> SequenceIterator:
664-
return SequenceIterator(self)
665-
666656
def __str__(self) -> str:
667657
"""Only print at most 10 query results"""
668658
reminder = f" ... and {len(self) - 10} results remaining" if len(self) > 10 else ""
@@ -743,9 +733,6 @@ def __init__(
743733

744734
super().__init__(hits)
745735

746-
def __iter__(self) -> SequenceIterator:
747-
return SequenceIterator(self)
748-
749736
def __str__(self) -> str:
750737
"""Only print at most 10 query results"""
751738
reminder = f" ... and {len(self) - 10} entities remaining" if len(self) > 10 else ""

0 commit comments

Comments
 (0)