1{
2 lib,
3 buildPythonPackage,
4 django,
5 django-redis,
6 fetchFromGitHub,
7 pymemcache,
8 pythonOlder,
9 setuptools,
10}:
11
12buildPythonPackage rec {
13 pname = "django-ratelimit";
14 version = "4.1.0";
15 pyproject = true;
16
17 disabled = pythonOlder "3.7";
18
19 src = fetchFromGitHub {
20 owner = "jsocol";
21 repo = "django-ratelimit";
22 tag = "v${version}";
23 hash = "sha256-ZMtZSKOIIRSqH6eyC7bBeua7YLKyWW6NOXN/MDv9fy4=";
24 };
25
26 nativeBuildInputs = [
27 setuptools
28 ];
29
30 propagatedBuildInputs = [
31 django
32 django-redis
33 pymemcache
34 ];
35
36 pythonImportsCheck = [
37 "django_ratelimit"
38 ];
39
40 checkPhase = ''
41 runHook preCheck
42
43 export DJANGO_SETTINGS_MODULE=test_settings
44 python -m django test django_ratelimit
45
46 runHook postCheck
47 '';
48
49 meta = with lib; {
50 description = "Cache-based rate-limiting for Django";
51 homepage = "https://github.com/jsocol/django-ratelimit";
52 changelog = "https://github.com/jsocol/django-ratelimit/releases/tag/v${version}";
53 license = licenses.asl20;
54 maintainers = with maintainers; [ derdennisop ];
55 };
56}