Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 5 additions & 17 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,31 +99,19 @@ jobs:
- name: mypy type check
run: uv run mypy meilisearch

black:
name: black
ruff:
name: ruff
runs-on: ubuntu-latest
env:
PYTHONUNBUFFERED: 1
UV_PYTHON: "3.9"
UV_LOCKED: 1
steps:
- name: Checkout the repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false

- name: Set up Python 3.9
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
- name: ruff format
uses: astral-sh/ruff-action@0ce1b0bf8b818ef400413f810f8a11cdbda0034b # v4.0.0
with:
python-version: 3.9

- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
version: "0.11.21"

- name: black
run: uv run black meilisearch tests --check
args: "format --check"

isort:
name: isort
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ uv sync
### Tests and Linter <!-- omit in toc -->

Each PR should pass the tests, mypy type checking, and the linter to be accepted.
Your PR also needs to be formatted using black and isort.
Your PR also needs to be formatted using ruff and have its imports sorted using isort.

```bash
# Tests
Expand All @@ -67,8 +67,8 @@ uv run pytest tests
uv run mypy meilisearch
# Linter
uv run pylint meilisearch tests
# Black
uv run black meilisearch tests
# Format
uv run ruff format .
# Isort
uv run isort meilisearch tests
```
Expand Down
8 changes: 6 additions & 2 deletions meilisearch/_httprequests.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ def send_request(
data = (
json.dumps(body, cls=serializer)
if isinstance(body, bool) or serialize_body
else "" if body == "" else "null"
else ""
if body == ""
else "null"
)

request = http_method(
Expand Down Expand Up @@ -182,7 +184,9 @@ def post_stream(
data = (
json.dumps(body, cls=serializer)
if isinstance(body, bool) or serialize_body
else "" if body == "" else "null"
else ""
if body == ""
else "null"
)

response = requests.post(
Expand Down
23 changes: 2 additions & 21 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ test = [
lint = [
"mypy>=1.19.1",
"pylint>=v3.3.9",
"black>=25.11.0",
"ruff>=0.15.17",
"isort>=6.1.0",
"types-requests",
]
Expand All @@ -72,27 +72,8 @@ exclude = ["docs*", "tests*"]
[tool.setuptools.package-data]
meilisearch = ["py.typed"]

[tool.black]
[tool.ruff]
Comment thread
sanders41 marked this conversation as resolved.
line-length = 100
target-version = ['py39']
include = '\.pyi?$'
extend-exclude = '''
/(
\.egg
| \.git
| \.hg
| \.mypy_cache
| \.nox
| \.tox
| \.venv
| \venv
| _build
| buck-out
| build
| dist
| setup.py
)/
'''

[tool.isort]
profile = "black"
Expand Down
4 changes: 1 addition & 3 deletions tests/client/test_client_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
)


def test_export_creation(
client, client2, index_with_documents, enable_vector_search
): # pylint: disable=unused-argument
def test_export_creation(client, client2, index_with_documents, enable_vector_search): # pylint: disable=unused-argument
"""Tests the creation of a Meilisearch export."""
index = index_with_documents()
export_task = client.export(common.BASE_URL_2, api_key=common.MASTER_KEY)
Expand Down
6 changes: 3 additions & 3 deletions tests/client/test_multimodal.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ def setup_index(self, request):

# Verify index is ready by checking stats
stats = index.get_stats()
assert stats.number_of_documents == len(
MOVIES
), f"Expected {len(MOVIES)} documents, got {stats.number_of_documents}"
assert stats.number_of_documents == len(MOVIES), (
f"Expected {len(MOVIES)} documents, got {stats.number_of_documents}"
)

# Store for tests on the class
# Use request.cls to ensure attributes are available on test instances
Expand Down
Loading
Loading