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