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.9"
python-version: "3.13"

- name: Install build dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion .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.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.10", "3.11", "3.12", "3.13"]

steps:
- name: Start Typesense
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ If your application cancels many requests, prefer [httpx2](#using-httpx2), which

## Using httpx2

The client sends requests with [httpx](https://www.python-httpx.org/) by default. On Python 3.10+ you can pass an [httpx2](https://github.com/pydantic/httpx2) client instead. httpx2 is Pydantic's maintained continuation of httpx, and it fixes a connection pool leak in httpcore ([encode/httpcore#1093](https://github.com/encode/httpcore/issues/1093)) that can leave an `AsyncClient` failing every request with `PoolTimeout` under load.
The client sends requests with [httpx](https://www.python-httpx.org/) by default. You can pass an [httpx2](https://github.com/pydantic/httpx2) client instead. httpx2 is Pydantic's maintained continuation of httpx, and it fixes a connection pool leak in httpcore ([encode/httpcore#1093](https://github.com/encode/httpcore/issues/1093)) that can leave an `AsyncClient` failing every request with `PoolTimeout` under load.

```
$ pip install "typesense[httpx2]"
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "typesense"
description = "Python client for Typesense, an open source and typo tolerant search engine."
authors = [{ name = "Typesense", email = "contact@typesense.org" }]
requires-python = ">=3.9"
requires-python = ">=3.10"
readme = "README.md"
license = { text = "Apache 2.0" }
keywords = [
Expand All @@ -15,7 +15,6 @@ classifiers = [
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
Expand All @@ -29,7 +28,7 @@ dynamic = ["version"]

[project.optional-dependencies]
# Maintained continuation of httpx; fixes the httpcore pool leak in encode/httpcore#1093.
httpx2 = ["httpx2>=2.6.0; python_version >= '3.10'"]
httpx2 = ["httpx2>=2.6.0"]

[project.urls]
Documentation = "https://typesense.org/"
Expand Down
2 changes: 1 addition & 1 deletion ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ exclude = [
line-length = 88
indent-width = 4

target-version = "py39"
target-version = "py310"

[lint]
select = ["E4", "E7", "E9", "F", "B"]
Expand Down
10 changes: 5 additions & 5 deletions src/typesense/http_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
HTTP backends the Typesense client can send requests with.

The client builds an ``httpx`` client by default. Users can pass their own client
instead, either from ``httpx`` or from ``httpx2`` (install ``typesense[httpx2]``,
Python 3.10+). ``httpx2`` is Pydantic's maintained continuation of ``httpx``. It
fixes a connection pool leak in ``httpcore`` (encode/httpcore#1093) that can leave
an async client failing every request with ``PoolTimeout``.
instead, either from ``httpx`` or from ``httpx2`` (install ``typesense[httpx2]``).
``httpx2`` is Pydantic's maintained continuation of ``httpx``. It fixes a connection
pool leak in ``httpcore`` (encode/httpcore#1093) that can leave an async client
failing every request with ``PoolTimeout``.

``httpx2`` has the same API as ``httpx`` but its own classes, so every
``isinstance`` check and ``except`` clause has to cover both packages. This module
Expand All @@ -31,7 +31,7 @@
def _import_httpx2() -> typing.Optional[ModuleType]:
"""Return the ``httpx2`` module, or ``None`` when it is not installed."""
# ``import_module`` is typed as returning a module whether or not httpx2 is
# installed; a plain ``import`` is ``Any`` to mypy when it is missing (Python 3.9).
# installed; a plain ``import`` is ``Any`` to mypy when it is missing.
try:
return importlib.import_module("httpx2")
except ImportError:
Expand Down
Loading
Loading