1{ lib
2, buildPythonPackage
3, callPackage
4, fetchFromGitHub
5, asgiref
6, click
7, colorama
8, h11
9, httptools
10, python-dotenv
11, pyyaml
12, typing-extensions
13, uvloop
14, watchgod
15, websockets
16, wsproto
17, pythonOlder
18}:
19
20buildPythonPackage rec {
21 pname = "uvicorn";
22 version = "0.14.0";
23 disabled = pythonOlder "3.6";
24
25 src = fetchFromGitHub {
26 owner = "encode";
27 repo = pname;
28 rev = version;
29 sha256 = "164x92k3rs47ihkmwq5av396576dxp4rzv6557pwgc1ign2ikqy1";
30 };
31
32 outputs = [
33 "out"
34 "testsout"
35 ];
36
37 propagatedBuildInputs = [
38 asgiref
39 click
40 colorama
41 h11
42 httptools
43 python-dotenv
44 pyyaml
45 uvloop
46 watchgod
47 websockets
48 wsproto
49 ] ++ lib.optionals (pythonOlder "3.8") [
50 typing-extensions
51 ];
52
53 postInstall = ''
54 mkdir $testsout
55 cp -R tests $testsout/tests
56 '';
57
58 pythonImportsCheck = [
59 "uvicorn"
60 ];
61
62 # check in passthru.tests.pytest to escape infinite recursion with httpx/httpcore
63 doCheck = false;
64
65 passthru.tests = {
66 pytest = callPackage ./tests.nix { };
67 };
68
69 meta = with lib; {
70 homepage = "https://www.uvicorn.org/";
71 description = "The lightning-fast ASGI server";
72 license = licenses.bsd3;
73 maintainers = with maintainers; [ wd15 ];
74 };
75}