1{ stdenv, buildPythonPackage, isPy27, fetchFromGitHub, itsdangerous, python-multipart
2, pytest, starlette, httpx, pytest-asyncio }:
3
4buildPythonPackage rec {
5 version = "0.7";
6 pname = "asgi-csrf";
7 disabled = isPy27;
8
9 # PyPI tarball doesn't include tests directory
10 src = fetchFromGitHub {
11 owner = "simonw";
12 repo = pname;
13 rev = version;
14 sha256 = "1vf4lh007790836cp3hd6wf8wsgj045dcg0w1cm335p08zz6j4k7";
15 };
16
17 propagatedBuildInputs = [ itsdangerous python-multipart ];
18
19 checkInputs = [ pytest starlette httpx pytest-asyncio ];
20 checkPhase = ''
21 pytest test_asgi_csrf.py
22 '';
23 pythonImportsCheck = [ "asgi_csrf" ];
24
25 meta = with stdenv.lib; {
26 description = "ASGI middleware for protecting against CSRF attacks";
27 license = licenses.asl20;
28 homepage = "https://github.com/simonw/asgi-csrf";
29 maintainers = [ maintainers.ris ];
30 };
31}