diff --git a/pkgs/development/python-modules/curl-cffi/default.nix b/pkgs/development/python-modules/curl-cffi/default.nix index ac1eb455aa11..310fd84f70ad 100644 --- a/pkgs/development/python-modules/curl-cffi/default.nix +++ b/pkgs/development/python-modules/curl-cffi/default.nix @@ -1,5 +1,4 @@ { - stdenv, lib, buildPythonPackage, fetchFromGitHub, @@ -19,10 +18,30 @@ python-multipart, trustme, uvicorn, - websockets, writableTmpDirAsHomeHook, }: +let + # This is only used for testing and requires 12.0 specifically + # due to incompatible API changes in later versions. + websockets = buildPythonPackage rec { + pname = "websockets"; + version = "12.0"; + pyproject = true; + src = fetchFromGitHub { + owner = "aaugustin"; + repo = "websockets"; + tag = version; + hash = "sha256-sOL3VI9Ib/PncZs5KN4dAIHOrBc7LfXqT15LO4M6qKg="; + }; + + build-system = [ setuptools ]; + + doCheck = false; + + pythonImportsCheck = [ "websockets" ]; + }; +in buildPythonPackage rec { pname = "curl-cffi"; version = "0.14.0b2"; @@ -36,6 +55,7 @@ buildPythonPackage rec { }; patches = [ ./use-system-libs.patch ]; + buildInputs = [ curl-impersonate-chrome ]; build-system = [ @@ -79,8 +99,11 @@ buildPythonPackage rec { disabledTestPaths = [ # test accesses network "tests/unittest/test_smoke.py::test_async" + # Hangs the build (possibly forever) under websockets > 12 + # https://github.com/lexiforest/curl_cffi/issues/657 + "tests/unittest/test_websockets.py::test_websocket" # Runs out of memory while testing - "tests/unittest/test_websockets.py" + "tests/unittest/test_websockets.py::test_receive_large_messages_run_forever" ]; disabledTests = [ @@ -102,6 +125,9 @@ buildPythonPackage rec { description = "Python binding for curl-impersonate via cffi"; homepage = "https://curl-cffi.readthedocs.io"; license = lib.licenses.mit; - maintainers = with lib.maintainers; [ chuangzhu ]; + maintainers = with lib.maintainers; [ + chuangzhu + sarahec + ]; }; }