summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/django-ratelimit/default.nix
blob: dfc81d829698a3802b31e194828cff6b412897da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{
  lib,
  buildPythonPackage,
  django,
  django-redis,
  fetchFromGitHub,
  pymemcache,
  setuptools,
}:

buildPythonPackage rec {
  pname = "django-ratelimit";
  version = "4.1.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "jsocol";
    repo = "django-ratelimit";
    tag = "v${version}";
    hash = "sha256-ZMtZSKOIIRSqH6eyC7bBeua7YLKyWW6NOXN/MDv9fy4=";
  };

  nativeBuildInputs = [
    setuptools
  ];

  propagatedBuildInputs = [
    django
    django-redis
    pymemcache
  ];

  pythonImportsCheck = [
    "django_ratelimit"
  ];

  checkPhase = ''
    runHook preCheck

    export DJANGO_SETTINGS_MODULE=test_settings
    python -m django test django_ratelimit

    runHook postCheck
  '';

  meta = {
    description = "Cache-based rate-limiting for Django";
    homepage = "https://github.com/jsocol/django-ratelimit";
    changelog = "https://github.com/jsocol/django-ratelimit/releases/tag/v${version}";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ derdennisop ];
  };
}