nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 22.05 103 lines 2.2 kB view raw
1{ lib 2, buildPythonPackage 3, fetchFromGitHub 4, pydantic 5, starlette 6, pytestCheckHook 7, pytest-asyncio 8, aiosqlite 9, databases 10, fetchpatch 11, flask 12, httpx 13, passlib 14, peewee 15, python-jose 16, sqlalchemy 17, trio 18, pythonOlder 19}: 20 21buildPythonPackage rec { 22 pname = "fastapi"; 23 version = "0.75.2"; 24 format = "flit"; 25 26 disabled = pythonOlder "3.6"; 27 28 src = fetchFromGitHub { 29 owner = "tiangolo"; 30 repo = pname; 31 rev = version; 32 hash = "sha256-B4q3Q256Sj4jTQt1TDm3fiEaQKdVxddCF9+KsxkkTWo="; 33 }; 34 35 propagatedBuildInputs = [ 36 starlette 37 pydantic 38 ]; 39 40 checkInputs = [ 41 aiosqlite 42 databases 43 flask 44 httpx 45 passlib 46 peewee 47 python-jose 48 pytestCheckHook 49 pytest-asyncio 50 sqlalchemy 51 trio 52 ] ++ passlib.optional-dependencies.bcrypt; 53 54 patches = [ 55 # Bump starlette, https://github.com/tiangolo/fastapi/pull/4483 56 (fetchpatch { 57 name = "support-later-starlette.patch"; 58 # PR contains multiple commits 59 url = "https://patch-diff.githubusercontent.com/raw/tiangolo/fastapi/pull/4483.patch"; 60 sha256 = "sha256-ZWaqAd/QYEYRL1hSQdXdFPgWgdmOill2GtmEn33vz2U="; 61 }) 62 ]; 63 64 postPatch = '' 65 substituteInPlace pyproject.toml \ 66 --replace "starlette ==" "starlette >=" 67 ''; 68 69 pytestFlagsArray = [ 70 # ignoring deprecation warnings to avoid test failure from 71 # tests/test_tutorial/test_testing/test_tutorial001.py 72 "-W ignore::DeprecationWarning" 73 ]; 74 75 disabledTestPaths = [ 76 # Disabled tests require orjson which requires rust nightly 77 "tests/test_default_response_class.py" 78 # Don't test docs and examples 79 "docs_src" 80 ]; 81 82 disabledTests = [ 83 "test_get_custom_response" 84 # Failed: DID NOT RAISE <class 'starlette.websockets.WebSocketDisconnect'> 85 "test_websocket_invalid_data" 86 "test_websocket_no_credentials" 87 # TypeError: __init__() missing 1...starlette-releated 88 "test_head" 89 "test_options" 90 "test_trace" 91 ]; 92 93 pythonImportsCheck = [ 94 "fastapi" 95 ]; 96 97 meta = with lib; { 98 description = "Web framework for building APIs"; 99 homepage = "https://github.com/tiangolo/fastapi"; 100 license = licenses.mit; 101 maintainers = with maintainers; [ wd15 ]; 102 }; 103}