meilisearch-python-sdk 3.4.0__tar.gz → 3.5.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of meilisearch-python-sdk might be problematic. Click here for more details.
- meilisearch_python_sdk-3.5.1/.github/release-draft-template.yaml +28 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/.github/workflows/nightly_testing.yml +1 -1
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/.github/workflows/testing.yaml +79 -55
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/.pre-commit-config.yaml +2 -2
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/PKG-INFO +2 -1
- meilisearch_python_sdk-3.5.1/codecov.yml +6 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/examples/add_documents_in_batches.py +2 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/examples/async_add_documents_decorator.py +5 -2
- meilisearch_python_sdk-3.5.1/examples/async_add_documents_in_batches.py +34 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/examples/async_documents_and_search_results.py +2 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/examples/async_search_tracker.py +21 -6
- meilisearch_python_sdk-3.5.1/examples/async_update_settings.py +43 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/examples/documents_and_search_results.py +2 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/examples/orjson_example.py +11 -2
- meilisearch_python_sdk-3.5.1/examples/pyproject.toml +4 -0
- meilisearch_python_sdk-3.5.1/examples/requirements.txt +4 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/examples/search_tracker.py +22 -7
- meilisearch_python_sdk-3.5.1/examples/tests/conftest.py +56 -0
- meilisearch_python_sdk-3.5.1/examples/tests/test_async_examples.py +53 -0
- meilisearch_python_sdk-3.5.1/examples/tests/test_examples.py +47 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/examples/ujson_example.py +11 -2
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/examples/update_settings.py +20 -10
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/justfile +11 -1
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/meilisearch_python_sdk/_client.py +46 -240
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/meilisearch_python_sdk/_task.py +1 -5
- meilisearch_python_sdk-3.5.1/meilisearch_python_sdk/_version.py +1 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/meilisearch_python_sdk/decorators.py +2 -10
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/meilisearch_python_sdk/index.py +394 -966
- meilisearch_python_sdk-3.5.1/meilisearch_python_sdk/py.typed +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/pyproject.toml +8 -8
- meilisearch_python_sdk-3.5.1/tests/__init__.py +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/tests/conftest.py +21 -14
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/tests/test_async_client.py +5 -13
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/tests/test_async_documents.py +102 -1
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/tests/test_async_search.py +2 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/tests/test_client.py +5 -13
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/tests/test_search.py +2 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/uv.lock +229 -230
- meilisearch_python_sdk-3.4.0/.github/release-draft-template.yaml +0 -29
- meilisearch_python_sdk-3.4.0/codecov.yml +0 -6
- meilisearch_python_sdk-3.4.0/examples/async_add_documents_in_batches.py +0 -24
- meilisearch_python_sdk-3.4.0/examples/async_update_settings.py +0 -32
- meilisearch_python_sdk-3.4.0/examples/requirements.txt +0 -2
- meilisearch_python_sdk-3.4.0/meilisearch_python_sdk/_version.py +0 -1
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/.github/FUNDING.yml +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/.github/dependabot.yaml +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/.github/workflows/pypi_publish.yaml +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/.github/workflows/release-drafter.yaml +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/.gitignore +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/CONTRIBUTING.md +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/LICENSE +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/README.md +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/assets/add_in_batches.png +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/assets/searches.png +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/benchmark/run_benchmark.py +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/datasets/small_movies.json +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/docker-compose.https.yml +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/docker-compose.yml +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/docs/.nojekyll +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/docs/CNAME +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/docs/async_client_api.md +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/docs/async_index_api.md +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/docs/client_api.md +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/docs/css/custom.css +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/docs/decorators_api.md +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/docs/index.md +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/docs/index_api.md +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/docs/js/umami.js +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/docs/json_handler.md +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/docs/plugins.md +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/docs/pydantic.md +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/examples/.gitignore +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/examples/README.md +0 -0
- {meilisearch_python_sdk-3.4.0/meilisearch_python_sdk/models → meilisearch_python_sdk-3.5.1/examples}/__init__.py +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/examples/add_documents_decorator.py +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/examples/fastapi_example.py +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1/examples}/tests/__init__.py +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/meilisearch_python_sdk/__init__.py +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/meilisearch_python_sdk/_http_requests.py +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/meilisearch_python_sdk/_utils.py +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/meilisearch_python_sdk/errors.py +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/meilisearch_python_sdk/json_handler.py +0 -0
- /meilisearch_python_sdk-3.4.0/meilisearch_python_sdk/py.typed → /meilisearch_python_sdk-3.5.1/meilisearch_python_sdk/models/__init__.py +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/meilisearch_python_sdk/models/client.py +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/meilisearch_python_sdk/models/documents.py +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/meilisearch_python_sdk/models/health.py +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/meilisearch_python_sdk/models/index.py +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/meilisearch_python_sdk/models/search.py +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/meilisearch_python_sdk/models/settings.py +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/meilisearch_python_sdk/models/task.py +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/meilisearch_python_sdk/models/version.py +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/meilisearch_python_sdk/plugins.py +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/meilisearch_python_sdk/types.py +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/mkdocs.yaml +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/tests/test_async_index.py +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/tests/test_async_index_plugins.py +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/tests/test_decorators.py +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/tests/test_documents.py +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/tests/test_errors.py +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/tests/test_index.py +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/tests/test_index_plugins.py +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/tests/test_utils.py +0 -0
- {meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/tests/test_version.py +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name-template: "v$RESOLVED_VERSION"
|
|
2
|
+
tag-template: "v$RESOLVED_VERSION"
|
|
3
|
+
exclude-labels:
|
|
4
|
+
- "dependencies"
|
|
5
|
+
- "skip-changelog"
|
|
6
|
+
version-resolver:
|
|
7
|
+
major:
|
|
8
|
+
labels:
|
|
9
|
+
- "breaking-change"
|
|
10
|
+
minor:
|
|
11
|
+
labels:
|
|
12
|
+
- "enhancement"
|
|
13
|
+
- "feature"
|
|
14
|
+
default: patch
|
|
15
|
+
categories:
|
|
16
|
+
- title: "⚠️ Breaking changes"
|
|
17
|
+
label: "breaking-change"
|
|
18
|
+
- title: "Features"
|
|
19
|
+
labels:
|
|
20
|
+
- "feature"
|
|
21
|
+
- "enhancement"
|
|
22
|
+
- title: "Bug Fixes"
|
|
23
|
+
labels: "bug"
|
|
24
|
+
change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
|
|
25
|
+
template: |
|
|
26
|
+
## Changes
|
|
27
|
+
|
|
28
|
+
$CHANGES
|
{meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/.github/workflows/testing.yaml
RENAMED
|
@@ -40,7 +40,7 @@ jobs:
|
|
|
40
40
|
strategy:
|
|
41
41
|
fail-fast: false
|
|
42
42
|
matrix:
|
|
43
|
-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13
|
|
43
|
+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
|
|
44
44
|
runs-on: ubuntu-latest
|
|
45
45
|
steps:
|
|
46
46
|
- uses: actions/checkout@v4
|
|
@@ -76,7 +76,7 @@ jobs:
|
|
|
76
76
|
strategy:
|
|
77
77
|
fail-fast: false
|
|
78
78
|
matrix:
|
|
79
|
-
python-version: [
|
|
79
|
+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
|
|
80
80
|
runs-on: ubuntu-latest
|
|
81
81
|
steps:
|
|
82
82
|
- uses: actions/checkout@v4
|
|
@@ -98,16 +98,20 @@ jobs:
|
|
|
98
98
|
uv-${{ runner.os }}
|
|
99
99
|
- name: Install Dependencies
|
|
100
100
|
run: just install
|
|
101
|
-
- name:
|
|
101
|
+
- name: Install truststore
|
|
102
|
+
if: ${{ ! startsWith(matrix.python-version, '3.9') }}
|
|
103
|
+
run: uv pip install truststore
|
|
104
|
+
- name: Install ssl requirements
|
|
102
105
|
run: |
|
|
103
|
-
sudo apt-get update
|
|
104
|
-
sudo apt-get install -y libnss3-tools build-essential gcc
|
|
105
|
-
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
|
106
|
-
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
|
107
|
-
brew install mkcert
|
|
108
|
-
mkcert -install
|
|
109
|
-
mkcert -key-file meilisearch.key -cert-file meilisearch.crt localhost 127.0.0.1 ::1
|
|
110
|
-
|
|
106
|
+
sudo apt-get update
|
|
107
|
+
sudo apt-get install -y libnss3-tools build-essential gcc
|
|
108
|
+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
|
109
|
+
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
|
110
|
+
brew install mkcert
|
|
111
|
+
mkcert -install
|
|
112
|
+
mkcert -key-file meilisearch.key -cert-file meilisearch.crt localhost 127.0.0.1 ::1
|
|
113
|
+
- name: Test with pytest
|
|
114
|
+
run: just test-parallel-ci-http2
|
|
111
115
|
- name: Upload coverage
|
|
112
116
|
uses: codecov/codecov-action@v4
|
|
113
117
|
with:
|
|
@@ -120,7 +124,7 @@ jobs:
|
|
|
120
124
|
strategy:
|
|
121
125
|
fail-fast: false
|
|
122
126
|
matrix:
|
|
123
|
-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13
|
|
127
|
+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
|
|
124
128
|
runs-on: ubuntu-latest
|
|
125
129
|
steps:
|
|
126
130
|
- uses: actions/checkout@v4
|
|
@@ -153,49 +157,69 @@ jobs:
|
|
|
153
157
|
run: uv cache prune --ci
|
|
154
158
|
|
|
155
159
|
no-parallel-testing-http2:
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
160
|
+
strategy:
|
|
161
|
+
fail-fast: false
|
|
162
|
+
matrix:
|
|
163
|
+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
|
|
164
|
+
runs-on: ubuntu-latest
|
|
165
|
+
steps:
|
|
166
|
+
- uses: actions/checkout@v4
|
|
167
|
+
- name: install Just
|
|
168
|
+
uses: taiki-e/install-action@just
|
|
169
|
+
- name: Install uv
|
|
170
|
+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
171
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
172
|
+
uses: actions/setup-python@v5
|
|
173
|
+
with:
|
|
174
|
+
python-version: ${{ matrix.python-version }}
|
|
175
|
+
- name: Restore uv cache
|
|
176
|
+
uses: actions/cache@v4
|
|
177
|
+
with:
|
|
178
|
+
path: ${{ env.UV_CACHE_DIR }}
|
|
179
|
+
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
|
180
|
+
restore-keys: |
|
|
181
|
+
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
|
182
|
+
uv-${{ runner.os }}
|
|
183
|
+
- name: Install Dependencies
|
|
184
|
+
run: just install
|
|
185
|
+
- name: Install truststore
|
|
186
|
+
if: ${{ ! startsWith(matrix.python-version, '3.9') }}
|
|
187
|
+
run: uv pip install truststore
|
|
188
|
+
- name: Install ssl requirements
|
|
189
|
+
run: |
|
|
190
|
+
sudo apt-get update
|
|
191
|
+
sudo apt-get install -y libnss3-tools build-essential gcc
|
|
192
|
+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
|
193
|
+
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
|
194
|
+
brew install mkcert
|
|
195
|
+
mkcert -install
|
|
196
|
+
mkcert -key-file meilisearch.key -cert-file meilisearch.crt localhost 127.0.0.1 ::1
|
|
197
|
+
- name: Test with pytest
|
|
198
|
+
run: just test-no-parallel-ci-http2
|
|
199
|
+
- name: Upload coverage
|
|
200
|
+
uses: codecov/codecov-action@v4
|
|
201
|
+
with:
|
|
202
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
203
|
+
fail_ci_if_error: true
|
|
204
|
+
- name: Minimize uv cache
|
|
205
|
+
run: uv cache prune --ci
|
|
206
|
+
example-testing:
|
|
207
|
+
strategy:
|
|
208
|
+
fail-fast: false
|
|
209
|
+
matrix:
|
|
210
|
+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
|
|
211
|
+
runs-on: ubuntu-latest
|
|
212
|
+
steps:
|
|
213
|
+
- uses: actions/checkout@v4
|
|
214
|
+
- name: install Just
|
|
215
|
+
uses: taiki-e/install-action@just
|
|
216
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
217
|
+
uses: actions/setup-python@v5
|
|
218
|
+
with:
|
|
219
|
+
python-version: ${{ matrix.python-version }}
|
|
220
|
+
cache: pip
|
|
221
|
+
- name: Test with pytest
|
|
222
|
+
run: just test-examples-ci
|
|
199
223
|
|
|
200
224
|
docs:
|
|
201
225
|
runs-on: ubuntu-latest
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
repos:
|
|
2
2
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
-
rev:
|
|
3
|
+
rev: v5.0.0
|
|
4
4
|
hooks:
|
|
5
5
|
- id: check-added-large-files
|
|
6
6
|
- id: check-toml
|
|
@@ -14,7 +14,7 @@ repos:
|
|
|
14
14
|
- id: mypy
|
|
15
15
|
additional_dependencies: [pydantic, types-aiofiles, types-ujson]
|
|
16
16
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
17
|
-
rev: v0.6.
|
|
17
|
+
rev: v0.6.9
|
|
18
18
|
hooks:
|
|
19
19
|
- id: ruff
|
|
20
20
|
args: [--fix, --exit-non-zero-on-fix]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: meilisearch-python-sdk
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.5.1
|
|
4
4
|
Summary: A Python client providing both async and sync support for the Meilisearch API
|
|
5
5
|
Project-URL: repository, https://github.com/sanders41/meilisearch-python-sdk
|
|
6
6
|
Project-URL: homepage, https://github.com/sanders41/meilisearch-python-sdk
|
|
@@ -37,6 +37,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
37
37
|
Classifier: Programming Language :: Python :: 3.10
|
|
38
38
|
Classifier: Programming Language :: Python :: 3.11
|
|
39
39
|
Classifier: Programming Language :: Python :: 3.12
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
40
41
|
Classifier: Typing :: Typed
|
|
41
42
|
Requires-Python: >=3.9
|
|
42
43
|
Requires-Dist: aiofiles>=0.7
|
|
@@ -2,6 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import asyncio
|
|
4
4
|
import json
|
|
5
|
+
from pathlib import Path
|
|
5
6
|
from typing import Any
|
|
6
7
|
|
|
7
8
|
import aiofiles
|
|
@@ -14,8 +15,10 @@ from meilisearch_python_sdk.decorators import ConnectionInfo, async_add_document
|
|
|
14
15
|
index_name="movies",
|
|
15
16
|
connection_info=ConnectionInfo(url="http://127.0.0.1:7700", api_key="masterKey"),
|
|
16
17
|
)
|
|
17
|
-
async def load_documents(
|
|
18
|
-
|
|
18
|
+
async def load_documents(
|
|
19
|
+
file_path: Path | str = "../datasets/small_movies.json",
|
|
20
|
+
) -> list[dict[str, Any]]:
|
|
21
|
+
async with aiofiles.open(file_path) as f:
|
|
19
22
|
data = await f.read()
|
|
20
23
|
documents = json.loads(data)
|
|
21
24
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import asyncio
|
|
4
|
+
import json
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
import aiofiles
|
|
8
|
+
|
|
9
|
+
from meilisearch_python_sdk import AsyncClient, AsyncIndex
|
|
10
|
+
from meilisearch_python_sdk.models.task import TaskInfo
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
async def add_documents_in_batches(
|
|
14
|
+
index: AsyncIndex, file_path: Path | str = "../datasets/small_movies.json"
|
|
15
|
+
) -> list[TaskInfo]:
|
|
16
|
+
async with aiofiles.open(file_path) as f:
|
|
17
|
+
data = await f.read()
|
|
18
|
+
documents = json.loads(data)
|
|
19
|
+
|
|
20
|
+
# Meilisearch prefers larger batch sizes so set this as large as you can.
|
|
21
|
+
return await index.add_documents_in_batches(documents, primary_key="id", batch_size=1000)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
async def main() -> int:
|
|
25
|
+
async with AsyncClient("http://127.0.0.1:7700", "masterKey") as client:
|
|
26
|
+
index = await client.create_index("movies", primary_key="id")
|
|
27
|
+
|
|
28
|
+
await add_documents_in_batches(index)
|
|
29
|
+
|
|
30
|
+
return 0
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
if __name__ == "__main__":
|
|
34
|
+
raise SystemExit(asyncio.run(main()))
|
{meilisearch_python_sdk-3.4.0 → meilisearch_python_sdk-3.5.1}/examples/async_search_tracker.py
RENAMED
|
@@ -1,12 +1,18 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
import asyncio
|
|
2
4
|
import json
|
|
3
5
|
import sqlite3
|
|
6
|
+
from pathlib import Path
|
|
4
7
|
from typing import Any
|
|
5
8
|
|
|
6
9
|
import aiofiles
|
|
7
10
|
|
|
8
|
-
from meilisearch_python_sdk import AsyncClient
|
|
11
|
+
from meilisearch_python_sdk import AsyncClient, AsyncIndex
|
|
12
|
+
from meilisearch_python_sdk.models.search import SearchResults
|
|
13
|
+
from meilisearch_python_sdk.models.task import TaskInfo
|
|
9
14
|
from meilisearch_python_sdk.plugins import AsyncEvent, AsyncIndexPlugins
|
|
15
|
+
from meilisearch_python_sdk.types import JsonDict
|
|
10
16
|
|
|
11
17
|
|
|
12
18
|
class SearchTrackerPlugin:
|
|
@@ -14,8 +20,8 @@ class SearchTrackerPlugin:
|
|
|
14
20
|
POST_EVENT = False
|
|
15
21
|
PRE_EVENT = False
|
|
16
22
|
|
|
17
|
-
def __init__(self) -> None:
|
|
18
|
-
self.conn = sqlite3.Connection(
|
|
23
|
+
def __init__(self, db_path: Path | str = "search_tracker.db") -> None:
|
|
24
|
+
self.conn = sqlite3.Connection(db_path)
|
|
19
25
|
self.create_table()
|
|
20
26
|
|
|
21
27
|
def create_table(self) -> None:
|
|
@@ -43,15 +49,24 @@ class SearchTrackerPlugin:
|
|
|
43
49
|
cursor.close()
|
|
44
50
|
|
|
45
51
|
|
|
46
|
-
async def
|
|
47
|
-
|
|
52
|
+
async def add_documents(
|
|
53
|
+
index: AsyncIndex, file_path: Path | str = "../datasets/small_movies.json"
|
|
54
|
+
) -> TaskInfo:
|
|
55
|
+
async with aiofiles.open(file_path) as f:
|
|
48
56
|
data = await f.read()
|
|
49
57
|
documents = json.loads(data)
|
|
58
|
+
return await index.add_documents(documents)
|
|
59
|
+
|
|
50
60
|
|
|
61
|
+
async def search(index: AsyncIndex, query: str) -> SearchResults[JsonDict]:
|
|
62
|
+
return await index.search(query)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
async def main() -> int:
|
|
51
66
|
async with AsyncClient("http://127.0.0.1:7700", "masterKey") as client:
|
|
52
67
|
plugins = AsyncIndexPlugins(search_plugins=(SearchTrackerPlugin(),))
|
|
53
68
|
index = await client.create_index("movies", primary_key="id", plugins=plugins)
|
|
54
|
-
task = await
|
|
69
|
+
task = await add_documents(index)
|
|
55
70
|
await client.wait_for_task(task.task_uid)
|
|
56
71
|
result = await index.search("Cars")
|
|
57
72
|
print(result) # noqa: T201
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import asyncio
|
|
4
|
+
import json
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
import aiofiles
|
|
8
|
+
|
|
9
|
+
from meilisearch_python_sdk import AsyncClient, AsyncIndex
|
|
10
|
+
from meilisearch_python_sdk.models.settings import MeilisearchSettings
|
|
11
|
+
from meilisearch_python_sdk.models.task import TaskInfo
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
async def add_documents(
|
|
15
|
+
index: AsyncIndex, file_path: Path | str = "../datasets/small_movies.json"
|
|
16
|
+
) -> TaskInfo:
|
|
17
|
+
async with aiofiles.open(file_path) as f:
|
|
18
|
+
data = await f.read()
|
|
19
|
+
documents = json.loads(data)
|
|
20
|
+
|
|
21
|
+
return await index.add_documents(documents)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
async def update_settings(index: AsyncIndex) -> TaskInfo:
|
|
25
|
+
settings = MeilisearchSettings(
|
|
26
|
+
filterable_attributes=["genre"], searchable_attributes=["title", "genre", "overview"]
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
return await index.update_settings(settings)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
async def main() -> int:
|
|
33
|
+
async with AsyncClient("http://127.0.0.1:7700", "masterKey") as client:
|
|
34
|
+
index = await client.create_index("movies", primary_key="id")
|
|
35
|
+
task = await update_settings(index)
|
|
36
|
+
await client.wait_for_task(task.task_uid)
|
|
37
|
+
await add_documents(index)
|
|
38
|
+
|
|
39
|
+
return 0
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
if __name__ == "__main__":
|
|
43
|
+
raise SystemExit(asyncio.run(main()))
|
|
@@ -1,11 +1,20 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
1
5
|
from meilisearch_python_sdk import Client
|
|
2
6
|
from meilisearch_python_sdk.json_handler import OrjsonHandler
|
|
7
|
+
from meilisearch_python_sdk.models.task import TaskInfo
|
|
3
8
|
|
|
4
9
|
|
|
5
|
-
def
|
|
10
|
+
def add_documents(file_path: Path | str = "../datasets/small_movies.json") -> TaskInfo:
|
|
6
11
|
client = Client("http://127.0.0.1:7700", "masterKey", json_handler=OrjsonHandler())
|
|
7
12
|
index = client.create_index("movies", primary_key="id")
|
|
8
|
-
index.add_documents_from_file(
|
|
13
|
+
return index.add_documents_from_file(file_path)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def main() -> int:
|
|
17
|
+
add_documents()
|
|
9
18
|
|
|
10
19
|
return 0
|
|
11
20
|
|
|
@@ -1,17 +1,23 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
import json
|
|
2
4
|
import sqlite3
|
|
5
|
+
from pathlib import Path
|
|
3
6
|
from typing import Any
|
|
4
7
|
|
|
5
|
-
from meilisearch_python_sdk import Client
|
|
8
|
+
from meilisearch_python_sdk import Client, Index
|
|
9
|
+
from meilisearch_python_sdk.models.search import SearchResults
|
|
10
|
+
from meilisearch_python_sdk.models.task import TaskInfo
|
|
6
11
|
from meilisearch_python_sdk.plugins import Event, IndexPlugins
|
|
12
|
+
from meilisearch_python_sdk.types import JsonDict
|
|
7
13
|
|
|
8
14
|
|
|
9
15
|
class SearchTrackerPlugin:
|
|
10
16
|
POST_EVENT = False
|
|
11
17
|
PRE_EVENT = True # Specifies the plugin should be run before the search
|
|
12
18
|
|
|
13
|
-
def __init__(self) -> None:
|
|
14
|
-
self.conn = sqlite3.Connection(
|
|
19
|
+
def __init__(self, db_path: Path | str = "search_tracker.db") -> None:
|
|
20
|
+
self.conn = sqlite3.Connection(db_path)
|
|
15
21
|
self.create_table()
|
|
16
22
|
|
|
17
23
|
def create_table(self) -> None:
|
|
@@ -34,16 +40,25 @@ class SearchTrackerPlugin:
|
|
|
34
40
|
cursor.close()
|
|
35
41
|
|
|
36
42
|
|
|
37
|
-
def
|
|
38
|
-
|
|
43
|
+
def add_documents(
|
|
44
|
+
index: Index, file_path: Path | str = "../datasets/small_movies.json"
|
|
45
|
+
) -> TaskInfo:
|
|
46
|
+
with open(file_path) as f:
|
|
39
47
|
documents = json.load(f)
|
|
48
|
+
return index.add_documents(documents)
|
|
49
|
+
|
|
40
50
|
|
|
51
|
+
def search(index: Index, query: str) -> SearchResults[JsonDict]:
|
|
52
|
+
return index.search(query)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def main() -> int:
|
|
41
56
|
client = Client("http://127.0.0.1:7700", "masterKey")
|
|
42
57
|
plugins = IndexPlugins(search_plugins=(SearchTrackerPlugin(),))
|
|
43
58
|
index = client.create_index("movies", primary_key="id", plugins=plugins)
|
|
44
|
-
task =
|
|
59
|
+
task = add_documents(index)
|
|
45
60
|
client.wait_for_task(task.task_uid)
|
|
46
|
-
result =
|
|
61
|
+
result = search(index, "Cars")
|
|
47
62
|
print(result) # noqa: T201
|
|
48
63
|
|
|
49
64
|
return 0
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
from uuid import uuid4
|
|
3
|
+
|
|
4
|
+
import pytest
|
|
5
|
+
from pytest_asyncio import is_async_test
|
|
6
|
+
|
|
7
|
+
from meilisearch_python_sdk import AsyncClient, Client
|
|
8
|
+
|
|
9
|
+
MASTER_KEY = "masterKey"
|
|
10
|
+
|
|
11
|
+
ROOT_PATH = Path().absolute()
|
|
12
|
+
SMALL_MOVIES_PATH = ROOT_PATH.parent / "datasets" / "small_movies.json"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def pytest_collection_modifyitems(items):
|
|
16
|
+
pytest_asyncio_tests = (item for item in items if is_async_test(item))
|
|
17
|
+
session_scope_marker = pytest.mark.asyncio(loop_scope="session")
|
|
18
|
+
for async_test in pytest_asyncio_tests:
|
|
19
|
+
async_test.add_marker(session_scope_marker, append=False)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@pytest.fixture(scope="session")
|
|
23
|
+
def base_url():
|
|
24
|
+
return "http://127.0.0.1:7700"
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@pytest.fixture(scope="session")
|
|
28
|
+
async def async_client(base_url):
|
|
29
|
+
async with AsyncClient(base_url, MASTER_KEY) as client:
|
|
30
|
+
yield client
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@pytest.fixture(scope="session")
|
|
34
|
+
def client(base_url):
|
|
35
|
+
yield Client(base_url, MASTER_KEY)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@pytest.fixture(scope="session")
|
|
39
|
+
def small_movies_path():
|
|
40
|
+
return SMALL_MOVIES_PATH
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@pytest.fixture
|
|
44
|
+
async def async_empty_index(async_client):
|
|
45
|
+
async def index_maker():
|
|
46
|
+
return await async_client.create_index(uid=str(uuid4()), timeout_in_ms=5000)
|
|
47
|
+
|
|
48
|
+
return index_maker
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@pytest.fixture
|
|
52
|
+
def empty_index(client):
|
|
53
|
+
def index_maker():
|
|
54
|
+
return client.create_index(uid=str(uuid4()), timeout_in_ms=5000)
|
|
55
|
+
|
|
56
|
+
return index_maker
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
from uuid import uuid4
|
|
3
|
+
|
|
4
|
+
from examples.async_add_documents_decorator import load_documents
|
|
5
|
+
from examples.async_add_documents_in_batches import add_documents_in_batches
|
|
6
|
+
from examples.async_search_tracker import SearchTrackerPlugin, search
|
|
7
|
+
from examples.async_search_tracker import add_documents as search_tracker_add_documents
|
|
8
|
+
from examples.async_update_settings import add_documents as update_settings_add_documents
|
|
9
|
+
from examples.async_update_settings import update_settings
|
|
10
|
+
from meilisearch_python_sdk.plugins import AsyncIndexPlugins
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
async def test_add_documents_decorator(small_movies_path, async_client):
|
|
14
|
+
index = await async_client.create_index("movies", "id")
|
|
15
|
+
await load_documents(small_movies_path)
|
|
16
|
+
result = await async_client.get_tasks()
|
|
17
|
+
await asyncio.gather(*[async_client.wait_for_task(x.uid) for x in result.results])
|
|
18
|
+
documents = await index.get_documents()
|
|
19
|
+
|
|
20
|
+
assert len(documents.results) > 0
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
async def test_add_documents_in_batchees(small_movies_path, async_empty_index, async_client):
|
|
24
|
+
index = await async_empty_index()
|
|
25
|
+
tasks = await add_documents_in_batches(index, small_movies_path)
|
|
26
|
+
for task in tasks:
|
|
27
|
+
await async_client.wait_for_task(task.task_uid)
|
|
28
|
+
result = await async_client.get_task(task.task_uid)
|
|
29
|
+
assert result.status == "succeeded"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
async def test_search_tracker(small_movies_path, async_client, tmp_path):
|
|
33
|
+
db_path = tmp_path / "search_tracker.db"
|
|
34
|
+
plugins = AsyncIndexPlugins(search_plugins=(SearchTrackerPlugin(db_path),))
|
|
35
|
+
index = await async_client.create_index(
|
|
36
|
+
uid=str(uuid4()), primary_key="id", plugins=plugins, timeout_in_ms=5000
|
|
37
|
+
)
|
|
38
|
+
task = await search_tracker_add_documents(index, small_movies_path)
|
|
39
|
+
await async_client.wait_for_task(task.task_uid)
|
|
40
|
+
result = await async_client.get_task(task.task_uid)
|
|
41
|
+
assert result.status == "succeeded"
|
|
42
|
+
result = await search(index, "Cars")
|
|
43
|
+
assert len(result.hits) > 0
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
async def test_update_settings(small_movies_path, async_empty_index, async_client):
|
|
47
|
+
index = await async_empty_index()
|
|
48
|
+
task = await update_settings(index)
|
|
49
|
+
await async_client.wait_for_task(task.task_uid)
|
|
50
|
+
task = await update_settings_add_documents(index, small_movies_path)
|
|
51
|
+
await async_client.wait_for_task(task.task_uid)
|
|
52
|
+
result = await async_client.get_task(task.task_uid)
|
|
53
|
+
assert result.status == "succeeded"
|