mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-06-30 14:05:14 +00:00
otherwise `$out/bin/curl-cffi` fails:
> Traceback (most recent call last):
> File "/nix/store/jdi22r7swyiml492lms3ril9b45phmf9-python3.13-curl-cffi-0.15.0/bin/.curl-cffi-wrapped", line 6, in <module>
> from curl_cffi.cli import main
> File "/nix/store/jdi22r7swyiml492lms3ril9b45phmf9-python3.13-curl-cffi-0.15.0/lib/python3.13/site-packages/curl_cffi/cli/__init__.py", line 6, in <module>
> from .run import handle_run, parse_http_file # noqa: F401
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "/nix/store/jdi22r7swyiml492lms3ril9b45phmf9-python3.13-curl-cffi-0.15.0/lib/python3.13/site-packages/curl_cffi/cli/run.py", line 11, in <module>
> from .request import _execute_request
> File "/nix/store/jdi22r7swyiml492lms3ril9b45phmf9-python3.13-curl-cffi-0.15.0/lib/python3.13/site-packages/curl_cffi/cli/request.py", line 12, in <module>
> from .output import determine_print_spec, handle_download, print_output
> File "/nix/store/jdi22r7swyiml492lms3ril9b45phmf9-python3.13-curl-cffi-0.15.0/lib/python3.13/site-packages/curl_cffi/cli/output.py", line 12, in <module>
> from rich.console import Console
> ModuleNotFoundError: No module named 'rich'
`rich` was being propagated by `litestar` -- added to
`nativeCheckInputs` in 4985af20df. build with `doCheck = false` and
it's clear that upstream wants `rich` at runtime:
> Running phase: pythonRuntimeDepsCheckHook
> Executing pythonRuntimeDepsCheck
> Checking runtime dependencies for curl_cffi-0.15.0-cp310-abi3-linux_aarch64.whl
> - rich not installed
123 lines
2.6 KiB
Nix
123 lines
2.6 KiB
Nix
{
|
|
lib,
|
|
buildPythonPackage,
|
|
fetchFromGitHub,
|
|
setuptools,
|
|
addBinToPathHook,
|
|
curl-impersonate,
|
|
cffi,
|
|
certifi,
|
|
charset-normalizer,
|
|
cryptography,
|
|
fastapi,
|
|
httpx,
|
|
litestar,
|
|
proxy-py,
|
|
pytest-asyncio,
|
|
pytest-trio,
|
|
pytestCheckHook,
|
|
python-multipart,
|
|
rich,
|
|
trustme,
|
|
uvicorn,
|
|
websockets,
|
|
writableTmpDirAsHomeHook,
|
|
}:
|
|
buildPythonPackage rec {
|
|
pname = "curl-cffi";
|
|
version = "0.15.0";
|
|
pyproject = true;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "lexiforest";
|
|
repo = "curl_cffi";
|
|
tag = "v${version}";
|
|
hash = "sha256-I8rQj28IvLD7HWuog46E0dLFgnWSA6oE4Jyn9Flr7mQ=";
|
|
};
|
|
|
|
patches = [ ./use-system-libs.patch ];
|
|
|
|
buildInputs = [ curl-impersonate ];
|
|
|
|
build-system = [
|
|
cffi
|
|
setuptools
|
|
];
|
|
|
|
dependencies = [
|
|
cffi
|
|
certifi
|
|
rich
|
|
];
|
|
|
|
pythonImportsCheck = [ "curl_cffi" ];
|
|
|
|
nativeCheckInputs = [
|
|
addBinToPathHook
|
|
charset-normalizer
|
|
cryptography
|
|
fastapi
|
|
httpx
|
|
litestar
|
|
proxy-py
|
|
pytest-asyncio
|
|
pytest-trio
|
|
pytestCheckHook
|
|
python-multipart
|
|
trustme
|
|
uvicorn
|
|
websockets
|
|
writableTmpDirAsHomeHook
|
|
];
|
|
|
|
preCheck = ''
|
|
# import from $out
|
|
rm -r curl_cffi
|
|
'';
|
|
|
|
enabledTestPaths = [
|
|
"tests/unittest"
|
|
];
|
|
|
|
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::test_receive_large_messages_run_forever"
|
|
# Fails on high core-count machines (including x86_64)
|
|
"tests/unittest/test_websockets.py::on_message"
|
|
"tests/unittest/test_websockets.py::test_on_data_callback"
|
|
"tests/unittest/test_websockets.py::test_hello_twice_async"
|
|
];
|
|
|
|
disabledTests = [
|
|
# FIXME ImpersonateError: Impersonating chrome136 is not supported
|
|
"test_impersonate_without_version"
|
|
"test_with_impersonate"
|
|
# Impersonating chrome142 is not supported
|
|
"test_cli"
|
|
# InvalidURL: Invalid URL component 'path'
|
|
"test_update_params"
|
|
# tests access network
|
|
"test_add_handle"
|
|
"test_socket_action"
|
|
"test_without_impersonate"
|
|
];
|
|
|
|
__darwinAllowLocalNetworking = true;
|
|
|
|
meta = {
|
|
changelog = "https://github.com/lexiforest/curl_cffi/releases/tag/${src.tag}";
|
|
description = "Python binding for curl-impersonate via cffi";
|
|
homepage = "https://curl-cffi.readthedocs.io";
|
|
license = lib.licenses.mit;
|
|
maintainers = with lib.maintainers; [
|
|
chuangzhu
|
|
sarahec
|
|
];
|
|
};
|
|
}
|