1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 charset-normalizer,
6 defusedxml,
7 fetchFromGitHub,
8 installShellFiles,
9 multidict,
10 pandoc,
11 pip,
12 pygments,
13 pytest-httpbin,
14 pytest-lazy-fixture,
15 pytest-mock,
16 pytestCheckHook,
17 requests-toolbelt,
18 requests,
19 responses,
20 rich,
21 setuptools,
22 werkzeug,
23}:
24
25buildPythonPackage rec {
26 pname = "httpie";
27 version = "3.2.4";
28 pyproject = true;
29
30 src = fetchFromGitHub {
31 owner = "httpie";
32 repo = "httpie";
33 tag = version;
34 hash = "sha256-uZKkUUrPPnLHPHL8YrZgfsyCsSOR0oZ2eFytiV0PIUY=";
35 };
36
37 pythonRelaxDeps = [
38 "defusedxml"
39 "requests"
40 ];
41
42 build-system = [ setuptools ];
43
44 nativeBuildInputs = [
45 installShellFiles
46 pandoc
47 ];
48
49 dependencies = [
50 charset-normalizer
51 defusedxml
52 multidict
53 pygments
54 requests
55 requests-toolbelt
56 setuptools
57 rich
58 ]
59 ++ requests.optional-dependencies.socks;
60
61 __darwinAllowLocalNetworking = true;
62
63 nativeCheckInputs = [
64 pip
65 pytest-httpbin
66 pytest-lazy-fixture
67 pytest-mock
68 pytestCheckHook
69 responses
70 werkzeug
71 ];
72
73 postInstall = ''
74 # install completions
75 installShellCompletion --cmd http \
76 --bash extras/httpie-completion.bash \
77 --fish extras/httpie-completion.fish
78
79 # convert the docs/README.md file
80 pandoc --standalone -f markdown -t man docs/README.md -o docs/http.1
81 installManPage docs/http.1
82 '';
83
84 enabledTestPaths = [
85 "httpie"
86 "tests"
87 ];
88
89 pythonImportsCheck = [ "httpie" ];
90
91 disabledTestPaths = [
92 # Tests are flaky
93 "tests/test_plugins_cli.py"
94 ];
95
96 disabledTests = [
97 # argparse output changed
98 "test_naked_invocation"
99 # Test is flaky
100 "test_stdin_read_warning"
101 # httpbin compatibility issues
102 "test_binary_suppresses_when_terminal"
103 "test_binary_suppresses_when_not_terminal_but_pretty"
104 "test_binary_included_and_correct_when_suitable"
105 # charset-normalizer compat issue
106 # https://github.com/httpie/cli/issues/1628
107 "test_terminal_output_response_charset_detection"
108 "test_terminal_output_request_charset_detection"
109 ]
110 ++ lib.optionals stdenv.hostPlatform.isDarwin [
111 # Test is flaky
112 "test_daemon_runner"
113 ];
114
115 meta = with lib; {
116 description = "Command line HTTP client whose goal is to make CLI human-friendly";
117 homepage = "https://httpie.org/";
118 changelog = "https://github.com/httpie/httpie/blob/${version}/CHANGELOG.md";
119 license = licenses.bsd3;
120 maintainers = with maintainers; [
121 antono
122 relrod
123 schneefux
124 ];
125 };
126}