meilisearch-python-sdk 5.7.0__tar.gz → 6.0.0__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.
Files changed (107) hide show
  1. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/.pre-commit-config.yaml +1 -1
  2. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/CONTRIBUTING.md +8 -8
  3. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/PKG-INFO +1 -4
  4. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/docs/js/umami.js +2 -2
  5. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/docs/json_handler.md +4 -24
  6. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/examples/async_documents_and_search_results.py +10 -2
  7. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/examples/async_search_tracker.py +1 -1
  8. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/examples/documents_and_search_results.py +10 -2
  9. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/examples/search_tracker.py +1 -1
  10. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/examples/tests/test_examples.py +0 -8
  11. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/meilisearch_python_sdk/_client.py +18 -18
  12. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/meilisearch_python_sdk/_http_requests.py +13 -15
  13. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/meilisearch_python_sdk/_utils.py +2 -2
  14. meilisearch_python_sdk-6.0.0/meilisearch_python_sdk/_version.py +1 -0
  15. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/meilisearch_python_sdk/decorators.py +6 -5
  16. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/meilisearch_python_sdk/index/_common.py +6 -15
  17. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/meilisearch_python_sdk/index/async_index.py +15 -15
  18. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/meilisearch_python_sdk/index/index.py +15 -15
  19. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/meilisearch_python_sdk/json_handler.py +10 -33
  20. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/meilisearch_python_sdk/plugins.py +15 -7
  21. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/pyproject.toml +12 -6
  22. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/tests/conftest.py +1 -14
  23. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/tests/test_async_client.py +0 -11
  24. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/tests/test_async_documents.py +0 -19
  25. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/tests/test_client.py +0 -11
  26. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/tests/test_documents.py +0 -19
  27. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/uv.lock +276 -425
  28. meilisearch_python_sdk-5.7.0/examples/ujson_example.py +0 -23
  29. meilisearch_python_sdk-5.7.0/meilisearch_python_sdk/_version.py +0 -1
  30. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/.github/FUNDING.yml +0 -0
  31. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/.github/release-draft-template.yaml +0 -0
  32. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/.github/renovate.json5 +0 -0
  33. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/.github/workflows/docs_publish.yml +0 -0
  34. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/.github/workflows/nightly_testing.yml +0 -0
  35. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/.github/workflows/pypi_publish.yml +0 -0
  36. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/.github/workflows/release-drafter.yml +0 -0
  37. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/.github/workflows/testing.yml +0 -0
  38. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/.gitignore +0 -0
  39. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/LICENSE +0 -0
  40. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/README.md +0 -0
  41. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/assets/add_in_batches.png +0 -0
  42. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/assets/searches.png +0 -0
  43. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/codecov.yml +0 -0
  44. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/datasets/small_movies.json +0 -0
  45. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/docker-compose.https.yml +0 -0
  46. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/docker-compose.yml +0 -0
  47. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/docs/.nojekyll +0 -0
  48. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/docs/CNAME +0 -0
  49. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/docs/async_client_api.md +0 -0
  50. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/docs/async_index_api.md +0 -0
  51. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/docs/client_api.md +0 -0
  52. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/docs/css/custom.css +0 -0
  53. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/docs/decorators_api.md +0 -0
  54. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/docs/index.md +0 -0
  55. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/docs/index_api.md +0 -0
  56. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/docs/overrides/partials/footer.html +0 -0
  57. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/docs/plugins.md +0 -0
  58. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/docs/pydantic.md +0 -0
  59. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/examples/.gitignore +0 -0
  60. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/examples/README.md +0 -0
  61. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/examples/__init__.py +0 -0
  62. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/examples/add_documents_decorator.py +0 -0
  63. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/examples/add_documents_in_batches.py +0 -0
  64. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/examples/async_add_documents_decorator.py +0 -0
  65. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/examples/async_add_documents_in_batches.py +0 -0
  66. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/examples/async_update_settings.py +0 -0
  67. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/examples/fastapi_example.py +0 -0
  68. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/examples/orjson_example.py +0 -0
  69. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/examples/pyproject.toml +0 -0
  70. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/examples/requirements.txt +0 -0
  71. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/examples/tests/__init__.py +0 -0
  72. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/examples/tests/conftest.py +0 -0
  73. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/examples/tests/test_async_examples.py +0 -0
  74. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/examples/update_settings.py +0 -0
  75. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/justfile +0 -0
  76. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/meilisearch_python_sdk/__init__.py +0 -0
  77. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/meilisearch_python_sdk/_batch.py +0 -0
  78. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/meilisearch_python_sdk/_task.py +0 -0
  79. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/meilisearch_python_sdk/errors.py +0 -0
  80. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/meilisearch_python_sdk/index/__init__.py +0 -0
  81. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/meilisearch_python_sdk/models/__init__.py +0 -0
  82. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/meilisearch_python_sdk/models/batch.py +0 -0
  83. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/meilisearch_python_sdk/models/client.py +0 -0
  84. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/meilisearch_python_sdk/models/documents.py +0 -0
  85. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/meilisearch_python_sdk/models/health.py +0 -0
  86. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/meilisearch_python_sdk/models/index.py +0 -0
  87. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/meilisearch_python_sdk/models/search.py +0 -0
  88. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/meilisearch_python_sdk/models/settings.py +0 -0
  89. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/meilisearch_python_sdk/models/task.py +0 -0
  90. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/meilisearch_python_sdk/models/version.py +0 -0
  91. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/meilisearch_python_sdk/models/webhook.py +0 -0
  92. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/meilisearch_python_sdk/py.typed +0 -0
  93. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/meilisearch_python_sdk/types.py +0 -0
  94. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/mkdocs.yaml +0 -0
  95. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/tests/__init__.py +0 -0
  96. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/tests/test_async_index.py +0 -0
  97. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/tests/test_async_index_plugins.py +0 -0
  98. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/tests/test_async_search.py +0 -0
  99. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/tests/test_decorators.py +0 -0
  100. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/tests/test_errors.py +0 -0
  101. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/tests/test_http_requests.py +0 -0
  102. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/tests/test_index.py +0 -0
  103. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/tests/test_index_plugins.py +0 -0
  104. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/tests/test_search.py +0 -0
  105. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/tests/test_settings_models.py +0 -0
  106. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/tests/test_utils.py +0 -0
  107. {meilisearch_python_sdk-5.7.0 → meilisearch_python_sdk-6.0.0}/tests/test_version.py +0 -0
@@ -14,7 +14,7 @@ repos:
14
14
  - id: mypy
15
15
  additional_dependencies: [pydantic, orjson, types-aiofiles, types-ujson]
16
16
  - repo: https://github.com/astral-sh/ruff-pre-commit
17
- rev: v0.14.10
17
+ rev: v0.14.11
18
18
  hooks:
19
19
  - id: ruff-check
20
20
  args: [--fix, --exit-non-zero-on-fix]
@@ -76,7 +76,7 @@ git checkout main
76
76
  git pull upstream main --ff-only
77
77
  ```
78
78
 
79
- ### Code Standards and tests (ruff, mypy, pytest, and pre-commit)
79
+ ### Code Standards and tests (ruff, mypy, pytest, and prek)
80
80
 
81
81
  meilisearch-python-sdk uses [ruff](https://github.com/charliermarsh/ruff), and
82
82
  [mypy](https://mypy.readthedocs.io/en/stable/) to ensure consistent code formatting.
@@ -94,18 +94,18 @@ uv run ruff check .
94
94
  uv run mypy meilisearch_python_sdk
95
95
  ```
96
96
 
97
- It is also suggested that you setup [pre-commit](https://pre-commit.com/) in order to run linting
98
- when you commit changes to you branch. To setup pre-commit for this project run:
97
+ It is also suggested that you setup [prek](https://github.com/j178/prek) in order to run linting
98
+ when you commit changes to you branch. To setup prek for this project run:
99
99
 
100
100
  ```sh
101
- pre-commit install
101
+ prek install
102
102
  ```
103
103
 
104
- After this pre-commit will automatically run any time you check in code to your branches. You can
105
- also run pre-commit at any time with:
104
+ After this prek will automatically run any time you check in code to your branches. You can
105
+ also run prek at any time with:
106
106
 
107
107
  ```sh
108
- pre-commit run --all-files
108
+ prek run --all-files
109
109
  ```
110
110
 
111
111
  ### Type Hints
@@ -224,7 +224,7 @@ Now you can commit your changes in your local repository:
224
224
  git commit -am 'Some short helpful message to describe your changes'
225
225
  ```
226
226
 
227
- If you setup pre-commit and any of the tests fail the commit will be cancelled and you will need to
227
+ If you setup prek and any of the tests fail the commit will be cancelled and you will need to
228
228
  fix any errors. Once the errors are fixed you can run the same git commit command again.
229
229
 
230
230
  ## Push your changes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: meilisearch-python-sdk
3
- Version: 5.7.0
3
+ Version: 6.0.0
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
@@ -47,11 +47,8 @@ Requires-Dist: pydantic>=2.0.0
47
47
  Requires-Dist: pyjwt>=2.3.0
48
48
  Provides-Extra: all
49
49
  Requires-Dist: orjson; extra == 'all'
50
- Requires-Dist: ujson; extra == 'all'
51
50
  Provides-Extra: orjson
52
51
  Requires-Dist: orjson>=3.10.6; extra == 'orjson'
53
- Provides-Extra: ujson
54
- Requires-Dist: ujson>=5.10.0; extra == 'ujson'
55
52
  Description-Content-Type: text/markdown
56
53
 
57
54
  # Meilisearch Python SDK
@@ -1,7 +1,7 @@
1
1
  document.addEventListener("DOMContentLoaded", function () {
2
2
  var umamiScript = document.createElement("script");
3
3
  umamiScript.defer = true;
4
- umamiScript.src = "https://cloud.umami.is/script.js";
5
- umamiScript.dataset.websiteId = "29a9d193-92a3-44d0-9b1d-16ddd23898fb";
4
+ umamiScript.src = "https://analytics.pbsdatasolutions.com/script.js";
5
+ umamiScript.dataset.websiteId = "c1557f38-bc02-4277-82b4-22a7029f42ba";
6
6
  document.head.appendChild(umamiScript);
7
7
  });
@@ -1,9 +1,9 @@
1
1
  # JSON Handler
2
2
 
3
- For json loads and dumps you have the option to use the `json` module from the standard library,
4
- orjson, or ujson. This done by setting the `json_handler` when creating the `AsyncClient` or
5
- `Client`. By default the standard library `json` module will be used. The examples below use
6
- `Client`, and the same options are available for `AsyncClient`.
3
+ For json loads and dumps you have the option to use the `json` module from the standard library, or
4
+ orjson. This done by setting the `json_handler` when creating the `AsyncClient` or `Client`. By
5
+ default the standard library `json` module will be used. The examples below use `Client`, and the
6
+ same options are available for `AsyncClient`.
7
7
 
8
8
  ## Standard Library `json` Module
9
9
 
@@ -61,23 +61,3 @@ with Client("http://127.0.0.1:7700", json_handler=OrjsonHandler()) as client:
61
61
  index = client.index("movies", primary_key="id")
62
62
  index.add_documents(documents)
63
63
  ```
64
-
65
- ## ujson
66
-
67
- ### Example
68
-
69
- ```py
70
- from uuid import uuid4
71
-
72
- from meilisearch_python_sdk import Client
73
- from meilisearch_python_sdk.json_handler import UjsonHandler
74
-
75
-
76
- documents = [
77
- {"id": uuid4(), "title": "test 1"},
78
- {"id": uuid4(), "title": "Test 2"},
79
- ]
80
- with Client("http://127.0.0.1:7700", json_handler=UjsonHandler()) as client:
81
- index = client.index("movies", primary_key="id")
82
- index.add_documents(documents)
83
- ```
@@ -19,7 +19,11 @@ class ModifyDocumentPlugin:
19
19
  PRE_EVENT = True # Specifies the plugin should be run before adding documents
20
20
 
21
21
  async def run_document_plugin(
22
- self, event: AsyncEvent, *, documents: Sequence[JsonMapping], **kwargs: Any
22
+ self,
23
+ event: AsyncEvent,
24
+ *,
25
+ documents: Sequence[JsonMapping],
26
+ **kwargs: Any, # noqa: ANN401
23
27
  ) -> Sequence[JsonMapping]:
24
28
  updated = []
25
29
  for i, document in enumerate(documents):
@@ -39,7 +43,11 @@ class FilterSearchResultsPlugin:
39
43
  PRE_EVENT = False
40
44
 
41
45
  async def run_post_search_plugin(
42
- self, event: AsyncEvent, *, search_results: SearchResults, **kwargs: Any
46
+ self,
47
+ event: AsyncEvent,
48
+ *,
49
+ search_results: SearchResults,
50
+ **kwargs: Any, # noqa: ANN401
43
51
  ) -> SearchResults:
44
52
  filtered_hits = []
45
53
  for hit in search_results.hits:
@@ -31,7 +31,7 @@ class SearchTrackerPlugin:
31
31
  finally:
32
32
  cursor.close()
33
33
 
34
- async def run_plugin(self, event: AsyncEvent, **kwargs: Any) -> None:
34
+ async def run_plugin(self, event: AsyncEvent, **kwargs: Any) -> None: # noqa: ANN401
35
35
  """Note that this example uses sqlite which does not provide an async driver.
36
36
 
37
37
  Typically if you are using the AsyncClient you would also be using an async driver for the
@@ -15,7 +15,11 @@ class ModifyDocumentPlugin:
15
15
  PRE_EVENT = True # Specifies the plugin should be run before adding documents
16
16
 
17
17
  def run_document_plugin(
18
- self, event: Event, *, documents: Sequence[JsonMapping], **kwargs: Any
18
+ self,
19
+ event: Event,
20
+ *,
21
+ documents: Sequence[JsonMapping],
22
+ **kwargs: Any, # noqa: ANN401
19
23
  ) -> Sequence[JsonMapping]:
20
24
  updated = []
21
25
  for i, document in enumerate(documents):
@@ -34,7 +38,11 @@ class FilterSearchResultsPlugin:
34
38
  PRE_EVENT = False
35
39
 
36
40
  def run_post_search_plugin(
37
- self, event: Event, *, search_results: SearchResults, **kwargs: Any
41
+ self,
42
+ event: Event,
43
+ *,
44
+ search_results: SearchResults,
45
+ **kwargs: Any, # noqa: ANN401
38
46
  ) -> SearchResults:
39
47
  filtered_hits = []
40
48
  for hit in search_results.hits:
@@ -27,7 +27,7 @@ class SearchTrackerPlugin:
27
27
  finally:
28
28
  cursor.close()
29
29
 
30
- def run_plugin(self, event: Event, **kwargs: Any) -> None:
30
+ def run_plugin(self, event: Event, **kwargs: Any) -> None: # noqa: ANN401
31
31
  if kwargs.get("query"):
32
32
  self.save_search_query(kwargs["query"])
33
33
 
@@ -3,7 +3,6 @@ from uuid import uuid4
3
3
  from examples.orjson_example import add_documents as orjson_add_documents
4
4
  from examples.search_tracker import SearchTrackerPlugin, search
5
5
  from examples.search_tracker import add_documents as search_tracker_add_documents
6
- from examples.ujson_example import add_documents as ujson_add_documents
7
6
  from examples.update_settings import add_documents as update_settings_add_documents
8
7
  from examples.update_settings import update_settings
9
8
  from meilisearch_python_sdk.plugins import IndexPlugins
@@ -38,10 +37,3 @@ def test_update_settings(small_movies_path, empty_index, client):
38
37
  client.wait_for_task(task.task_uid)
39
38
  result = client.get_task(task.task_uid)
40
39
  assert result.status == "succeeded"
41
-
42
-
43
- def test_ujson_example(small_movies_path, client):
44
- task = ujson_add_documents(small_movies_path)
45
- client.wait_for_task(task.task_uid)
46
- result = client.get_task(task.task_uid)
47
- assert result.status == "succeeded"
@@ -16,7 +16,7 @@ from meilisearch_python_sdk._batch import get_batches as _get_batches
16
16
  from meilisearch_python_sdk._http_requests import AsyncHttpRequests, HttpRequests
17
17
  from meilisearch_python_sdk.errors import InvalidRestriction, MeilisearchApiError
18
18
  from meilisearch_python_sdk.index import AsyncIndex, Index
19
- from meilisearch_python_sdk.json_handler import BuiltinHandler, OrjsonHandler, UjsonHandler
19
+ from meilisearch_python_sdk.json_handler import BuiltinHandler, OrjsonHandler
20
20
  from meilisearch_python_sdk.models.client import (
21
21
  ClientStats,
22
22
  Key,
@@ -41,7 +41,7 @@ from meilisearch_python_sdk.models.webhook import Webhook, WebhookCreate, Webhoo
41
41
  from meilisearch_python_sdk.plugins import AsyncIndexPlugins, IndexPlugins
42
42
  from meilisearch_python_sdk.types import JsonDict
43
43
 
44
- if TYPE_CHECKING: # pragma: no cover
44
+ if TYPE_CHECKING:
45
45
  import sys
46
46
  from types import TracebackType
47
47
 
@@ -59,7 +59,7 @@ class BaseClient:
59
59
  self,
60
60
  api_key: str | None = None,
61
61
  custom_headers: dict[str, str] | None = None,
62
- json_handler: BuiltinHandler | OrjsonHandler | UjsonHandler | None = None,
62
+ json_handler: BuiltinHandler | OrjsonHandler | None = None,
63
63
  ) -> None:
64
64
  self.json_handler = json_handler if json_handler else BuiltinHandler()
65
65
  self._headers: dict[str, str] | None = None
@@ -153,7 +153,7 @@ class AsyncClient(BaseClient):
153
153
  timeout: int | None = None,
154
154
  verify: bool | SSLContext = True,
155
155
  custom_headers: dict[str, str] | None = None,
156
- json_handler: BuiltinHandler | OrjsonHandler | UjsonHandler | None = None,
156
+ json_handler: BuiltinHandler | OrjsonHandler | None = None,
157
157
  http2: bool = False,
158
158
  ) -> None:
159
159
  """Class initializer.
@@ -169,9 +169,9 @@ class AsyncClient(BaseClient):
169
169
  custom_headers: Custom headers to add when sending data to Meilisearch. Defaults to
170
170
  None.
171
171
  json_handler: The module to use for json operations. The options are BuiltinHandler
172
- (uses the json module from the standard library), OrjsonHandler (uses orjson), or
173
- UjsonHandler (uses ujson). Note that in order use orjson or ujson the corresponding
174
- extra needs to be included. Default: BuiltinHandler.
172
+ (uses the json module from the standard library), or OrjsonHandler (uses orjson).
173
+ Note that in order use orjson the corresponding extra needs to be included.
174
+ Default: BuiltinHandler.
175
175
  http2: Whether or not to use HTTP/2. Defaults to False.
176
176
  """
177
177
  super().__init__(api_key, custom_headers, json_handler)
@@ -399,7 +399,7 @@ class AsyncClient(BaseClient):
399
399
  wait: bool = True,
400
400
  timeout_in_ms: int | None = None,
401
401
  plugins: AsyncIndexPlugins | None = None,
402
- hits_type: Any = JsonDict,
402
+ hits_type: Any = JsonDict, # noqa: ANN401
403
403
  ) -> AsyncIndex:
404
404
  """Creates a new index.
405
405
 
@@ -602,7 +602,7 @@ class AsyncClient(BaseClient):
602
602
  primary_key: str | None = None,
603
603
  *,
604
604
  plugins: AsyncIndexPlugins | None = None,
605
- hits_type: Any = JsonDict,
605
+ hits_type: Any = JsonDict, # noqa: ANN401
606
606
  ) -> AsyncIndex:
607
607
  """Get an index, or create it if it doesn't exist.
608
608
 
@@ -770,7 +770,7 @@ class AsyncClient(BaseClient):
770
770
  queries: list[SearchParams],
771
771
  *,
772
772
  federation: Federation | FederationMerged | None = None,
773
- hits_type: Any = JsonDict,
773
+ hits_type: Any = JsonDict, # noqa: ANN401
774
774
  ) -> list[SearchResultsWithUID] | SearchResultsFederated:
775
775
  """Multi-index search.
776
776
 
@@ -1316,7 +1316,7 @@ class Client(BaseClient):
1316
1316
  timeout: int | None = None,
1317
1317
  verify: bool | SSLContext = True,
1318
1318
  custom_headers: dict[str, str] | None = None,
1319
- json_handler: BuiltinHandler | OrjsonHandler | UjsonHandler | None = None,
1319
+ json_handler: BuiltinHandler | OrjsonHandler | None = None,
1320
1320
  http2: bool = False,
1321
1321
  ) -> None:
1322
1322
  """Class initializer.
@@ -1332,9 +1332,9 @@ class Client(BaseClient):
1332
1332
  custom_headers: Custom headers to add when sending data to Meilisearch. Defaults to
1333
1333
  None.
1334
1334
  json_handler: The module to use for json operations. The options are BuiltinHandler
1335
- (uses the json module from the standard library), OrjsonHandler (uses orjson), or
1336
- UjsonHandler (uses ujson). Note that in order use orjson or ujson the corresponding
1337
- extra needs to be included. Default: BuiltinHandler.
1335
+ (uses the json module from the standard library), or OrjsonHandler (uses orjson).
1336
+ Note that in order use orjson the corresponding extra needs to be included.
1337
+ Default: BuiltinHandler.
1338
1338
  http2: If set to True, the client will use HTTP/2. Defaults to False.
1339
1339
  """
1340
1340
  super().__init__(api_key, custom_headers, json_handler)
@@ -1564,7 +1564,7 @@ class Client(BaseClient):
1564
1564
  wait: bool = True,
1565
1565
  timeout_in_ms: int | None = None,
1566
1566
  plugins: IndexPlugins | None = None,
1567
- hits_type: Any = JsonDict,
1567
+ hits_type: Any = JsonDict, # noqa: ANN401
1568
1568
  ) -> Index:
1569
1569
  """Creates a new index.
1570
1570
 
@@ -1762,7 +1762,7 @@ class Client(BaseClient):
1762
1762
  primary_key: str | None = None,
1763
1763
  *,
1764
1764
  plugins: IndexPlugins | None = None,
1765
- hits_type: Any = JsonDict,
1765
+ hits_type: Any = JsonDict, # noqa: ANN401
1766
1766
  ) -> Index:
1767
1767
  """Get an index, or create it if it doesn't exist.
1768
1768
 
@@ -1929,7 +1929,7 @@ class Client(BaseClient):
1929
1929
  queries: list[SearchParams],
1930
1930
  *,
1931
1931
  federation: Federation | FederationMerged | None = None,
1932
- hits_type: Any = JsonDict,
1932
+ hits_type: Any = JsonDict, # noqa: ANN401
1933
1933
  ) -> list[SearchResultsWithUID] | SearchResultsFederated:
1934
1934
  """Multi-index search.
1935
1935
 
@@ -2467,7 +2467,7 @@ def _build_offset_limit_url(base: str, offset: int | None, limit: int | None) ->
2467
2467
 
2468
2468
 
2469
2469
  def _build_update_key_payload(
2470
- key: KeyUpdate, json_handler: BuiltinHandler | OrjsonHandler | UjsonHandler
2470
+ key: KeyUpdate, json_handler: BuiltinHandler | OrjsonHandler
2471
2471
  ) -> JsonDict:
2472
2472
  # The json_handler.loads(key.json()) is because Pydantic can't serialize a date in a Python dict,
2473
2473
  # but can when converting to a json string.
@@ -21,17 +21,17 @@ from meilisearch_python_sdk.errors import (
21
21
  MeilisearchCommunicationError,
22
22
  MeilisearchError,
23
23
  )
24
- from meilisearch_python_sdk.json_handler import BuiltinHandler, OrjsonHandler, UjsonHandler
24
+ from meilisearch_python_sdk.json_handler import BuiltinHandler, OrjsonHandler
25
25
 
26
26
 
27
27
  class AsyncHttpRequests:
28
28
  def __init__(
29
- self, http_client: AsyncClient, json_handler: BuiltinHandler | OrjsonHandler | UjsonHandler
29
+ self, http_client: AsyncClient, json_handler: BuiltinHandler | OrjsonHandler
30
30
  ) -> None:
31
31
  self.http_client = http_client
32
32
  self.json_handler = json_handler
33
33
 
34
- def parse_json(self, response: Response) -> Any:
34
+ def parse_json(self, response: Response) -> Any: # noqa: ANN401
35
35
  """Parse JSON response using the custom json_handler."""
36
36
  return self.json_handler.loads(response.content)
37
37
 
@@ -39,7 +39,7 @@ class AsyncHttpRequests:
39
39
  self,
40
40
  http_method: Callable,
41
41
  path: str,
42
- body: Any | None = None,
42
+ body: Any | None = None, # noqa: ANN401
43
43
  content_type: str = "application/json",
44
44
  compress: bool = False,
45
45
  ) -> Response:
@@ -89,7 +89,7 @@ class AsyncHttpRequests:
89
89
  async def patch(
90
90
  self,
91
91
  path: str,
92
- body: Any | None = None,
92
+ body: Any | None = None, # noqa: ANN401
93
93
  content_type: str = "application/json",
94
94
  compress: bool = False,
95
95
  ) -> Response:
@@ -98,7 +98,7 @@ class AsyncHttpRequests:
98
98
  async def post(
99
99
  self,
100
100
  path: str,
101
- body: Any | None = None,
101
+ body: Any | None = None, # noqa: ANN401
102
102
  content_type: str = "application/json",
103
103
  compress: bool = False,
104
104
  ) -> Response:
@@ -107,7 +107,7 @@ class AsyncHttpRequests:
107
107
  async def put(
108
108
  self,
109
109
  path: str,
110
- body: Any | None = None,
110
+ body: Any | None = None, # noqa: ANN401
111
111
  content_type: str = "application/json",
112
112
  compress: bool = False,
113
113
  ) -> Response:
@@ -118,13 +118,11 @@ class AsyncHttpRequests:
118
118
 
119
119
 
120
120
  class HttpRequests:
121
- def __init__(
122
- self, http_client: Client, json_handler: BuiltinHandler | OrjsonHandler | UjsonHandler
123
- ) -> None:
121
+ def __init__(self, http_client: Client, json_handler: BuiltinHandler | OrjsonHandler) -> None:
124
122
  self.http_client = http_client
125
123
  self.json_handler = json_handler
126
124
 
127
- def parse_json(self, response: Response) -> Any:
125
+ def parse_json(self, response: Response) -> Any: # noqa: ANN401
128
126
  """Parse JSON response using the custom json_handler."""
129
127
  return self.json_handler.loads(response.content)
130
128
 
@@ -132,7 +130,7 @@ class HttpRequests:
132
130
  self,
133
131
  http_method: Callable,
134
132
  path: str,
135
- body: Any | None = None,
133
+ body: Any | None = None, # noqa: ANN401
136
134
  content_type: str = "application/json",
137
135
  compress: bool = False,
138
136
  ) -> Response:
@@ -179,7 +177,7 @@ class HttpRequests:
179
177
  def patch(
180
178
  self,
181
179
  path: str,
182
- body: Any | None = None,
180
+ body: Any | None = None, # noqa: ANN401
183
181
  content_type: str = "application/json",
184
182
  compress: bool = False,
185
183
  ) -> Response:
@@ -188,7 +186,7 @@ class HttpRequests:
188
186
  def post(
189
187
  self,
190
188
  path: str,
191
- body: Any | None = None,
189
+ body: Any | None = None, # noqa: ANN401
192
190
  content_type: str = "application/json",
193
191
  compress: bool = False,
194
192
  ) -> Response:
@@ -197,7 +195,7 @@ class HttpRequests:
197
195
  def put(
198
196
  self,
199
197
  path: str,
200
- body: Any | None = None,
198
+ body: Any | None = None, # noqa: ANN401
201
199
  content_type: str = "application/json",
202
200
  compress: bool = False,
203
201
  ) -> Response:
@@ -8,7 +8,7 @@ from typing import TYPE_CHECKING
8
8
  from httpx import AsyncClient as HttpxAsyncClient
9
9
  from httpx import Client as HttpxClient
10
10
 
11
- from meilisearch_python_sdk.json_handler import BuiltinHandler, OrjsonHandler, UjsonHandler
11
+ from meilisearch_python_sdk.json_handler import BuiltinHandler, OrjsonHandler
12
12
 
13
13
  if TYPE_CHECKING:
14
14
  from meilisearch_python_sdk._client import AsyncClient, Client # pragma: no cover
@@ -34,7 +34,7 @@ def get_client(
34
34
 
35
35
  def get_json_handler(
36
36
  client: AsyncClient | Client | HttpxAsyncClient | HttpxClient,
37
- ) -> BuiltinHandler | OrjsonHandler | UjsonHandler:
37
+ ) -> BuiltinHandler | OrjsonHandler:
38
38
  if isinstance(client, (HttpxAsyncClient, HttpxClient)):
39
39
  return BuiltinHandler()
40
40
 
@@ -0,0 +1 @@
1
+ VERSION = "6.0.0"
@@ -1,12 +1,13 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import asyncio
4
- from collections.abc import Callable
4
+ from collections.abc import Callable, Sequence
5
5
  from functools import wraps
6
6
  from typing import Any, NamedTuple
7
7
 
8
8
  from meilisearch_python_sdk import AsyncClient, Client
9
9
  from meilisearch_python_sdk._utils import use_task_groups
10
+ from meilisearch_python_sdk.types import JsonMapping
10
11
 
11
12
 
12
13
  class ConnectionInfo(NamedTuple):
@@ -75,7 +76,7 @@ def async_add_documents(
75
76
 
76
77
  def decorator(func: Callable) -> Callable:
77
78
  @wraps(func)
78
- async def wrapper(*args: Any, **kwargs: Any) -> Any:
79
+ async def wrapper(*args: Any, **kwargs: Any) -> Any: # noqa: ANN401
79
80
  result = await func(*args, **kwargs)
80
81
  if isinstance(connection_info, AsyncClient):
81
82
  await _async_add_documents(
@@ -157,7 +158,7 @@ def add_documents(
157
158
 
158
159
  def decorator(func: Callable) -> Callable:
159
160
  @wraps(func)
160
- def wrapper(*args: Any, **kwargs: Any) -> Any:
161
+ def wrapper(*args: Any, **kwargs: Any) -> Any: # noqa: ANN401
161
162
  result = func(*args, **kwargs)
162
163
  if isinstance(connection_info, Client):
163
164
  _add_documents(
@@ -192,7 +193,7 @@ def add_documents(
192
193
  async def _async_add_documents(
193
194
  async_client: AsyncClient,
194
195
  index_name: str,
195
- documents: Any,
196
+ documents: Sequence[JsonMapping],
196
197
  batch_size: int | None,
197
198
  primary_key: str | None,
198
199
  wait_for_task: bool,
@@ -221,7 +222,7 @@ async def _async_add_documents(
221
222
  def _add_documents(
222
223
  client: Client,
223
224
  index_name: str,
224
- documents: Any,
225
+ documents: Sequence[JsonMapping],
225
226
  batch_size: int | None,
226
227
  primary_key: str | None,
227
228
  wait_for_task: bool,
@@ -9,10 +9,8 @@ from urllib.parse import urlencode
9
9
 
10
10
  from meilisearch_python_sdk._utils import iso_to_date_time
11
11
  from meilisearch_python_sdk.errors import MeilisearchError
12
- from meilisearch_python_sdk.json_handler import BuiltinHandler, OrjsonHandler, UjsonHandler
13
- from meilisearch_python_sdk.models.search import (
14
- Hybrid,
15
- )
12
+ from meilisearch_python_sdk.json_handler import BuiltinHandler, OrjsonHandler
13
+ from meilisearch_python_sdk.models.search import Hybrid
16
14
  from meilisearch_python_sdk.models.settings import (
17
15
  CompositeEmbedder,
18
16
  Embedders,
@@ -32,16 +30,9 @@ from meilisearch_python_sdk.plugins import (
32
30
  )
33
31
  from meilisearch_python_sdk.types import JsonDict
34
32
 
35
- if TYPE_CHECKING: # pragma: no cover
36
- import sys
37
-
33
+ if TYPE_CHECKING:
38
34
  from meilisearch_python_sdk.types import Filter, JsonMapping
39
35
 
40
- if sys.version_info >= (3, 11):
41
- pass
42
- else:
43
- pass
44
-
45
36
 
46
37
  class BaseIndex:
47
38
  def __init__(
@@ -50,9 +41,9 @@ class BaseIndex:
50
41
  primary_key: str | None = None,
51
42
  created_at: str | datetime | None = None,
52
43
  updated_at: str | datetime | None = None,
53
- json_handler: BuiltinHandler | OrjsonHandler | UjsonHandler | None = None,
54
- hits_type: Any = JsonDict,
55
- ):
44
+ json_handler: BuiltinHandler | OrjsonHandler | None = None,
45
+ hits_type: Any = JsonDict, # noqa: ANN401
46
+ ) -> None:
56
47
  self.uid = uid
57
48
  self.primary_key = primary_key
58
49
  self.created_at: datetime | None = iso_to_date_time(created_at)
@@ -29,7 +29,7 @@ from meilisearch_python_sdk.index._common import (
29
29
  validate_ranking_score_threshold,
30
30
  )
31
31
  from meilisearch_python_sdk.index._common import combine_documents as combine_documents_
32
- from meilisearch_python_sdk.json_handler import BuiltinHandler, OrjsonHandler, UjsonHandler
32
+ from meilisearch_python_sdk.json_handler import BuiltinHandler, OrjsonHandler
33
33
  from meilisearch_python_sdk.models.documents import DocumentsInfo
34
34
  from meilisearch_python_sdk.models.index import IndexStats
35
35
  from meilisearch_python_sdk.models.search import (
@@ -59,7 +59,7 @@ from meilisearch_python_sdk.plugins import (
59
59
  )
60
60
  from meilisearch_python_sdk.types import JsonDict
61
61
 
62
- if TYPE_CHECKING: # pragma: no cover
62
+ if TYPE_CHECKING:
63
63
  import sys
64
64
 
65
65
  from meilisearch_python_sdk.types import Filter, JsonMapping
@@ -84,10 +84,10 @@ class AsyncIndex(BaseIndex):
84
84
  created_at: str | datetime | None = None,
85
85
  updated_at: str | datetime | None = None,
86
86
  plugins: AsyncIndexPlugins | None = None,
87
- json_handler: BuiltinHandler | OrjsonHandler | UjsonHandler | None = None,
87
+ json_handler: BuiltinHandler | OrjsonHandler | None = None,
88
88
  *,
89
- hits_type: Any = JsonDict,
90
- ):
89
+ hits_type: type[Any] = JsonDict,
90
+ ) -> None:
91
91
  """Class initializer.
92
92
 
93
93
  Args:
@@ -99,9 +99,9 @@ class AsyncIndex(BaseIndex):
99
99
  updated_at: The date and time the index was last updated. Defaults to None.
100
100
  plugins: Optional plugins can be provided to extend functionality.
101
101
  json_handler: The module to use for json operations. The options are BuiltinHandler
102
- (uses the json module from the standard library), OrjsonHandler (uses orjson), or
103
- UjsonHandler (uses ujson). Note that in order use orjson or ujson the corresponding
104
- extra needs to be included. Default: BuiltinHandler.
102
+ (uses the json module from the standard library), or OrjsonHandler (uses orjson).
103
+ Note that in order use orjson the corresponding extra needs to be included.
104
+ Default: BuiltinHandler.
105
105
  hits_type: Allows for a custom type to be passed to use for hits. Defaults to
106
106
  JsonDict
107
107
  """
@@ -581,8 +581,8 @@ class AsyncIndex(BaseIndex):
581
581
  wait: bool = True,
582
582
  timeout_in_ms: int | None = None,
583
583
  plugins: AsyncIndexPlugins | None = None,
584
- json_handler: BuiltinHandler | OrjsonHandler | UjsonHandler | None = None,
585
- hits_type: Any = JsonDict,
584
+ json_handler: BuiltinHandler | OrjsonHandler | None = None,
585
+ hits_type: type[Any] = JsonDict,
586
586
  ) -> Self:
587
587
  """Creates a new index.
588
588
 
@@ -607,9 +607,9 @@ class AsyncIndex(BaseIndex):
607
607
  if the `None` option is used the wait time could be very long. Defaults to None.
608
608
  plugins: Optional plugins can be provided to extend functionality.
609
609
  json_handler: The module to use for json operations. The options are BuiltinHandler
610
- (uses the json module from the standard library), OrjsonHandler (uses orjson), or
611
- UjsonHandler (uses ujson). Note that in order use orjson or ujson the corresponding
612
- extra needs to be included. Default: BuiltinHandler.
610
+ (uses the json module from the standard library), or OrjsonHandler (uses orjson).
611
+ Note that in order use orjson the corresponding extra needs to be included.
612
+ Default: BuiltinHandler.
613
613
  hits_type: Allows for a custom type to be passed to use for hits. Defaults to
614
614
  JsonDict
615
615
 
@@ -4819,7 +4819,7 @@ class AsyncIndex(BaseIndex):
4819
4819
  async def _run_plugins(
4820
4820
  plugins: Sequence[AsyncPlugin | AsyncDocumentPlugin | AsyncPostSearchPlugin],
4821
4821
  event: AsyncEvent,
4822
- **kwargs: Any,
4822
+ **kwargs: Any, # noqa: ANN401
4823
4823
  ) -> dict[str, Any]:
4824
4824
  generic_plugins = []
4825
4825
  document_plugins = []
@@ -4888,7 +4888,7 @@ async def _async_load_documents_from_file(
4888
4888
  file_path: Path | str,
4889
4889
  csv_delimiter: str | None = None,
4890
4890
  *,
4891
- json_handler: BuiltinHandler | OrjsonHandler | UjsonHandler,
4891
+ json_handler: BuiltinHandler | OrjsonHandler,
4892
4892
  ) -> list[dict[Any, Any]]:
4893
4893
  if isinstance(file_path, str):
4894
4894
  file_path = Path(file_path)