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