1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, pydantic
5, starlette
6, pytestCheckHook
7, pytest-asyncio
8, aiosqlite
9, databases
10, flask
11, httpx
12, hatchling
13, orjson
14, passlib
15, peewee
16, python-jose
17, sqlalchemy
18, trio
19, pythonOlder
20}:
21
22buildPythonPackage rec {
23 pname = "fastapi";
24 version = "0.95.1";
25 format = "pyproject";
26
27 disabled = pythonOlder "3.7";
28
29 src = fetchFromGitHub {
30 owner = "tiangolo";
31 repo = pname;
32 rev = "refs/tags/${version}";
33 hash = "sha256-y6mP2w2d2oabM9bLtWRO/AdRA46LNhVrMB/0qxGxH7I=";
34 };
35
36 nativeBuildInputs = [
37 hatchling
38 ];
39
40 postPatch = ''
41 substituteInPlace pyproject.toml \
42 --replace '"databases[sqlite] >=0.3.2,<0.7.0",' "" \
43 --replace "starlette==" "starlette>="
44 '';
45
46 propagatedBuildInputs = [
47 starlette
48 pydantic
49 ];
50
51 nativeCheckInputs = [
52 aiosqlite
53 # databases FIXME incompatible with SQLAlchemy 2.0
54 flask
55 httpx
56 orjson
57 passlib
58 peewee
59 python-jose
60 pytestCheckHook
61 pytest-asyncio
62 sqlalchemy
63 trio
64 ]
65 ++ passlib.optional-dependencies.bcrypt
66 ++ pydantic.optional-dependencies.email;
67
68 pytestFlagsArray = [
69 # ignoring deprecation warnings to avoid test failure from
70 # tests/test_tutorial/test_testing/test_tutorial001.py
71 "-W ignore::DeprecationWarning"
72 ];
73
74 disabledTestPaths = [
75 # Disabled tests require orjson which requires rust nightly
76 "tests/test_default_response_class.py"
77 # Don't test docs and examples
78 "docs_src"
79 # databases is incompatible with SQLAlchemy 2.0
80 "tests/test_tutorial/test_async_sql_databases"
81 "tests/test_tutorial/test_sql_databases"
82 ];
83
84 disabledTests = [
85 "test_get_custom_response"
86 # Failed: DID NOT RAISE <class 'starlette.websockets.WebSocketDisconnect'>
87 "test_websocket_invalid_data"
88 "test_websocket_no_credentials"
89 # TypeError: __init__() missing 1...starlette-releated
90 "test_head"
91 "test_options"
92 "test_trace"
93 # Unexpected number of warnings caught
94 "test_warn_duplicate_operation_id"
95 ];
96
97 pythonImportsCheck = [
98 "fastapi"
99 ];
100
101 meta = with lib; {
102 description = "Web framework for building APIs";
103 homepage = "https://github.com/tiangolo/fastapi";
104 license = licenses.mit;
105 maintainers = with maintainers; [ wd15 ];
106 };
107}