Skip to content

Commit 7c8bf97

Browse files
committed
Merge branch 'master' into v28-changes
2 parents bf3fbcf + 26d41a3 commit 7c8bf97

5 files changed

Lines changed: 125 additions & 11 deletions

File tree

.github/workflows/release.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Publish Package to PyPI
2+
on:
3+
push:
4+
tags:
5+
- 'v*'
6+
jobs:
7+
tests:
8+
name: Run Tests
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Set up Python
14+
uses: actions/setup-python@v4
15+
with:
16+
python-version: "3.8"
17+
cache: 'pip'
18+
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install -r requirements/dev.txt
23+
24+
- name: Run tests (excluding OpenAI)
25+
run: coverage run -m pytest -m "not open_ai"
26+
27+
- name: Show coverage report
28+
run: coverage report
29+
build-n-publish:
30+
name: Build and Publish
31+
needs: tests
32+
runs-on: ubuntu-latest
33+
environment:
34+
name: pypi
35+
url: https://pypi.org/p/typesense
36+
permissions:
37+
id-token: write
38+
contents: read
39+
steps:
40+
- uses: actions/checkout@v4
41+
with:
42+
fetch-depth: 0
43+
44+
- name: Set up Python
45+
uses: actions/setup-python@v4
46+
with:
47+
python-version: "3.8"
48+
cache: pip
49+
50+
- name: Install build dependencies
51+
run: |
52+
python -m pip install --upgrade pip
53+
pip install build
54+
- name: Build package
55+
run: |
56+
rm -rf dist/
57+
python -m build
58+
- name: Publish to PyPI
59+
uses: pypa/gh-action-pypi-publish@release/v1
60+
with:
61+
attestations: true
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Test and Lint
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
quality:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
15+
services:
16+
typesense:
17+
image: typesense/typesense:27.1
18+
ports:
19+
- 8108:8108
20+
volumes:
21+
- /tmp/typesense-data:/data
22+
- /tmp/typesense-analytics:/analytics
23+
env:
24+
TYPESENSE_API_KEY: xyz
25+
TYPESENSE_DATA_DIR: /data
26+
TYPESENSE_ENABLE_CORS: true
27+
TYPESENSE_ANALYTICS_DIR: /analytics
28+
TYPESENSE_ENABLE_SEARCH_ANALYTICS: true
29+
30+
steps:
31+
- name: Wait for Typesense
32+
run: |
33+
timeout 20 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8108/health)" != "200" ]]; do sleep 1; done' || false
34+
- uses: actions/checkout@v4
35+
36+
- name: Set up Python ${{ matrix.python-version }}
37+
uses: actions/setup-python@v4
38+
with:
39+
python-version: ${{ matrix.python-version }}
40+
cache: 'pip'
41+
42+
- name: Install dependencies
43+
run: |
44+
python -m pip install --upgrade pip
45+
pip install -r requirements/dev.txt
46+
47+
- name: Lint with Flake8
48+
run: |
49+
flake8 src/typesense
50+
51+
- name: Check types with mypy
52+
run: |
53+
mypy src/typesense
54+
55+
- name: Run tests and coverage (excluding OpenAI)
56+
run: |
57+
coverage run -m pytest -m "not open_ai"

publish.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

setup.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ docstring-style = sphinx
1919
max-complexity = 6
2020

2121
# # Excluding some directories:
22-
exclude = .git,__pycache__,venv,.eggs,*.egg
23-
ignore = Q000, WPS602, WPS432, WPS305, WPS221, WPS230, WPS234, WPS433, WPS440, W503, WPS331, WPS306, WPS237, WPS202, RST301, RST306, WPS214, WPS235, WPS226, WPS337, WPS320, F821, WPS201, E704, D102
22+
exclude = .git,__pycache__,venv,.eggs,*.egg,src/typesense/__init__.py
23+
ignore = Q000, WPS602, WPS432, WPS305, WPS221, WPS230, WPS234, WPS433, WPS440, W503, WPS331, WPS306, WPS237, WPS202, RST301, RST306, WPS214, WPS235, WPS226, WPS337, WPS320, F821, WPS201
2424
per-file-ignores =
2525
tests/*.py: S101, WPS226, WPS118, WPS202, WPS204, WPS218, WPS211, WPS604, WPS431, WPS210, WPS201, WPS437
2626
src/typesense/types/*.py: B950, WPS215, WPS111, WPS462, WPS322, WPS428, WPS114, WPS110, WPS202

src/typesense/api_call.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ def _execute_request(
334334
as_json: typing.Literal[True],
335335
last_exception: typing.Union[None, Exception] = None,
336336
num_retries: int = 0,
337-
**kwargs: typing.Unpack[SessionFunctionKwargs[TParams, TBody]],
337+
**kwargs: SessionFunctionKwargs[TParams, TBody],
338338
) -> TEntityDict:
339339
"""
340340
Execute a request to the Typesense API with retry logic.
@@ -373,7 +373,7 @@ def _execute_request(
373373
as_json: typing.Literal[False],
374374
last_exception: typing.Union[None, Exception] = None,
375375
num_retries: int = 0,
376-
**kwargs: typing.Unpack[SessionFunctionKwargs[TParams, TBody]],
376+
**kwargs: SessionFunctionKwargs[TParams, TBody],
377377
) -> str:
378378
"""
379379
Execute a request to the Typesense API with retry logic.
@@ -411,7 +411,7 @@ def _execute_request(
411411
as_json: typing.Union[typing.Literal[True], typing.Literal[False]] = True,
412412
last_exception: typing.Union[None, Exception] = None,
413413
num_retries: int = 0,
414-
**kwargs: typing.Unpack[SessionFunctionKwargs[TParams, TBody]],
414+
**kwargs: SessionFunctionKwargs[TParams, TBody],
415415
) -> typing.Union[TEntityDict, str]:
416416
"""
417417
Execute a request to the Typesense API with retry logic.
@@ -473,7 +473,7 @@ def _make_request_and_process_response(
473473
url: str,
474474
entity_type: typing.Type[TEntityDict],
475475
as_json: bool,
476-
**kwargs: typing.Any,
476+
**kwargs: SessionFunctionKwargs[TParams, TBody],
477477
) -> typing.Union[TEntityDict, str]:
478478
"""Make the API request and process the response."""
479479
request_response = self.request_handler.make_request(
@@ -493,7 +493,7 @@ def _make_request_and_process_response(
493493
def _prepare_request_params(
494494
self,
495495
endpoint: str,
496-
**kwargs: typing.Unpack[SessionFunctionKwargs[TParams, TBody]],
496+
**kwargs: SessionFunctionKwargs[TParams, TBody],
497497
) -> typing.Tuple[Node, str, SessionFunctionKwargs[TParams, TBody]]:
498498
node = self.node_manager.get_node()
499499
url = node.url() + endpoint

0 commit comments

Comments
 (0)