2020-04-24 23:36:52 +00:00
|
|
|
{ lib
|
2022-10-21 18:38:19 +00:00
|
|
|
, stdenv
|
2022-06-26 10:26:21 +00:00
|
|
|
, brotli
|
|
|
|
, brotlicffi
|
2020-04-24 23:36:52 +00:00
|
|
|
, buildPythonPackage
|
|
|
|
, certifi
|
2022-06-26 10:26:21 +00:00
|
|
|
, chardet
|
|
|
|
, click
|
|
|
|
, fetchFromGitHub
|
2022-05-18 14:49:53 +00:00
|
|
|
, h2
|
2022-12-17 10:02:37 +00:00
|
|
|
, hatch-fancy-pypi-readme
|
|
|
|
, hatchling
|
2022-06-26 10:26:21 +00:00
|
|
|
, httpcore
|
2022-05-18 14:49:53 +00:00
|
|
|
, isPyPy
|
2022-12-17 10:02:37 +00:00
|
|
|
, multipart
|
2022-05-18 14:49:53 +00:00
|
|
|
, pygments
|
2021-12-26 17:43:05 +00:00
|
|
|
, python
|
2022-06-26 10:26:21 +00:00
|
|
|
, pythonOlder
|
|
|
|
, rfc3986
|
|
|
|
, rich
|
|
|
|
, sniffio
|
|
|
|
, socksio
|
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
|
|
|
|
, uvicorn
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "httpx";
|
2022-12-17 10:02:37 +00:00
|
|
|
version = "0.23.1";
|
|
|
|
format = "pyproject";
|
2022-02-10 20:34:41 +00:00
|
|
|
|
2022-06-26 10:26:21 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "encode";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2022-12-17 10:02:37 +00:00
|
|
|
hash = "sha256-1gRBHbGFUkaFvVgHHoXfpo9j0L074SyevFwMY202+uk=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
hatch-fancy-pypi-readme
|
|
|
|
hatchling
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
certifi
|
2020-09-25 04:45:31 +00:00
|
|
|
httpcore
|
2020-04-24 23:36:52 +00:00
|
|
|
rfc3986
|
|
|
|
sniffio
|
|
|
|
];
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
passthru.optional-dependencies = {
|
2022-06-26 10:26:21 +00:00
|
|
|
http2 = [
|
|
|
|
h2
|
|
|
|
];
|
|
|
|
socks = [
|
|
|
|
socksio
|
|
|
|
];
|
|
|
|
brotli = if isPyPy then [
|
|
|
|
brotlicffi
|
|
|
|
] else [
|
|
|
|
brotli
|
|
|
|
];
|
|
|
|
cli = [
|
|
|
|
click
|
|
|
|
rich
|
|
|
|
pygments
|
|
|
|
];
|
2022-05-18 14:49:53 +00:00
|
|
|
};
|
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
# trustme uses pyopenssl
|
|
|
|
doCheck = !(stdenv.isDarwin && stdenv.isAarch64);
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2022-06-26 10:26:21 +00:00
|
|
|
chardet
|
2022-12-17 10:02:37 +00:00
|
|
|
multipart
|
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
|
|
|
|
uvicorn
|
2022-06-16 17:23:12 +00:00
|
|
|
] ++ passthru.optional-dependencies.http2
|
|
|
|
++ passthru.optional-dependencies.brotli
|
|
|
|
++ passthru.optional-dependencies.socks;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
postPatch = ''
|
2022-12-17 10:02:37 +00:00
|
|
|
substituteInPlace pyproject.toml \
|
2022-02-10 20:34:41 +00:00
|
|
|
--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
|
|
|
];
|
|
|
|
|
|
|
|
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; {
|
2022-12-17 10:02:37 +00:00
|
|
|
changelog = "https://github.com/encode/httpx/blob/${src.rev}/CHANGELOG.md";
|
2020-04-24 23:36:52 +00:00
|
|
|
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
|
|
|
};
|
|
|
|
}
|