1{
2 lib,
3 async-timeout,
4 buildPythonPackage,
5 fetchFromGitHub,
6 flask,
7 httpcore,
8 httpx,
9 hypercorn,
10 pytest-asyncio,
11 pytest-trio,
12 pytestCheckHook,
13 python-socks,
14 pythonOlder,
15 setuptools,
16 starlette,
17 tiny-proxy,
18 trio,
19 trustme,
20 yarl,
21}:
22
23buildPythonPackage rec {
24 pname = "httpx-socks";
25 version = "0.10.0";
26 pyproject = true;
27
28 disabled = pythonOlder "3.7";
29
30 src = fetchFromGitHub {
31 owner = "romis2012";
32 repo = "httpx-socks";
33 tag = "v${version}";
34 hash = "sha256-H+A6203XMM7MaIdwtjQScyOBRJNpTx9NsSMIoov8hg8=";
35 };
36
37 build-system = [ setuptools ];
38
39 dependencies = [
40 httpx
41 httpcore
42 python-socks
43 ] ++ python-socks.optional-dependencies.asyncio;
44
45 optional-dependencies = {
46 asyncio = [ async-timeout ];
47 trio = [ trio ];
48 };
49
50 __darwinAllowLocalNetworking = true;
51
52 nativeCheckInputs = [
53 flask
54 hypercorn
55 pytest-asyncio
56 pytest-trio
57 pytestCheckHook
58 starlette
59 tiny-proxy
60 trustme
61 yarl
62 ];
63
64 pythonImportsCheck = [ "httpx_socks" ];
65
66 disabledTests = [
67 # Tests don't work in the sandbox
68 "test_proxy"
69 "test_secure_proxy"
70 ];
71
72 meta = with lib; {
73 description = "Proxy (HTTP, SOCKS) transports for httpx";
74 homepage = "https://github.com/romis2012/httpx-socks";
75 changelog = "https://github.com/romis2012/httpx-socks/releases/tag/${src.tag}";
76 license = licenses.asl20;
77 maintainers = with maintainers; [ fab ];
78 };
79}