nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 fetchFromGitHub,
4 buildPythonPackage,
5 pythonOlder,
6
7 # build-system
8 hatchling,
9
10 # dependencies
11 async-timeout,
12
13 # extras: circuit_breaker
14 pybreaker,
15
16 # extras: hiredis
17 hiredis,
18
19 # extras: jwt
20 pyjwt,
21
22 # extras: ocsp
23 cryptography,
24 pyopenssl,
25 requests,
26}:
27
28buildPythonPackage rec {
29 pname = "redis";
30 version = "7.1.0";
31 pyproject = true;
32
33 src = fetchFromGitHub {
34 owner = "redis";
35 repo = "redis-py";
36 tag = "v${version}";
37 hash = "sha256-EhhE2l0UdkGWhCwKAF7fuSxq4ooj75Cxwg2zXjJJRzA=";
38 };
39
40 build-system = [ hatchling ];
41
42 dependencies = lib.optionals (pythonOlder "3.11") [
43 async-timeout
44 ];
45
46 optional-dependencies = {
47 circuit_breaker = [ pybreaker ];
48 hiredis = [ hiredis ];
49 jwt = [ pyjwt ];
50 ocsp = [
51 cryptography
52 pyopenssl
53 requests
54 ];
55 };
56
57 pythonImportsCheck = [
58 "redis"
59 "redis.client"
60 "redis.cluster"
61 "redis.connection"
62 "redis.exceptions"
63 "redis.sentinel"
64 "redis.utils"
65 ];
66
67 # Tests require a running redis
68 doCheck = false;
69
70 meta = {
71 description = "Python client for Redis key-value store";
72 homepage = "https://github.com/redis/redis-py";
73 changelog = "https://github.com/redis/redis-py/releases/tag/${src.tag}";
74 license = lib.licenses.mit;
75 maintainers = [ lib.maintainers.dotlambda ];
76 };
77}