1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 hypothesis,
6 jsonpath-ng,
7 lupa,
8 hatchling,
9 pyprobables,
10 pytest-asyncio_0,
11 pytest-mock,
12 pytestCheckHook,
13 pythonOlder,
14 redis,
15 redisTestHook,
16 sortedcontainers,
17}:
18
19buildPythonPackage rec {
20 pname = "fakeredis";
21 version = "2.30.3";
22 pyproject = true;
23
24 disabled = pythonOlder "3.9";
25
26 src = fetchFromGitHub {
27 owner = "dsoftwareinc";
28 repo = "fakeredis-py";
29 tag = "v${version}";
30 hash = "sha256-SQVLuO5cA+XO7hEBph7XGlnomTcysB3ye9jZ8sy9GAI=";
31 };
32
33 build-system = [ hatchling ];
34
35 dependencies = [
36 redis
37 sortedcontainers
38 ];
39
40 optional-dependencies = {
41 lua = [ lupa ];
42 json = [ jsonpath-ng ];
43 bf = [ pyprobables ];
44 cf = [ pyprobables ];
45 probabilistic = [ pyprobables ];
46 };
47
48 nativeCheckInputs = [
49 hypothesis
50 pytest-asyncio_0
51 pytest-mock
52 pytestCheckHook
53 redisTestHook
54 ];
55
56 pythonImportsCheck = [ "fakeredis" ];
57
58 disabledTestMarks = [ "slow" ];
59
60 disabledTests = [
61 "test_init_args" # AttributeError: module 'fakeredis' has no attribute 'FakeValkey'
62 "test_async_init_kwargs" # AttributeError: module 'fakeredis' has no attribute 'FakeAsyncValkey'"
63 ];
64
65 preCheck = ''
66 redisTestPort=6390
67 '';
68
69 meta = with lib; {
70 description = "Fake implementation of Redis API";
71 homepage = "https://github.com/dsoftwareinc/fakeredis-py";
72 changelog = "https://github.com/cunla/fakeredis-py/releases/tag/${src.tag}";
73 license = with licenses; [ bsd3 ];
74 maintainers = with maintainers; [ fab ];
75 };
76}