1{
2 lib,
3 anysqlite,
4 boto3,
5 buildPythonPackage,
6 fetchFromGitHub,
7 hatch-fancy-pypi-readme,
8 hatchling,
9 httpx,
10 moto,
11 pytest-asyncio,
12 pytestCheckHook,
13 pythonOlder,
14 pyyaml,
15 redis,
16 trio,
17}:
18
19buildPythonPackage rec {
20 pname = "hishel";
21 version = "0.0.26";
22 pyproject = true;
23
24 disabled = pythonOlder "3.8";
25
26 src = fetchFromGitHub {
27 owner = "karpetrosyan";
28 repo = "hishel";
29 rev = "refs/tags/${version}";
30 hash = "sha256-+HjVxcTbY9nRj2938fqguOXuTM3XzJWccx0J6RK2h4A=";
31 };
32
33 build-system = [
34 hatch-fancy-pypi-readme
35 hatchling
36 ];
37
38 dependencies = [ httpx ];
39
40 passthru.optional-dependencies = {
41 redis = [ redis ];
42 s3 = [ boto3 ];
43 sqlite = [ anysqlite ];
44 yaml = [ pyyaml ];
45 };
46
47 nativeCheckInputs = [
48 moto
49 pytest-asyncio
50 pytestCheckHook
51 trio
52 ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
53
54 pythonImportsCheck = [ "hishel" ];
55
56 disabledTests = [
57 # Tests require a running Redis instance
58 "test_redis"
59 ];
60
61 disabledTestPaths = [
62 # ImportError: cannot import name 'mock_s3' from 'moto'
63 "tests/_async/test_storages.py"
64 "tests/_sync/test_storages.py"
65 ];
66
67 meta = with lib; {
68 description = "HTTP Cache implementation for HTTPX and HTTP Core";
69 homepage = "https://github.com/karpetrosyan/hishel";
70 changelog = "https://github.com/karpetrosyan/hishel/blob/${version}/CHANGELOG.md";
71 license = licenses.bsd3;
72 maintainers = with maintainers; [ fab ];
73 };
74}