Skip to content
Draft
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
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# 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
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ dependencies = [
"cattrs[pyyaml]<26",
"click<9",
"colorlog<7",
"hishel<0.2",
"hishel[httpx]>=1,<1.2",
"llms-txt==0.0.4",
"markdown<4",
"platformdirs<5",
Expand Down
14 changes: 7 additions & 7 deletions src/cratedb_about/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from collections import OrderedDict

import attr
import hishel
import hishel.httpx
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
Expand Down Expand Up @@ -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, a httpx client with caching.
# Configure Hishel, an httpx client with caching.
logger.info(f"Configuring cache. ttl={ttl}, path={settings.http_cache_path}")
try:
controller = hishel.Controller(allow_stale=True)
storage = hishel.SQLiteStorage(
storage = hishel.SyncSqliteStorage(
connection=sqlite3.connect(settings.http_cache_path, check_same_thread=False),
ttl=ttl,
default_ttl=ttl,
)
return hishel.CacheClient(
controller=controller, storage=storage, timeout=settings.http_timeout
return hishel.httpx.SyncCacheClient(
storage=storage,
timeout=settings.http_timeout,
)
except Exception as e:
msg = (
Expand Down
6 changes: 3 additions & 3 deletions tests/test_util.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import hishel
import hishel.httpx
import pytest

from cratedb_about.util import get_cache_client


def test_get_cache_client_valid():
client = get_cache_client()
assert isinstance(client, hishel.CacheClient)
assert isinstance(client, hishel.httpx.SyncCacheClient)


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

mocker.patch.object(hishel.CacheClient, "__init__", _raise)
mocker.patch.object(hishel.httpx.SyncCacheClient, "__init__", _raise)
with pytest.raises(Exception) as excinfo:
get_cache_client()
assert excinfo.match("Test error")
Expand Down
Loading