diff --git a/pkgs/development/python-modules/fastapi/default.nix b/pkgs/development/python-modules/fastapi/default.nix index c90b64dca811..75edf5dc424c 100644 --- a/pkgs/development/python-modules/fastapi/default.nix +++ b/pkgs/development/python-modules/fastapi/default.nix @@ -1,22 +1,28 @@ { lib , buildPythonPackage -, fetchPypi +, fetchFromGitHub , uvicorn , starlette , pydantic -, python , isPy3k -, which +, pytest +, pytestcov +, pyjwt +, passlib +, aiosqlite }: buildPythonPackage rec { pname = "fastapi"; - version = "0.42.0"; + version = "0.45.0"; + format = "flit"; disabled = !isPy3k; - src = fetchPypi { - inherit pname version; - sha256 = "48cb522c1c993e238bfe272fbb18049cbd4bf5b9d6c0d4a4fa113cc790e8196c"; + src = fetchFromGitHub { + owner = "tiangolo"; + repo = "fastapi"; + rev = version; + sha256 = "1qwh382ny6qa3zi64micdq4j7dc64zv4rfd8g91j0digd4rhs6i1"; }; propagatedBuildInputs = [ @@ -25,10 +31,24 @@ buildPythonPackage rec { pydantic ]; - patches = [ ./setup.py.patch ]; + checkInputs = [ + pytest + pytestcov + pyjwt + passlib + aiosqlite + ]; + + # starlette pinning kept in place due to 0.12.9 being a hard + # dependency luckily fastapi is currently the only dependent on + # starlette. Please remove pinning when possible + postPatch = '' + substituteInPlace pyproject.toml \ + --replace "pydantic >=0.32.2,<=0.32.2" "pydantic" + ''; checkPhase = '' - ${python.interpreter} -c "from fastapi import FastAPI; app = FastAPI()" + pytest --ignore=tests/test_default_response_class.py ''; meta = with lib; { diff --git a/pkgs/development/python-modules/fastapi/setup.py.patch b/pkgs/development/python-modules/fastapi/setup.py.patch deleted file mode 100644 index 43661343d744..000000000000 --- a/pkgs/development/python-modules/fastapi/setup.py.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/setup.py b/setup.py -index ccc3d2b..77ce446 100644 ---- a/setup.py -+++ b/setup.py -@@ -10,7 +10,7 @@ package_data = \ - {'': ['*']} - - install_requires = \ --['starlette >=0.11.1,<=0.12.0', 'pydantic >=0.30,<=0.30.0'] -+['starlette >=0.11.1', 'pydantic >=0.30'] - - extras_require = \ - {'all': ['requests',