nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 118 lines 2.6 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 setuptools, 6 addBinToPathHook, 7 curl-impersonate, 8 cffi, 9 certifi, 10 charset-normalizer, 11 cryptography, 12 fastapi, 13 httpx, 14 proxy-py, 15 pytest-asyncio, 16 pytest-trio, 17 pytestCheckHook, 18 python-multipart, 19 trustme, 20 uvicorn, 21 websockets, 22 writableTmpDirAsHomeHook, 23}: 24buildPythonPackage rec { 25 pname = "curl-cffi"; 26 version = "0.14.0"; 27 pyproject = true; 28 29 src = fetchFromGitHub { 30 owner = "lexiforest"; 31 repo = "curl_cffi"; 32 tag = "v${version}"; 33 hash = "sha256-5Q9oHAOjefihxj6xU1UGVTl6Ib31XqhrxLtOgI5VABs="; 34 }; 35 36 patches = [ ./use-system-libs.patch ]; 37 38 buildInputs = [ curl-impersonate ]; 39 40 build-system = [ 41 cffi 42 setuptools 43 ]; 44 45 dependencies = [ 46 cffi 47 certifi 48 ]; 49 50 pythonImportsCheck = [ "curl_cffi" ]; 51 52 nativeCheckInputs = [ 53 addBinToPathHook 54 charset-normalizer 55 cryptography 56 fastapi 57 httpx 58 proxy-py 59 pytest-asyncio 60 pytest-trio 61 pytestCheckHook 62 python-multipart 63 trustme 64 uvicorn 65 websockets 66 writableTmpDirAsHomeHook 67 ]; 68 69 preCheck = '' 70 # import from $out 71 rm -r curl_cffi 72 ''; 73 74 enabledTestPaths = [ 75 "tests/unittest" 76 ]; 77 78 disabledTestPaths = [ 79 # test accesses network 80 "tests/unittest/test_smoke.py::test_async" 81 # Hangs the build (possibly forever) under websockets > 12 82 # https://github.com/lexiforest/curl_cffi/issues/657 83 "tests/unittest/test_websockets.py::test_websocket" 84 # Runs out of memory while testing 85 "tests/unittest/test_websockets.py::test_receive_large_messages_run_forever" 86 # Fails on high core-count machines (including x86_64) 87 "tests/unittest/test_websockets.py::on_message" 88 "tests/unittest/test_websockets.py::test_on_data_callback" 89 "tests/unittest/test_websockets.py::test_hello_twice_async" 90 ]; 91 92 disabledTests = [ 93 # FIXME ImpersonateError: Impersonating chrome136 is not supported 94 "test_impersonate_without_version" 95 "test_with_impersonate" 96 # Impersonating chrome142 is not supported 97 "test_cli" 98 # InvalidURL: Invalid URL component 'path' 99 "test_update_params" 100 # tests access network 101 "test_add_handle" 102 "test_socket_action" 103 "test_without_impersonate" 104 ]; 105 106 __darwinAllowLocalNetworking = true; 107 108 meta = { 109 changelog = "https://github.com/lexiforest/curl_cffi/releases/tag/${src.tag}"; 110 description = "Python binding for curl-impersonate via cffi"; 111 homepage = "https://curl-cffi.readthedocs.io"; 112 license = lib.licenses.mit; 113 maintainers = with lib.maintainers; [ 114 chuangzhu 115 sarahec 116 ]; 117 }; 118}