summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/asgi-csrf/default.nix
blob: f3ec2670d6f8100bcadf59a23c40cd6fbaace32b (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
54
55
56
57
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,

  # build-system
  setuptools,

  # dependencies
  itsdangerous,
  python-multipart,

  # tests
  asgi-lifespan,
  pytestCheckHook,
  starlette,
  httpx,
  pytest-asyncio,
}:

buildPythonPackage rec {
  pname = "asgi-csrf";
  version = "0.11";
  pyproject = true;

  # PyPI tarball doesn't include tests directory
  src = fetchFromGitHub {
    owner = "simonw";
    repo = "asgi-csrf";
    tag = version;
    hash = "sha256-STitMWabAPz61AU+5gFJSHBBqf67Q8UtS6ks8Q/ZybY=";
  };

  build-system = [ setuptools ];

  dependencies = [
    itsdangerous
    python-multipart
  ];

  nativeCheckInputs = [
    asgi-lifespan
    httpx
    pytest-asyncio
    pytestCheckHook
    starlette
  ];

  pythonImportsCheck = [ "asgi_csrf" ];

  meta = {
    description = "ASGI middleware for protecting against CSRF attacks";
    license = lib.licenses.asl20;
    homepage = "https://github.com/simonw/asgi-csrf";
    maintainers = [ lib.maintainers.ris ];
  };
}