at master 2.2 kB view raw
1{ 2 buildPythonPackage, 3 charset-normalizer, 4 cryptography, 5 fetchFromGitHub, 6 hatchling, 7 lib, 8 orjson, 9 pytest-asyncio, 10 pytest-httpbin, 11 pytestCheckHook, 12 stdenv, 13 urllib3-future, 14 wassima, 15}: 16 17buildPythonPackage rec { 18 pname = "niquests"; 19 version = "3.15.2"; 20 pyproject = true; 21 22 src = fetchFromGitHub { 23 owner = "jawah"; 24 repo = "niquests"; 25 tag = "v${version}"; 26 hash = "sha256-QRVefE/85k6fT0zhAzX4wFB79ANf7LUshWsbi+fpSgk="; 27 }; 28 29 build-system = [ hatchling ]; 30 31 pythonRelaxDeps = [ 32 "wassima" 33 ]; 34 35 dependencies = [ 36 charset-normalizer 37 urllib3-future 38 wassima 39 ]; 40 41 optional-dependencies = { 42 inherit (urllib3-future.optional-dependencies) 43 brotli 44 socks 45 ws 46 zstd 47 ; 48 full = [ 49 orjson 50 ] 51 ++ urllib3-future.optional-dependencies.brotli 52 ++ urllib3-future.optional-dependencies.socks 53 ++ urllib3-future.optional-dependencies.qh3 54 ++ urllib3-future.optional-dependencies.ws 55 ++ urllib3-future.optional-dependencies.zstd; 56 http3 = urllib3-future.optional-dependencies.qh3; 57 ocsp = urllib3-future.optional-dependencies.qh3; 58 speedups = [ 59 orjson 60 ] 61 ++ urllib3-future.optional-dependencies.brotli 62 ++ urllib3-future.optional-dependencies.zstd; 63 }; 64 65 pythonImportsCheck = [ "niquests" ]; 66 67 nativeCheckInputs = [ 68 cryptography 69 pytest-asyncio 70 pytest-httpbin 71 pytestCheckHook 72 ] 73 ++ optional-dependencies.socks; 74 75 disabledTestPaths = [ 76 # tests connect to the internet 77 "tests/test_requests.py" 78 ] 79 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 80 # NameResolutionError: Failed to resolve 'localhost' 81 "tests/test_lowlevel.py" 82 "tests/test_testserver.py" 83 ]; 84 85 disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [ 86 # PermissionError: [Errno 1] Operation not permitted 87 "test_use_proxy_from_environment" 88 ]; 89 90 meta = { 91 changelog = "https://github.com/jawah/niquests/blob/${src.tag}/HISTORY.md"; 92 description = "Simple HTTP library that is a drop-in replacement for Requests"; 93 homepage = "https://github.com/jawah/niquests"; 94 license = lib.licenses.asl20; 95 maintainers = with lib.maintainers; [ dotlambda ]; 96 }; 97}