Skip to content

Commit 0de4d06

Browse files
authored
Merge pull request #362 from sanders41/meilisearch-1.0
Update CI for meilisearch 1.0
2 parents 2863ed2 + ada4e87 commit 0de4d06

File tree

18 files changed

+241
-232
lines changed

18 files changed

+241
-232
lines changed

.github/release-draft-template.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ exclude-labels:
44
- 'dependencies'
55
- 'skip-changelog'
66
version-resolver:
7-
minor:
7+
major:
88
labels:
99
- 'breaking-change'
10+
minor:
11+
labels:
1012
- 'enhancement'
1113
- 'feature'
1214
default: patch

.github/workflows/testing.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
- name: Install Dependencies
7878
run: poetry install
7979
- name: MeiliSearch (latest version) setup with Docker
80-
run: docker run --rm -d -p 7700:7700 getmeili/meilisearch:v0.30.5 meilisearch --no-analytics --master-key=masterKey
80+
run: docker run --rm -d -p 7700:7700 getmeili/meilisearch:latest meilisearch --no-analytics --master-key=masterKey
8181
- name: Test with pytest
8282
run: |
8383
poetry run pytest --cov=meilisearch_python_async --cov-report=xml

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,6 @@ SearchResults(
125125

126126
See our [docs](https://meilisearch-python-async.paulsanders.dev) for the full documentation.
127127

128-
## Compatibility with Meilisearch
129-
130-
This package only guarantees the compatibility with [version v0.30 of Meilisearch](https://github.com/meilisearch/MeiliSearch/releases/tag/v0.30.0).
131-
132128
## Contributing
133129

134130
Contributions to this project are welcome. If you are interesting in contributing please see our [contributing guide](CONTRIBUTING.md)

docs/index.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,3 @@ Meilisearch Python Async is a Python async client for the [Meilisearch](https://
44

55
The focus of this documentation is on the Meilisearch Python Async API. More information of
66
Meilisearch itself and how to use it can be found in [here](https://docs.meilisearch.com/).
7-
8-
## Compatibility with Meilisearch
9-
10-
This package only guarantees the compatibility with [version v0.20 of Meilisearch](https://github.com/meilisearch/meilisearch/releases/tag/v0.30.0).

docs/pydantic.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Pydantic usage
22

33
This package uses [Pydantic](https://pydantic-docs.helpmanual.io/) to serialize/deserialize the JSON
4-
from MeiliSearch into Python objects wherever possible, and in the process converts the camelCaseNames
4+
from Meilisearch into Python objects wherever possible, and in the process converts the camelCaseNames
55
from JSON into more Pythonic snake_case_names.
66

77
In some instances it is not possible to return the data as an object because the structure will be
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
from meilisearch_python_async.client import Client as Client # noqa: F401
1+
from meilisearch_python_async.client import Client
2+
3+
__all__ = ["Client"]

meilisearch_python_async/_http_requests.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
)
1313

1414
from meilisearch_python_async.errors import (
15-
MeiliSearchApiError,
16-
MeiliSearchCommunicationError,
17-
MeiliSearchError,
15+
MeilisearchApiError,
16+
MeilisearchCommunicationError,
17+
MeilisearchError,
1818
)
1919

2020

@@ -45,13 +45,13 @@ async def _send_request(
4545
return response
4646

4747
except (ConnectError, ConnectTimeout, RemoteProtocolError) as err:
48-
raise MeiliSearchCommunicationError(str(err)) from err
48+
raise MeilisearchCommunicationError(str(err)) from err
4949
except HTTPError as err:
5050
if "response" in locals():
51-
raise MeiliSearchApiError(str(err), response) from err
51+
raise MeilisearchApiError(str(err), response) from err
5252
else:
5353
# Fail safe just in case error happens before response is created
54-
raise MeiliSearchError(str(err)) # pragma: no cover
54+
raise MeilisearchError(str(err)) # pragma: no cover
5555

5656
async def get(self, path: str) -> Response:
5757
return await self._send_request(self.http_client.get, path)

meilisearch_python_async/client.py

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from httpx import AsyncClient
1111

1212
from meilisearch_python_async._http_requests import HttpRequests
13-
from meilisearch_python_async.errors import InvalidRestriction, MeiliSearchApiError
13+
from meilisearch_python_async.errors import InvalidRestriction, MeilisearchApiError
1414
from meilisearch_python_async.index import Index
1515
from meilisearch_python_async.models.client import ClientStats, Key, KeyCreate, KeySearch, KeyUpdate
1616
from meilisearch_python_async.models.health import Health
@@ -21,7 +21,7 @@
2121

2222

2323
class Client:
24-
"""The client to connect to the MeiliSearchApi."""
24+
"""The client to connect to the MeilisearchApi."""
2525

2626
def __init__(
2727
self,
@@ -35,8 +35,8 @@ def __init__(
3535
3636
Args:
3737
38-
url: The url to the MeiliSearch API (ex: http://localhost:7700)
39-
api_key: The optional API key for MeiliSearch. Defaults to None.
38+
url: The url to the Meilisearch API (ex: http://localhost:7700)
39+
api_key: The optional API key for Meilisearch. Defaults to None.
4040
timeout: The amount of time in seconds that the client will wait for a response before
4141
timing out. Defaults to None.
4242
verify: SSL certificates (a.k.a CA bundle) used to
@@ -72,7 +72,7 @@ async def aclose(self) -> None:
7272
await self.http_client.aclose()
7373

7474
async def create_dump(self) -> TaskInfo:
75-
"""Trigger the creation of a MeiliSearch dump.
75+
"""Trigger the creation of a Meilisearch dump.
7676
7777
Returns:
7878
@@ -81,7 +81,7 @@ async def create_dump(self) -> TaskInfo:
8181
Raises:
8282
8383
MeilisearchCommunicationError: If there was an error communicating with the server.
84-
MeilisearchApiError: If the MeiliSearch API returned an error.
84+
MeilisearchApiError: If the Meilisearch API returned an error.
8585
8686
Examples:
8787
@@ -108,7 +108,7 @@ async def create_index(self, uid: str, primary_key: str | None = None) -> Index:
108108
Raises:
109109
110110
MeilisearchCommunicationError: If there was an error communicating with the server.
111-
MeilisearchApiError: If the MeiliSearch API returned an error.
111+
MeilisearchApiError: If the Meilisearch API returned an error.
112112
113113
Examples:
114114
@@ -132,7 +132,7 @@ async def delete_index_if_exists(self, uid: str) -> bool:
132132
Raises:
133133
134134
MeilisearchCommunicationError: If there was an error communicating with the server.
135-
MeilisearchApiError: If the MeiliSearch API returned an error.
135+
MeilisearchApiError: If the Meilisearch API returned an error.
136136
137137
Examples:
138138
@@ -219,7 +219,7 @@ async def get_indexes(self) -> list[Index] | None:
219219
Raises:
220220
221221
MeilisearchCommunicationError: If there was an error communicating with the server.
222-
MeilisearchApiError: If the MeiliSearch API returned an error.
222+
MeilisearchApiError: If the Meilisearch API returned an error.
223223
224224
Examples:
225225
@@ -257,7 +257,7 @@ async def get_index(self, uid: str) -> Index:
257257
Raises:
258258
259259
MeilisearchCommunicationError: If there was an error communicating with the server.
260-
MeilisearchApiError: If the MeiliSearch API returned an error.
260+
MeilisearchApiError: If the Meilisearch API returned an error.
261261
262262
Examples:
263263
@@ -283,7 +283,7 @@ def index(self, uid: str) -> Index:
283283
Raises:
284284
285285
MeilisearchCommunicationError: If there was an error communicating with the server.
286-
MeilisearchApiError: If the MeiliSearch API returned an error.
286+
MeilisearchApiError: If the Meilisearch API returned an error.
287287
288288
Examples:
289289
@@ -304,7 +304,7 @@ async def get_all_stats(self) -> ClientStats:
304304
Raises:
305305
306306
MeilisearchCommunicationError: If there was an error communicating with the server.
307-
MeilisearchApiError: If the MeiliSearch API returned an error.
307+
MeilisearchApiError: If the Meilisearch API returned an error.
308308
309309
Examples:
310310
@@ -331,8 +331,8 @@ async def get_or_create_index(self, uid: str, primary_key: str | None = None) ->
331331
Raises:
332332
333333
MeilisearchCommunicationError: If there was an error communicating with the server.
334-
MeilisearchApiError: If the MeiliSearch API returned an error.MeiliSearchTimeoutError: If the connection times out.
335-
MeiliSearchTimeoutError: If the connection times out.
334+
MeilisearchApiError: If the Meilisearch API returned an error.MeilisearchTimeoutError: If the connection times out.
335+
MeilisearchTimeoutError: If the connection times out.
336336
337337
Examples:
338338
@@ -342,7 +342,7 @@ async def get_or_create_index(self, uid: str, primary_key: str | None = None) ->
342342
"""
343343
try:
344344
index_instance = await self.get_index(uid)
345-
except MeiliSearchApiError as err:
345+
except MeilisearchApiError as err:
346346
if "index_not_found" not in err.code:
347347
raise
348348
index_instance = await self.create_index(uid, primary_key)
@@ -363,7 +363,7 @@ async def create_key(self, key: KeyCreate) -> Key:
363363
Raises:
364364
365365
MeilisearchCommunicationError: If there was an error communicating with the server.
366-
MeilisearchApiError: If the MeiliSearch API returned an error.
366+
MeilisearchApiError: If the Meilisearch API returned an error.
367367
368368
Examples:
369369
@@ -397,7 +397,7 @@ async def delete_key(self, key: str) -> int:
397397
Raises:
398398
399399
MeilisearchCommunicationError: If there was an error communicating with the server.
400-
MeilisearchApiError: If the MeiliSearch API returned an error.
400+
MeilisearchApiError: If the Meilisearch API returned an error.
401401
402402
Examples:
403403
@@ -409,7 +409,7 @@ async def delete_key(self, key: str) -> int:
409409
return response.status_code
410410

411411
async def get_keys(self) -> KeySearch:
412-
"""Gets the MeiliSearch API keys.
412+
"""Gets the Meilisearch API keys.
413413
414414
Returns:
415415
@@ -418,7 +418,7 @@ async def get_keys(self) -> KeySearch:
418418
Raises:
419419
420420
MeilisearchCommunicationError: If there was an error communicating with the server.
421-
MeilisearchApiError: If the MeiliSearch API returned an error.
421+
MeilisearchApiError: If the Meilisearch API returned an error.
422422
423423
Examples:
424424
@@ -444,7 +444,7 @@ async def get_key(self, key: str) -> Key:
444444
Raises:
445445
446446
MeilisearchCommunicationError: If there was an error communicating with the server.
447-
MeilisearchApiError: If the MeiliSearch API returned an error.
447+
MeilisearchApiError: If the Meilisearch API returned an error.
448448
449449
Examples:
450450
@@ -471,7 +471,7 @@ async def update_key(self, key: KeyUpdate) -> Key:
471471
Raises:
472472
473473
MeilisearchCommunicationError: If there was an error communicating with the server.
474-
MeilisearchApiError: If the MeiliSearch API returned an error.
474+
MeilisearchApiError: If the Meilisearch API returned an error.
475475
476476
Examples:
477477
@@ -486,7 +486,11 @@ async def update_key(self, key: KeyUpdate) -> Key:
486486
"""
487487
# The json.loads(key.json()) is because Pydantic can't serialize a date in a Python dict,
488488
# but can when converting to a json string.
489-
payload = {k: v for k, v in json.loads(key.json(by_alias=True)).items() if v is not None}
489+
payload = {
490+
k: v
491+
for k, v in json.loads(key.json(by_alias=True)).items()
492+
if v is not None and k != "key"
493+
}
490494
response = await self._http_requests.patch(f"keys/{key.key}", payload)
491495

492496
return Key(**response.json())
@@ -505,7 +509,7 @@ async def get_raw_index(self, uid: str) -> IndexInfo | None:
505509
Raises:
506510
507511
MeilisearchCommunicationError: If there was an error communicating with the server.
508-
MeilisearchApiError: If the MeiliSearch API returned an error.
512+
MeilisearchApiError: If the Meilisearch API returned an error.
509513
510514
Examples:
511515
@@ -532,7 +536,7 @@ async def get_raw_indexes(self) -> list[IndexInfo] | None:
532536
Raises:
533537
534538
MeilisearchCommunicationError: If there was an error communicating with the server.
535-
MeilisearchApiError: If the MeiliSearch API returned an error.
539+
MeilisearchApiError: If the Meilisearch API returned an error.
536540
537541
Examples:
538542
@@ -548,16 +552,16 @@ async def get_raw_indexes(self) -> list[IndexInfo] | None:
548552
return [IndexInfo(**x) for x in response.json()["results"]]
549553

550554
async def get_version(self) -> Version:
551-
"""Get the MeiliSearch version.
555+
"""Get the Meilisearch version.
552556
553557
Returns:
554558
555-
Information about the version of MeiliSearch.
559+
Information about the version of Meilisearch.
556560
557561
Raises:
558562
559563
MeilisearchCommunicationError: If there was an error communicating with the server.
560-
MeilisearchApiError: If the MeiliSearch API returned an error.
564+
MeilisearchApiError: If the Meilisearch API returned an error.
561565
562566
Examples:
563567
@@ -570,16 +574,16 @@ async def get_version(self) -> Version:
570574
return Version(**response.json())
571575

572576
async def health(self) -> Health:
573-
"""Get health of the MeiliSearch server.
577+
"""Get health of the Meilisearch server.
574578
575579
Returns:
576580
577-
The status of the MeiliSearch server.
581+
The status of the Meilisearch server.
578582
579583
Raises:
580584
581585
MeilisearchCommunicationError: If there was an error communicating with the server.
582-
MeilisearchApiError: If the MeiliSearch API returned an error.
586+
MeilisearchApiError: If the Meilisearch API returned an error.
583587
584588
Examples:
585589
@@ -605,7 +609,7 @@ async def swap_indexes(self, indexes: list[tuple[str, str]]) -> TaskInfo:
605609
Raises:
606610
607611
MeilisearchCommunicationError: If there was an error communicating with the server.
608-
MeilisearchApiError: If the MeiliSearch API returned an error.
612+
MeilisearchApiError: If the Meilisearch API returned an error.
609613
610614
Examples:
611615

0 commit comments

Comments
 (0)