From fbda82764471350bc494b856f6f37d2cc1f73ed3 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sun, 2 Nov 2025 17:15:58 +0100 Subject: [PATCH 1/2] Revert "Dependencies: Update to Hishel 1.x" This reverts commit 69c561bf6b1052a5d3b3cad07a29e182e1e81427. --- CHANGES.md | 1 - pyproject.toml | 2 +- src/cratedb_about/util.py | 14 +++++++------- tests/test_util.py | 6 +++--- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 6a10fae..af6ba8a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,7 +1,6 @@ # About CrateDB changelog ## Unreleased -- Dependencies: Updated to Hishel 1.x ## v0.0.8 - 2025-07-28 - Outline: Shrank llms-txt output to <200_000 input tokens diff --git a/pyproject.toml b/pyproject.toml index 774ef6f..c355dd4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -73,7 +73,7 @@ dependencies = [ "cattrs[pyyaml]<26", "click<9", "colorlog<7", - "hishel[httpx]>=1,<1.2", + "hishel<1.2", "llms-txt==0.0.4", "markdown<4", "platformdirs<5", diff --git a/src/cratedb_about/util.py b/src/cratedb_about/util.py index ee03739..c99a6be 100644 --- a/src/cratedb_about/util.py +++ b/src/cratedb_about/util.py @@ -6,7 +6,7 @@ from collections import OrderedDict import attr -import hishel.httpx +import hishel from attrs import define from cattrs.preconf.json import make_converter as make_json_converter from cattrs.preconf.pyyaml import make_converter as make_yaml_converter @@ -64,16 +64,16 @@ def get_cache_client(ttl: t.Optional[t.Union[int, float]] = settings.http_cache_ Return the configured cache client. https://hishel.com/ """ - # Configure Hishel, an httpx client with caching. + # Configure Hishel, a httpx client with caching. logger.info(f"Configuring cache. ttl={ttl}, path={settings.http_cache_path}") try: - storage = hishel.SyncSqliteStorage( + controller = hishel.Controller(allow_stale=True) + storage = hishel.SQLiteStorage( connection=sqlite3.connect(settings.http_cache_path, check_same_thread=False), - default_ttl=ttl, + ttl=ttl, ) - return hishel.httpx.SyncCacheClient( - storage=storage, - timeout=settings.http_timeout, + return hishel.CacheClient( + controller=controller, storage=storage, timeout=settings.http_timeout ) except Exception as e: msg = ( diff --git a/tests/test_util.py b/tests/test_util.py index d1761e7..e0a39c9 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -1,4 +1,4 @@ -import hishel.httpx +import hishel import pytest from cratedb_about.util import get_cache_client @@ -6,14 +6,14 @@ def test_get_cache_client_valid(): client = get_cache_client() - assert isinstance(client, hishel.httpx.SyncCacheClient) + assert isinstance(client, hishel.CacheClient) def test_get_cache_client_failure(mocker, caplog): def _raise(*_args, **_kwargs): raise Exception("Test error") - mocker.patch.object(hishel.httpx.SyncCacheClient, "__init__", _raise) + mocker.patch.object(hishel.CacheClient, "__init__", _raise) with pytest.raises(Exception) as excinfo: get_cache_client() assert excinfo.match("Test error") From 224a96346b81a5c05134c8f10035bb70b4aa8305 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sun, 2 Nov 2025 17:16:09 +0100 Subject: [PATCH 2/2] Revert "Update hishel requirement from <0.2 to <1.1" This reverts commit dd1c65bc38202739e3abefad16d4983fd205c468. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c355dd4..558f1b3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -73,7 +73,7 @@ dependencies = [ "cattrs[pyyaml]<26", "click<9", "colorlog<7", - "hishel<1.2", + "hishel<0.2", "llms-txt==0.0.4", "markdown<4", "platformdirs<5",