1{ lib
2, stdenv
3, buildPythonPackage
4, fetchFromGitHub
5, aiofiles
6, anyio
7, contextlib2
8, graphene
9, itsdangerous
10, jinja2
11, python-multipart
12, pyyaml
13, requests
14, aiosqlite
15, databases
16, pytest-asyncio
17, pytestCheckHook
18, pythonOlder
19, trio
20, typing-extensions
21, ApplicationServices
22}:
23
24buildPythonPackage rec {
25 pname = "starlette";
26 version = "0.16.0";
27 disabled = pythonOlder "3.6";
28
29 src = fetchFromGitHub {
30 owner = "encode";
31 repo = pname;
32 rev = version;
33 sha256 = "sha256-/NYhRRZdi6I7CtLCohAqK4prsSUayOxa6sBKIJhPv+w=";
34 };
35
36 postPatch = ''
37 # remove coverage arguments to pytest
38 sed -i '/--cov/d' setup.cfg
39 '';
40
41 propagatedBuildInputs = [
42 aiofiles
43 anyio
44 graphene
45 itsdangerous
46 jinja2
47 python-multipart
48 pyyaml
49 requests
50 ] ++ lib.optionals (pythonOlder "3.8") [
51 typing-extensions
52 ] ++ lib.optionals (pythonOlder "3.7") [
53 contextlib2
54 ] ++ lib.optional stdenv.isDarwin [
55 ApplicationServices
56 ];
57
58 checkInputs = [
59 aiosqlite
60 databases
61 pytest-asyncio
62 pytestCheckHook
63 trio
64 typing-extensions
65 ];
66
67 disabledTestPaths = [
68 # fails to import graphql, but integrated graphql support is about to
69 # be removed in 0.15, see https://github.com/encode/starlette/pull/1135.
70 "tests/test_graphql.py"
71 ];
72
73 disabledTests = [
74 # asserts fail due to inclusion of br in Accept-Encoding
75 "test_websocket_headers"
76 "test_request_headers"
77 ];
78
79 pythonImportsCheck = [ "starlette" ];
80
81 meta = with lib; {
82 homepage = "https://www.starlette.io/";
83 description = "The little ASGI framework that shines";
84 license = licenses.bsd3;
85 maintainers = with maintainers; [ wd15 ];
86 };
87}