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