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.1.3";
22 pyproject = true;
23
24 disabled = pythonOlder "3.9";
25
26 src = fetchFromGitHub {
27 owner = "karpetrosyan";
28 repo = "hishel";
29 tag = version;
30 hash = "sha256-3dcXj9MPPtHBzafdccrOeh+Wrn9hulDA8L3itOe8ZXw=";
31 };
32
33 build-system = [
34 hatch-fancy-pypi-readme
35 hatchling
36 ];
37
38 dependencies = [ httpx ];
39
40 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 ]
53 ++ lib.flatten (builtins.attrValues optional-dependencies);
54
55 pythonImportsCheck = [ "hishel" ];
56
57 disabledTests = [
58 # Tests require a running Redis instance
59 "test_redis"
60 ];
61
62 disabledTestPaths = [
63 # ImportError: cannot import name 'mock_s3' from 'moto'
64 "tests/_async/test_storages.py"
65 "tests/_sync/test_storages.py"
66 ];
67
68 meta = with lib; {
69 description = "HTTP Cache implementation for HTTPX and HTTP Core";
70 homepage = "https://github.com/karpetrosyan/hishel";
71 changelog = "https://github.com/karpetrosyan/hishel/blob/${src.tag}/CHANGELOG.md";
72 license = licenses.bsd3;
73 maintainers = with maintainers; [ fab ];
74 };
75}