Skip to content

Commit 48054c1

Browse files
committed
Dependencies: Update to Hishel 1.x
1 parent 8b84312 commit 48054c1

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# About CrateDB changelog
22

33
## Unreleased
4+
- Dependencies: Updated to Hishel 1.x
45

56
## v0.0.8 - 2025-07-28
67
- Outline: Shrank llms-txt output to <200_000 input tokens

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ dependencies = [
7373
"cattrs[pyyaml]<26",
7474
"click<9",
7575
"colorlog<7",
76-
"hishel<0.2",
76+
"hishel[httpx]>=1,<1.2",
7777
"llms-txt==0.0.4",
7878
"markdown<4",
7979
"platformdirs<5",

src/cratedb_about/util.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from collections import OrderedDict
77

88
import attr
9-
import hishel
9+
import hishel.httpx
1010
from attrs import define
1111
from cattrs.preconf.json import make_converter as make_json_converter
1212
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_
6464
Return the configured cache client.
6565
https://hishel.com/
6666
"""
67-
# Configure Hishel, a httpx client with caching.
67+
# Configure Hishel, an httpx client with caching.
6868
logger.info(f"Configuring cache. ttl={ttl}, path={settings.http_cache_path}")
6969
try:
70-
controller = hishel.Controller(allow_stale=True)
71-
storage = hishel.SQLiteStorage(
70+
storage = hishel.SyncSqliteStorage(
7271
connection=sqlite3.connect(settings.http_cache_path, check_same_thread=False),
73-
ttl=ttl,
72+
default_ttl=ttl,
7473
)
75-
return hishel.CacheClient(
76-
controller=controller, storage=storage, timeout=settings.http_timeout
74+
return hishel.httpx.SyncCacheClient(
75+
storage=storage,
76+
timeout=settings.http_timeout,
7777
)
7878
except Exception as e:
7979
msg = (

tests/test_util.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
import hishel
1+
import hishel.httpx
22
import pytest
33

44
from cratedb_about.util import get_cache_client
55

66

77
def test_get_cache_client_valid():
88
client = get_cache_client()
9-
assert isinstance(client, hishel.CacheClient)
9+
assert isinstance(client, hishel.httpx.SyncCacheClient)
1010

1111

1212
def test_get_cache_client_failure(mocker, caplog):
1313
def _raise(*_args, **_kwargs):
1414
raise Exception("Test error")
1515

16-
mocker.patch.object(hishel.CacheClient, "__init__", _raise)
16+
mocker.patch.object(hishel.httpx.SyncCacheClient, "__init__", _raise)
1717
with pytest.raises(Exception) as excinfo:
1818
get_cache_client()
1919
assert excinfo.match("Test error")

0 commit comments

Comments
 (0)