Skip to content

Commit f19cd86

Browse files
authored
Merge branch 'main' into dependabot/pip/mypy-0.982
2 parents 3be870a + ca5f199 commit f19cd86

File tree

12 files changed

+298
-9
lines changed

12 files changed

+298
-9
lines changed

.github/workflows/documentation.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Documentation
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
7+
jobs:
8+
docs:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
with:
13+
fetch-depth: 0
14+
lfs: true
15+
- name: Install Python
16+
uses: actions/setup-python@v2
17+
with:
18+
python-version: '3.10'
19+
- name: Install pipenv
20+
uses: dschep/install-pipenv-action@v1
21+
- name: Install dependencies
22+
run: pipenv install --dev
23+
- name: Build docs
24+
uses: ammaraskar/sphinx-action@master
25+
with:
26+
pre-build-command: "pip install sphinx_rtd_theme && sphinx-apidoc -f -o docs meilisearch/"
27+
docs-folder: "docs/"
28+
- name: Deploy
29+
uses: peaceiris/actions-gh-pages@v3
30+
with:
31+
github_token: ${{ secrets.GITHUB_TOKEN }}
32+
publish_dir: docs/_build/html
33+
force_orphan: true
34+
35+
36+
37+
38+
39+
40+
41+
42+
43+
44+
45+

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ It's [Hacktoberfest month](https://hacktoberfest.com)! 🥳
1515

1616
Thanks so much for participating with Meilisearch this year!
1717

18-
1. We will follow the quality standards set by the organizers of Hacktoberfest (see detail on their [website](https://hacktoberfest.digitalocean.com/resources/qualitystandards)). Our reviewers will not consider any PR that doesn’t match that standard.
18+
1. We will follow the quality standards set by the organizers of Hacktoberfest (see detail on their [website](https://hacktoberfest.com/participation/#spam)). Our reviewers will not consider any PR that doesn’t match that standard.
1919
2. PRs reviews will take place from Monday to Thursday, during usual working hours, CEST time. If you submit outside of these hours, there’s no need to panic; we will get around to your contribution.
2020
3. There will be no issue assignment as we don’t want people to ask to be assigned specific issues and never return, discouraging the volunteer contributors from opening a PR to fix this issue. We take the liberty to choose the PR that best fixes the issue, so we encourage you to get to it as soon as possible and do your best!
2121

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/conf.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Path setup --------------------------------------------------------------
8+
9+
# If extensions (or modules to document with autodoc) are in another directory,
10+
# add these directories to sys.path here. If the directory is relative to the
11+
# documentation root, use os.path.abspath to make it absolute, like shown here.
12+
#
13+
import os
14+
import sys
15+
sys.path.insert(0, os.path.abspath('..'))
16+
17+
# -- Project information -----------------------------------------------------
18+
19+
project = 'meilisearch-python'
20+
copyright = '2019, Meili SAS'
21+
author = 'Charlotte Vermandel'
22+
23+
24+
# -- General configuration ---------------------------------------------------
25+
26+
# Add any Sphinx extension module names here, as strings. They can be
27+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
28+
# ones.
29+
extensions = [
30+
'sphinx.ext.autodoc',
31+
'sphinx.ext.napoleon',
32+
'sphinx.ext.viewcode',
33+
]
34+
35+
# Add any paths that contain templates here, relative to this directory.
36+
templates_path = ['_templates']
37+
38+
# List of patterns, relative to source directory, that match files and
39+
# directories to ignore when looking for source files.
40+
# This pattern also affects html_static_path and html_extra_path.
41+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
42+
43+
44+
# -- Options for HTML output -------------------------------------------------
45+
46+
# The theme to use for HTML and HTML Help pages. See the documentation for
47+
# a list of builtin themes.
48+
#
49+
html_theme = 'sphinx_rtd_theme'
50+
#html_theme = 'alabaster'
51+
52+
# Add any paths that contain custom static files (such as style sheets) here,
53+
# relative to this directory. They are copied after the builtin static files,
54+
# so a file named "default.css" will overwrite the builtin "default.css".
55+
html_static_path = []

docs/index.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.. meilisearch-python documentation master file, created by
2+
sphinx-quickstart on Sun Oct 2 13:24:48 2022.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
Welcome to meilisearch-python's documentation!
7+
==============================================
8+
9+
.. toctree::
10+
:maxdepth: 2
11+
:caption: Contents:
12+
13+
14+
15+
.. include:: modules.rst
16+
17+
Indices and tables
18+
==================
19+
20+
* :ref:`genindex`
21+
* :ref:`modindex`
22+
* :ref:`search`

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=.
11+
set BUILDDIR=_build
12+
13+
if "%1" == "" goto help
14+
15+
%SPHINXBUILD% >NUL 2>NUL
16+
if errorlevel 9009 (
17+
echo.
18+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19+
echo.installed, then set the SPHINXBUILD environment variable to point
20+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
21+
echo.may add the Sphinx directory to PATH.
22+
echo.
23+
echo.If you don't have Sphinx installed, grab it from
24+
echo.https://www.sphinx-doc.org/
25+
exit /b 1
26+
)
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

docs/meilisearch.models.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
meilisearch.models package
2+
==========================
3+
4+
Submodules
5+
----------
6+
7+
meilisearch.models.document module
8+
----------------------------------
9+
10+
.. automodule:: meilisearch.models.document
11+
:members:
12+
:undoc-members:
13+
:show-inheritance:
14+
15+
meilisearch.models.index module
16+
-------------------------------
17+
18+
.. automodule:: meilisearch.models.index
19+
:members:
20+
:undoc-members:
21+
:show-inheritance:
22+
23+
meilisearch.models.task module
24+
------------------------------
25+
26+
.. automodule:: meilisearch.models.task
27+
:members:
28+
:undoc-members:
29+
:show-inheritance:
30+
31+
Module contents
32+
---------------
33+
34+
.. automodule:: meilisearch.models
35+
:members:
36+
:undoc-members:
37+
:show-inheritance:

docs/meilisearch.rst

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
meilisearch package
2+
===================
3+
4+
Subpackages
5+
-----------
6+
7+
.. toctree::
8+
:maxdepth: 4
9+
10+
meilisearch.models
11+
12+
Submodules
13+
----------
14+
15+
meilisearch.client module
16+
-------------------------
17+
18+
.. automodule:: meilisearch.client
19+
:members:
20+
:undoc-members:
21+
:show-inheritance:
22+
23+
meilisearch.config module
24+
-------------------------
25+
26+
.. automodule:: meilisearch.config
27+
:members:
28+
:undoc-members:
29+
:show-inheritance:
30+
31+
meilisearch.errors module
32+
-------------------------
33+
34+
.. automodule:: meilisearch.errors
35+
:members:
36+
:undoc-members:
37+
:show-inheritance:
38+
39+
meilisearch.index module
40+
------------------------
41+
42+
.. automodule:: meilisearch.index
43+
:members:
44+
:undoc-members:
45+
:show-inheritance:
46+
47+
meilisearch.task module
48+
-----------------------
49+
50+
.. automodule:: meilisearch.task
51+
:members:
52+
:undoc-members:
53+
:show-inheritance:
54+
55+
meilisearch.version module
56+
--------------------------
57+
58+
.. automodule:: meilisearch.version
59+
:members:
60+
:undoc-members:
61+
:show-inheritance:
62+
63+
Module contents
64+
---------------
65+
66+
.. automodule:: meilisearch
67+
:members:
68+
:undoc-members:
69+
:show-inheritance:

docs/modules.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
meilisearch
2+
===========
3+
4+
.. toctree::
5+
:maxdepth: 4
6+
7+
meilisearch

meilisearch/client.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,6 @@ def update_key(
327327
"""Update an API key.
328328
329329
Parameters
330-
331330
----------
332331
key:
333332
The key or the uid of the key for which to update the information.

meilisearch/index.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ def get_tasks(self, parameters: dict[str, Any] | None = None) -> TaskResults:
143143
-------
144144
tasks:
145145
TaskResults instance with attributes:
146-
- from_
147-
- next_
146+
- from
147+
- next
148148
- limit
149149
- results : list of Task instances containing all enqueued, processing, succeeded or failed tasks of the index
150150
@@ -264,7 +264,7 @@ def search(self, query: str, opt_params: dict[str, Any] | None = None) -> dict[s
264264
body=body
265265
)
266266

267-
def get_document(self, document_id: str, parameters: dict[str, Any] | None = None) -> Document:
267+
def get_document(self, document_id: str | int, parameters: dict[str, Any] | None = None) -> Document:
268268
"""Get one document with given document identifier.
269269
270270
Parameters
@@ -573,7 +573,7 @@ def update_documents_in_batches(
573573

574574
return tasks
575575

576-
def delete_document(self, document_id: str) -> TaskInfo:
576+
def delete_document(self, document_id: str | int) -> TaskInfo:
577577
"""Delete one document from the index.
578578
579579
Parameters
@@ -597,7 +597,7 @@ def delete_document(self, document_id: str) -> TaskInfo:
597597
)
598598
return TaskInfo(**response)
599599

600-
def delete_documents(self, ids: list[str]) -> TaskInfo:
600+
def delete_documents(self, ids: list[str | int]) -> TaskInfo:
601601
"""Delete multiple documents from the index.
602602
603603
Parameters
@@ -618,7 +618,7 @@ def delete_documents(self, ids: list[str]) -> TaskInfo:
618618
"""
619619
response = self.http.post(
620620
f'{self.config.paths.index}/{self.uid}/{self.config.paths.document}/delete-batch',
621-
ids
621+
[str(i) for i in ids]
622622
)
623623
return TaskInfo(**response)
624624

tests/index/test_index_document_meilisearch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def test_delete_document(index_with_documents):
143143

144144
def test_delete_documents(index_with_documents):
145145
"""Tests deleting a set of documents."""
146-
to_delete = ['522681', '450465', '329996']
146+
to_delete = [522681, '450465', 329996]
147147
index = index_with_documents()
148148
response = index.delete_documents(to_delete)
149149
assert isinstance(response, TaskInfo)

0 commit comments

Comments
 (0)