1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6 unasync,
7 poetry-core,
8 python,
9 click,
10 hiredis,
11 more-itertools,
12 pydantic,
13 python-ulid,
14 redis,
15 types-redis,
16 typing-extensions,
17 pkgs,
18 pytest-asyncio,
19 pytestCheckHook,
20}:
21
22buildPythonPackage rec {
23 pname = "redis-om";
24 version = "0.3.3";
25 pyproject = true;
26
27 disabled = pythonOlder "3.8";
28
29 src = fetchFromGitHub {
30 owner = "redis";
31 repo = "redis-om-python";
32 rev = "refs/tags/v${version}";
33 hash = "sha256-Pp404HaFpYEPie9xknoabotFrqcI2ibDlPTM+MmnMbg=";
34 };
35
36 build-system = [
37 unasync
38 poetry-core
39 ];
40
41 # it has not been maintained at all for a half year and some dependencies are outdated
42 # https://github.com/redis/redis-om-python/pull/554
43 # https://github.com/redis/redis-om-python/pull/577
44 pythonRelaxDeps = true;
45
46 dependencies = [
47 click
48 hiredis
49 more-itertools
50 pydantic
51 python-ulid
52 redis
53 types-redis
54 typing-extensions
55 ];
56
57 preBuild = ''
58 ${python.pythonOnBuildForHost.interpreter} make_sync.py
59 '';
60
61 nativeCheckInputs = [
62 pytestCheckHook
63 pytest-asyncio
64 ];
65
66 preCheck = ''
67 ${pkgs.redis}/bin/redis-server &
68 REDIS_PID=$!
69 '';
70
71 postCheck = ''
72 kill $REDIS_PID
73 '';
74
75 # probably require redisearch
76 # https://github.com/redis/redis-om-python/issues/532
77 doCheck = false;
78
79 pythonImportsCheck = [
80 "aredis_om"
81 "redis_om"
82 ];
83
84 meta = with lib; {
85 description = "Object mapping, and more, for Redis and Python";
86 mainProgram = "migrate";
87 homepage = "https://github.com/redis/redis-om-python";
88 changelog = "https://github.com/redis/redis-om-python/releases/tag/${lib.removePrefix "refs/tags/" src.rev}";
89 license = licenses.mit;
90 maintainers = with maintainers; [ natsukium ];
91 };
92}