2020-04-24 23:36:52 +00:00
|
|
|
{ lib
|
2022-02-10 20:34:41 +00:00
|
|
|
, async_generator
|
2020-04-24 23:36:52 +00:00
|
|
|
, buildPythonPackage
|
2020-11-03 02:18:15 +00:00
|
|
|
, pythonOlder
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, certifi
|
2021-09-18 10:52:07 +00:00
|
|
|
, charset-normalizer
|
2020-09-25 04:45:31 +00:00
|
|
|
, httpcore
|
2020-04-24 23:36:52 +00:00
|
|
|
, rfc3986
|
|
|
|
, sniffio
|
2022-05-18 14:49:53 +00:00
|
|
|
, h2
|
|
|
|
, socksio
|
|
|
|
, isPyPy
|
|
|
|
, brotli
|
|
|
|
, brotlicffi
|
|
|
|
, click
|
|
|
|
, rich
|
|
|
|
, pygments
|
2021-12-26 17:43:05 +00:00
|
|
|
, python
|
2020-11-03 02:18:15 +00:00
|
|
|
, pytestCheckHook
|
2020-09-25 04:45:31 +00:00
|
|
|
, pytest-asyncio
|
|
|
|
, pytest-trio
|
2021-08-05 21:33:18 +00:00
|
|
|
, typing-extensions
|
2020-04-24 23:36:52 +00:00
|
|
|
, trustme
|
|
|
|
, uvicorn
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "httpx";
|
2022-04-15 01:41:22 +00:00
|
|
|
version = "0.22.0";
|
2022-02-10 20:34:41 +00:00
|
|
|
format = "setuptools";
|
|
|
|
|
2020-11-03 02:18:15 +00:00
|
|
|
disabled = pythonOlder "3.6";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "encode";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2022-04-15 01:41:22 +00:00
|
|
|
sha256 = "sha256-hQmQodGpVG23IZSsWV7rB1iB6QAudDao/8YshIgpmas=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
certifi
|
2021-09-18 10:52:07 +00:00
|
|
|
charset-normalizer
|
2020-09-25 04:45:31 +00:00
|
|
|
httpcore
|
2020-04-24 23:36:52 +00:00
|
|
|
rfc3986
|
|
|
|
sniffio
|
2022-02-10 20:34:41 +00:00
|
|
|
] ++ lib.optionals (pythonOlder "3.7") [
|
|
|
|
async_generator
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
passthru.extras-require = {
|
|
|
|
http2 = [ h2 ];
|
|
|
|
socks = [ socksio ];
|
|
|
|
brotli = if isPyPy then [ brotlicffi ] else [ brotli ];
|
|
|
|
cli = [ click rich pygments ];
|
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
checkInputs = [
|
2020-11-03 02:18:15 +00:00
|
|
|
pytestCheckHook
|
2020-09-25 04:45:31 +00:00
|
|
|
pytest-asyncio
|
|
|
|
pytest-trio
|
2020-04-24 23:36:52 +00:00
|
|
|
trustme
|
2021-08-05 21:33:18 +00:00
|
|
|
typing-extensions
|
2020-04-24 23:36:52 +00:00
|
|
|
uvicorn
|
2022-05-18 14:49:53 +00:00
|
|
|
] ++ passthru.extras-require.http2
|
|
|
|
++ passthru.extras-require.brotli
|
|
|
|
++ passthru.extras-require.socks;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.py \
|
|
|
|
--replace "rfc3986[idna2008]>=1.3,<2" "rfc3986>=1.3"
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-26 17:43:05 +00:00
|
|
|
# testsuite wants to find installed packages for testing entrypoint
|
|
|
|
preCheck = ''
|
|
|
|
export PYTHONPATH=$out/${python.sitePackages}:$PYTHONPATH
|
|
|
|
'';
|
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
pytestFlagsArray = [
|
|
|
|
"-W"
|
|
|
|
"ignore::DeprecationWarning"
|
|
|
|
];
|
|
|
|
|
2020-11-03 02:18:15 +00:00
|
|
|
disabledTests = [
|
|
|
|
# httpcore.ConnectError: [Errno 101] Network is unreachable
|
|
|
|
"test_connect_timeout"
|
|
|
|
# httpcore.ConnectError: [Errno -2] Name or service not known
|
|
|
|
"test_async_proxy_close"
|
|
|
|
"test_sync_proxy_close"
|
2021-12-26 17:43:05 +00:00
|
|
|
# sensitive to charset_normalizer output
|
|
|
|
"iso-8859-1"
|
|
|
|
"test_response_no_charset_with_iso_8859_1_content"
|
|
|
|
];
|
|
|
|
|
|
|
|
disabledTestPaths = [
|
|
|
|
"tests/test_main.py"
|
2020-11-03 02:18:15 +00:00
|
|
|
];
|
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"httpx"
|
|
|
|
];
|
|
|
|
|
2021-01-09 10:05:03 +00:00
|
|
|
__darwinAllowLocalNetworking = true;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "The next generation HTTP client";
|
|
|
|
homepage = "https://github.com/encode/httpx";
|
|
|
|
license = licenses.bsd3;
|
2021-08-05 21:33:18 +00:00
|
|
|
maintainers = with maintainers; [ costrouc fab ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|