@@ -0,0 +1,36 @@
1+{ stdenv
2+, buildPythonPackage
3+, fetchPypi
4+, redis
5+, pytest
6+, process-tests
7+, pkgs
8+, withDjango ? false, django_redis
9+}:
10+
11+buildPythonPackage rec {
12+ pname = "python-redis-lock";
13+ version = "3.3.1";
14+
15+ src = fetchPypi {
16+ inherit pname version;
17+ sha256 = "5316d473ce6ce86a774b9f9c110d84c3a9bd1a2abfda5d99e9c0c8a872a8e6d6";
18+ };
19+
20+ checkInputs = [ pytest process-tests pkgs.redis ];
21+
22+ checkPhase = ''
23+ pytest tests/
24+ '';
25+
26+ propagatedBuildInputs = [ redis ]
27+ ++ stdenv.lib.optional withDjango django_redis;
28+
29+
30+ meta = with stdenv.lib; {
31+ homepage = "https://github.com/ionelmc/python-redis-lock";
32+ license = licenses.bsd2;
33+ description = "Lock context manager implemented via redis SETNX/BLPOP";
34+ maintainers = with maintainers; [ vanschelven ];
35+ };
36+}