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.26.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-/zYqYmmCcOLU8Di9b4BzDLFtB5wYEEF1bYN6u2rb8Lg=";
35 };
36
37 nativeBuildInputs = [
38 hatchling
39 ];
40
41 postPatch = ''
42 # remove coverage arguments to pytest
43 sed -i '/--cov/d' setup.cfg
44 '';
45
46 propagatedBuildInputs = [
47 anyio
48 itsdangerous
49 jinja2
50 python-multipart
51 pyyaml
52 httpx
53 ] ++ lib.optionals (pythonOlder "3.10") [
54 typing-extensions
55 ] ++ lib.optionals stdenv.isDarwin [
56 ApplicationServices
57 ];
58
59 nativeCheckInputs = [
60 pytestCheckHook
61 trio
62 typing-extensions
63 ];
64
65 pytestFlagsArray = [
66 "-W" "ignore::DeprecationWarning"
67 "-W" "ignore::trio.TrioDeprecationWarning"
68 ];
69
70 disabledTests = [
71 # asserts fail due to inclusion of br in Accept-Encoding
72 "test_websocket_headers"
73 "test_request_headers"
74 ];
75
76 pythonImportsCheck = [
77 "starlette"
78 ];
79
80 meta = with lib; {
81 changelog = "https://github.com/encode/starlette/releases/tag/${version}";
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}