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
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
python-version: "3.9"
cache: pip

- name: Install build dependencies
Expand Down
22 changes: 10 additions & 12 deletions .github/workflows/test-and-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
services:
typesense:
image: typesense/typesense:28.0
Expand All @@ -31,27 +31,25 @@ jobs:
- name: Wait for Typesense
run: |
timeout 20 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8108/health)" != "200" ]]; do sleep 1; done' || false

- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/dev.txt
- name: Install the project
run: uv sync --locked --all-extras --dev

- name: Lint with Flake8
- name: Lint with Ruff
run: |
flake8 src/typesense
uv run ruff check src/typesense

- name: Check types with mypy
run: |
mypy src/typesense
uv run mypy src/typesense

- name: Run tests and coverage (excluding OpenAI)
run: |
coverage run -m pytest -m "not open_ai"
uv run coverage run -m pytest -m "not open_ai"
1 change: 0 additions & 1 deletion .python-version

This file was deleted.

24 changes: 0 additions & 24 deletions Pipfile

This file was deleted.

905 changes: 0 additions & 905 deletions Pipfile.lock

This file was deleted.

42 changes: 32 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "typesense"
description = "Python client for Typesense, an open source and typo tolerant search engine."
authors = [
{"name" = "Typesense", "email" = "[email protected]"},
]
authors = [{ name = "Typesense", email = "[email protected]" }]
requires-python = ">=3.9"
readme = "README.md"
requires-python = ">=3"
keywords = ["search", "typesense"]
license = {"text" = "Apache 2.0"}
license = { text = "Apache 2.0" }
keywords = [
"search",
"typesense",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
Expand All @@ -27,6 +24,31 @@ Documentation = "https://typesense.org/"
Source = "https://github.com/typesense/typesense-python"
Tracker = "https://github.com/typesense/typesense-python/issues"

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[dependency-groups]
dev = [
"mypy",
"pytest",
"coverage",
"pytest-mock",
"requests-mock",
"python-dotenv",
"types-requests",
"faker",
"ruff>=0.11.11",
"isort>=6.0.1",
]

[tool.uv]
package = false

[[tool.uv.index]]
name = "pypi"
url = "https://pypi.org/simple"

[tool.setuptools.dynamic]
version = {attr = "typesense.__version__"}

Expand Down
48 changes: 48 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# This file was autogenerated by uv via the following command:
# uv pip compile pyproject.toml --group dev -o requirements-dev.txt
certifi==2025.4.26
# via requests
charset-normalizer==3.4.2
# via requests
coverage==7.8.2
# via typesense (pyproject.toml:dev)
faker==37.3.0
# via typesense (pyproject.toml:dev)
idna==3.10
# via requests
iniconfig==2.1.0
# via pytest
mypy==1.15.0
# via typesense (pyproject.toml:dev)
mypy-extensions==1.1.0
# via mypy
packaging==25.0
# via pytest
pluggy==1.6.0
# via pytest
pytest==8.3.5
# via
# typesense (pyproject.toml:dev)
# pytest-mock
pytest-mock==3.14.1
# via typesense (pyproject.toml:dev)
python-dotenv==1.1.0
# via typesense (pyproject.toml:dev)
requests==2.32.3
# via
# typesense (pyproject.toml)
# requests-mock
requests-mock==1.12.1
# via typesense (pyproject.toml:dev)
ruff==0.11.11
# via typesense (pyproject.toml:dev)
types-requests==2.32.0.20250515
# via typesense (pyproject.toml:dev)
typing-extensions==4.13.2
# via mypy
tzdata==2025.2
# via faker
urllib3==2.4.0
# via
# requests
# types-requests
14 changes: 12 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
-i https://pypi.org/simple
-r requirements/common.txt
# This file was autogenerated by uv via the following command:
# uv pip compile pyproject.toml -o requirements.txt
certifi==2024.8.30
# via requests
charset-normalizer==3.3.2
# via requests
idna==3.8
# via requests
requests==2.32.3
# via typesense (pyproject.toml)
urllib3==2.2.2
# via requests
6 changes: 0 additions & 6 deletions requirements/common.txt

This file was deleted.

64 changes: 0 additions & 64 deletions requirements/dev.txt

This file was deleted.

67 changes: 67 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
]

line-length = 88
indent-width = 4

target-version = "py39"

[lint]
select = ["E4", "E7", "E9", "F", "B"]

ignore = ["E501"]

fixable = ["ALL"]
unfixable = ["B"]

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

[format]
quote-style = "double"

indent-style = "space"

skip-magic-trailing-comma = false

line-ending = "auto"

# Enable auto-formatting of code examples in docstrings. Markdown,
# reStructuredText code/literal blocks and doctests are all supported.
#
# This is currently disabled by default, but it is planned for this
# to be opt-out in the future.
docstring-code-format = true

# Set the line length limit used when formatting code snippets in
# docstrings.
#
# This only has an effect when the `docstring-code-format` setting is
# enabled.
docstring-code-line-length = "dynamic"
3 changes: 1 addition & 2 deletions src/typesense/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from .client import Client # NOQA


__version__ = '1.1.1'

__version__ = "1.2.0"
4 changes: 2 additions & 2 deletions src/typesense/stemming_dictionaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ def _parse_response(
for line in response.split("\n"):
try:
decoded = json.loads(line)
except json.JSONDecodeError:
raise ValueError(f"Failed to parse JSON from response: {line}")
except json.JSONDecodeError as err:
raise ValueError(f"Failed to parse JSON from response: {line}") from err
object_list.append(decoded)
return object_list

Expand Down
Loading