1{ lib
2, stdenv
3, buildPythonPackage
4, fetchFromGitHub
5, hatchling
6
7# runtime
8, ApplicationServices
9, anyio
10, itsdangerous
11, jinja2
12, python-multipart
13, pyyaml
14, httpx
15, typing-extensions
16
17# tests
18, pytestCheckHook
19, pythonOlder
20, trio
21}:
22
23buildPythonPackage rec {
24 pname = "starlette";
25 version = "0.31.1";
26 format = "pyproject";
27
28 disabled = pythonOlder "3.7";
29
30 src = fetchFromGitHub {
31 owner = "encode";
32 repo = pname;
33 rev = "refs/tags/${version}";
34 hash = "sha256-Tq414cEpXX8MQDR0KYyB+J7lFqorbiwP/sGnUFvs7wA=";
35 };
36
37 nativeBuildInputs = [
38 hatchling
39 ];
40
41 propagatedBuildInputs = [
42 anyio
43 itsdangerous
44 jinja2
45 python-multipart
46 pyyaml
47 httpx
48 ] ++ lib.optionals (pythonOlder "3.10") [
49 typing-extensions
50 ] ++ lib.optionals stdenv.isDarwin [
51 ApplicationServices
52 ];
53
54 nativeCheckInputs = [
55 pytestCheckHook
56 trio
57 typing-extensions
58 ];
59
60 pytestFlagsArray = [
61 "-W" "ignore::DeprecationWarning"
62 "-W" "ignore::trio.TrioDeprecationWarning"
63 ];
64
65 disabledTests = [
66 # asserts fail due to inclusion of br in Accept-Encoding
67 "test_websocket_headers"
68 "test_request_headers"
69 ];
70
71 pythonImportsCheck = [
72 "starlette"
73 ];
74
75 meta = with lib; {
76 changelog = "https://github.com/encode/starlette/releases/tag/${version}";
77 downloadPage = "https://github.com/encode/starlette";
78 homepage = "https://www.starlette.io/";
79 description = "The little ASGI framework that shines";
80 license = licenses.bsd3;
81 maintainers = with maintainers; [ wd15 ];
82 };
83}