meilisearch-python-sdk 2.3.0__py3-none-any.whl → 2.4.0__py3-none-any.whl

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.

@@ -28,6 +28,7 @@ from meilisearch_python_sdk.models.search import SearchParams, SearchResultsWith
28
28
  from meilisearch_python_sdk.models.settings import MeilisearchSettings
29
29
  from meilisearch_python_sdk.models.task import TaskInfo, TaskResult, TaskStatus
30
30
  from meilisearch_python_sdk.models.version import Version
31
+ from meilisearch_python_sdk.plugins import AsyncIndexPlugins, IndexPlugins
31
32
  from meilisearch_python_sdk.types import JsonDict, JsonMapping
32
33
 
33
34
 
@@ -192,6 +193,7 @@ class AsyncClient(BaseClient):
192
193
  primary_key: str | None = None,
193
194
  *,
194
195
  settings: MeilisearchSettings | None = None,
196
+ plugins: AsyncIndexPlugins | None = None,
195
197
  ) -> AsyncIndex:
196
198
  """Creates a new index.
197
199
 
@@ -200,10 +202,11 @@ class AsyncClient(BaseClient):
200
202
  uid: The index's unique identifier.
201
203
  primary_key: The primary key of the documents. Defaults to None.
202
204
  settings: Settings for the index. The settings can also be updated independently of
203
- creating the index. The advantage to updating them here is updating the settings after
204
- adding documents will cause the documents to be re-indexed. Because of this it will be
205
- faster to update them before adding documents. Defaults to None (i.e. default
206
- Meilisearch index settings).
205
+ creating the index. The advantage to updating them here is updating the settings after
206
+ adding documents will cause the documents to be re-indexed. Because of this it will be
207
+ faster to update them before adding documents. Defaults to None (i.e. default
208
+ Meilisearch index settings).
209
+ plugins: Optional plugins can be provided to extend functionality.
207
210
 
208
211
  Returns:
209
212
 
@@ -220,7 +223,9 @@ class AsyncClient(BaseClient):
220
223
  >>> async with AsyncClient("http://localhost.com", "masterKey") as client:
221
224
  >>> index = await client.create_index("movies")
222
225
  """
223
- return await AsyncIndex.create(self.http_client, uid, primary_key, settings=settings)
226
+ return await AsyncIndex.create(
227
+ self.http_client, uid, primary_key, settings=settings, plugins=plugins
228
+ )
224
229
 
225
230
  async def create_snapshot(self) -> TaskInfo:
226
231
  """Trigger the creation of a Meilisearch snapshot.
@@ -339,7 +344,7 @@ class AsyncClient(BaseClient):
339
344
  """
340
345
  return await AsyncIndex(self.http_client, uid).fetch_info()
341
346
 
342
- def index(self, uid: str) -> AsyncIndex:
347
+ def index(self, uid: str, *, plugins: AsyncIndexPlugins | None = None) -> AsyncIndex:
343
348
  """Create a local reference to an index identified by UID, without making an HTTP call.
344
349
 
345
350
  Because no network call is made this method is not awaitable.
@@ -347,6 +352,7 @@ class AsyncClient(BaseClient):
347
352
  Args:
348
353
 
349
354
  uid: The index's unique identifier.
355
+ plugins: Optional plugins can be provided to extend functionality.
350
356
 
351
357
  Returns:
352
358
 
@@ -363,7 +369,7 @@ class AsyncClient(BaseClient):
363
369
  >>> async with AsyncClient("http://localhost.com", "masterKey") as client:
364
370
  >>> index = client.index("movies")
365
371
  """
366
- return AsyncIndex(self.http_client, uid=uid)
372
+ return AsyncIndex(self.http_client, uid=uid, plugins=plugins)
367
373
 
368
374
  async def get_all_stats(self) -> ClientStats:
369
375
  """Get stats for all indexes.
@@ -388,13 +394,16 @@ class AsyncClient(BaseClient):
388
394
 
389
395
  return ClientStats(**response.json())
390
396
 
391
- async def get_or_create_index(self, uid: str, primary_key: str | None = None) -> AsyncIndex:
397
+ async def get_or_create_index(
398
+ self, uid: str, primary_key: str | None = None, *, plugins: AsyncIndexPlugins | None = None
399
+ ) -> AsyncIndex:
392
400
  """Get an index, or create it if it doesn't exist.
393
401
 
394
402
  Args:
395
403
 
396
404
  uid: The index's unique identifier.
397
405
  primary_key: The primary key of the documents. Defaults to None.
406
+ plugins: Optional plugins can be provided to extend functionality.
398
407
 
399
408
  Returns:
400
409
 
@@ -417,7 +426,7 @@ class AsyncClient(BaseClient):
417
426
  except MeilisearchApiError as err:
418
427
  if "index_not_found" not in err.code:
419
428
  raise
420
- index_instance = await self.create_index(uid, primary_key)
429
+ index_instance = await self.create_index(uid, primary_key, plugins=plugins)
421
430
  return index_instance
422
431
 
423
432
  async def create_key(self, key: KeyCreate) -> Key:
@@ -1039,6 +1048,7 @@ class Client(BaseClient):
1039
1048
  primary_key: str | None = None,
1040
1049
  *,
1041
1050
  settings: MeilisearchSettings | None = None,
1051
+ plugins: IndexPlugins | None = None,
1042
1052
  ) -> Index:
1043
1053
  """Creates a new index.
1044
1054
 
@@ -1047,10 +1057,11 @@ class Client(BaseClient):
1047
1057
  uid: The index's unique identifier.
1048
1058
  primary_key: The primary key of the documents. Defaults to None.
1049
1059
  settings: Settings for the index. The settings can also be updated independently of
1050
- creating the index. The advantage to updating them here is updating the settings after
1051
- adding documents will cause the documents to be re-indexed. Because of this it will be
1052
- faster to update them before adding documents. Defaults to None (i.e. default
1053
- Meilisearch index settings).
1060
+ creating the index. The advantage to updating them here is updating the settings after
1061
+ adding documents will cause the documents to be re-indexed. Because of this it will be
1062
+ faster to update them before adding documents. Defaults to None (i.e. default
1063
+ Meilisearch index settings).
1064
+ plugins: Optional plugins can be provided to extend functionality.
1054
1065
 
1055
1066
  Returns:
1056
1067
 
@@ -1067,7 +1078,7 @@ class Client(BaseClient):
1067
1078
  >>> client = Client("http://localhost.com", "masterKey")
1068
1079
  >>> index = client.create_index("movies")
1069
1080
  """
1070
- return Index.create(self.http_client, uid, primary_key, settings=settings)
1081
+ return Index.create(self.http_client, uid, primary_key, settings=settings, plugins=plugins)
1071
1082
 
1072
1083
  def create_snapshot(self) -> TaskInfo:
1073
1084
  """Trigger the creation of a Meilisearch snapshot.
@@ -1186,12 +1197,13 @@ class Client(BaseClient):
1186
1197
  """
1187
1198
  return Index(self.http_client, uid).fetch_info()
1188
1199
 
1189
- def index(self, uid: str) -> Index:
1200
+ def index(self, uid: str, *, plugins: IndexPlugins | None = None) -> Index:
1190
1201
  """Create a local reference to an index identified by UID, without making an HTTP call.
1191
1202
 
1192
1203
  Args:
1193
1204
 
1194
1205
  uid: The index's unique identifier.
1206
+ plugins: Optional plugins can be provided to extend functionality.
1195
1207
 
1196
1208
  Returns:
1197
1209
 
@@ -1208,7 +1220,7 @@ class Client(BaseClient):
1208
1220
  >>> client = Client("http://localhost.com", "masterKey")
1209
1221
  >>> index = client.index("movies")
1210
1222
  """
1211
- return Index(self.http_client, uid=uid)
1223
+ return Index(self.http_client, uid=uid, plugins=plugins)
1212
1224
 
1213
1225
  def get_all_stats(self) -> ClientStats:
1214
1226
  """Get stats for all indexes.
@@ -1233,13 +1245,16 @@ class Client(BaseClient):
1233
1245
 
1234
1246
  return ClientStats(**response.json())
1235
1247
 
1236
- def get_or_create_index(self, uid: str, primary_key: str | None = None) -> Index:
1248
+ def get_or_create_index(
1249
+ self, uid: str, primary_key: str | None = None, *, plugins: IndexPlugins | None = None
1250
+ ) -> Index:
1237
1251
  """Get an index, or create it if it doesn't exist.
1238
1252
 
1239
1253
  Args:
1240
1254
 
1241
1255
  uid: The index's unique identifier.
1242
1256
  primary_key: The primary key of the documents. Defaults to None.
1257
+ plugins: Optional plugins can be provided to extend functionality.
1243
1258
 
1244
1259
  Returns:
1245
1260
 
@@ -1262,7 +1277,7 @@ class Client(BaseClient):
1262
1277
  except MeilisearchApiError as err:
1263
1278
  if "index_not_found" not in err.code:
1264
1279
  raise
1265
- index_instance = self.create_index(uid, primary_key)
1280
+ index_instance = self.create_index(uid, primary_key, plugins=plugins)
1266
1281
  return index_instance
1267
1282
 
1268
1283
  def create_key(self, key: KeyCreate) -> Key:
@@ -1 +1 @@
1
- VERSION = "2.3.0"
1
+ VERSION = "2.4.0"