1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 setuptools,
8
9 # dependencies
10 itsdangerous,
11 python-multipart,
12
13 # tests
14 asgi-lifespan,
15 pytestCheckHook,
16 starlette,
17 httpx,
18 pytest-asyncio,
19}:
20
21buildPythonPackage rec {
22 pname = "asgi-csrf";
23 version = "0.11";
24 pyproject = true;
25
26 # PyPI tarball doesn't include tests directory
27 src = fetchFromGitHub {
28 owner = "simonw";
29 repo = "asgi-csrf";
30 tag = version;
31 hash = "sha256-STitMWabAPz61AU+5gFJSHBBqf67Q8UtS6ks8Q/ZybY=";
32 };
33
34 build-system = [ setuptools ];
35
36 dependencies = [
37 itsdangerous
38 python-multipart
39 ];
40
41 nativeCheckInputs = [
42 asgi-lifespan
43 httpx
44 pytest-asyncio
45 pytestCheckHook
46 starlette
47 ];
48
49 pythonImportsCheck = [ "asgi_csrf" ];
50
51 meta = with lib; {
52 description = "ASGI middleware for protecting against CSRF attacks";
53 license = licenses.asl20;
54 homepage = "https://github.com/simonw/asgi-csrf";
55 maintainers = [ maintainers.ris ];
56 };
57}