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.1";
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-1NDsIKJ8lWpjaTnlv5DrwTsEJU4gYwEUuqKpn+2QVhg=";
35 };
36
37 build-system = [ setuptools ];
38
39 dependencies = [
40 httpx
41 httpcore
42 python-socks
43 ]
44 ++ python-socks.optional-dependencies.asyncio;
45
46 optional-dependencies = {
47 asyncio = [ async-timeout ];
48 trio = [ trio ];
49 };
50
51 __darwinAllowLocalNetworking = true;
52
53 nativeCheckInputs = [
54 flask
55 hypercorn
56 pytest-asyncio
57 pytest-trio
58 pytestCheckHook
59 starlette
60 tiny-proxy
61 trustme
62 yarl
63 ];
64
65 pythonImportsCheck = [ "httpx_socks" ];
66
67 disabledTests = [
68 # Tests don't work in the sandbox
69 "test_proxy"
70 "test_secure_proxy"
71 ];
72
73 meta = with lib; {
74 description = "Proxy (HTTP, SOCKS) transports for httpx";
75 homepage = "https://github.com/romis2012/httpx-socks";
76 changelog = "https://github.com/romis2012/httpx-socks/releases/tag/${src.tag}";
77 license = licenses.asl20;
78 maintainers = with maintainers; [ fab ];
79 };
80}