Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / python-modules / fastapi / default.nix
blob428cf9f8d91d1bd08a118f995d4155a7fafd7f01
1 { lib
2 , buildPythonPackage
3 , fetchFromGitHub
4 , pythonOlder
6 # build-system
7 , hatchling
9 # dependencies
10 , starlette
11 , pydantic
12 , typing-extensions
14 # tests
15 , dirty-equals
16 , flask
17 , passlib
18 , pytest-asyncio
19 , pytestCheckHook
20 , python-jose
21 , sqlalchemy
22 , trio
24 # optional-dependencies
25 , httpx
26 , jinja2
27 , python-multipart
28 , itsdangerous
29 , pyyaml
30 , ujson
31 , orjson
32 , email-validator
33 , uvicorn
36 buildPythonPackage rec {
37   pname = "fastapi";
38   version = "0.103.1";
39   format = "pyproject";
41   disabled = pythonOlder "3.7";
43   src = fetchFromGitHub {
44     owner = "tiangolo";
45     repo = pname;
46     rev = "refs/tags/${version}";
47     hash = "sha256-2J8c3S4Ca+c5bI0tyjMJArJKux9qPmu+ohqve5PhSGI=";
48   };
50   nativeBuildInputs = [
51     hatchling
52   ];
54   propagatedBuildInputs = [
55     starlette
56     pydantic
57     typing-extensions
58   ];
60   passthru.optional-dependencies.all = [
61     httpx
62     jinja2
63     python-multipart
64     itsdangerous
65     pyyaml
66     ujson
67     orjson
68     email-validator
69     uvicorn
70     # pydantic-settings
71     # pydantic-extra-types
72   ] ++ uvicorn.optional-dependencies.standard;
74   nativeCheckInputs = [
75     dirty-equals
76     flask
77     passlib
78     pytestCheckHook
79     pytest-asyncio
80     python-jose
81     trio
82     sqlalchemy
83   ] ++ passthru.optional-dependencies.all
84   ++ python-jose.optional-dependencies.cryptography;
86   pytestFlagsArray = [
87     # ignoring deprecation warnings to avoid test failure from
88     # tests/test_tutorial/test_testing/test_tutorial001.py
89     "-W ignore::DeprecationWarning"
90   ];
92   disabledTestPaths = [
93     # Disabled tests require orjson which requires rust nightly
94     "tests/test_default_response_class.py"
95     # Don't test docs and examples
96     "docs_src"
97     # databases is incompatible with SQLAlchemy 2.0
98     "tests/test_tutorial/test_async_sql_databases"
99     "tests/test_tutorial/test_sql_databases"
100   ];
102   disabledTests = [
103     "test_get_custom_response"
104     # Failed: DID NOT RAISE <class 'starlette.websockets.WebSocketDisconnect'>
105     "test_websocket_invalid_data"
106     "test_websocket_no_credentials"
107     # TypeError: __init__() missing 1...starlette-releated
108     "test_head"
109     "test_options"
110     "test_trace"
111     # Unexpected number of warnings caught
112     "test_warn_duplicate_operation_id"
113     # assert state["except"] is True
114     "test_dependency_gets_exception"
115   ];
117   pythonImportsCheck = [
118     "fastapi"
119   ];
121   meta = with lib; {
122     description = "Web framework for building APIs";
123     homepage = "https://github.com/tiangolo/fastapi";
124     license = licenses.mit;
125     maintainers = with maintainers; [ wd15 ];
126   };