1{ lib
2, stdenv
3, buildPythonPackage
4, fetchFromGitHub
5, installShellFiles
6, pandoc
7, pythonOlder
8# BuildInputs
9, charset-normalizer
10, defusedxml
11, multidict
12, pygments
13, requests
14, requests-toolbelt
15, setuptools
16, rich
17, pysocks
18# CheckInputs
19, pip
20, pytest-httpbin
21, pytest-lazy-fixture
22, pytest-mock
23, pytestCheckHook
24, responses
25, werkzeug
26}:
27
28buildPythonPackage rec {
29 pname = "httpie";
30 version = "3.2.2";
31 format = "setuptools";
32
33 src = fetchFromGitHub {
34 owner = "httpie";
35 repo = "httpie";
36 rev = version;
37 hash = "sha256-hPsjEpvT6tnPm68AUB2Tv3Gon4DfSzO2VYCGqP8ozSI=";
38 };
39
40 nativeBuildInputs = [
41 installShellFiles
42 pandoc
43 ];
44
45 propagatedBuildInputs = [
46 charset-normalizer
47 defusedxml
48 multidict
49 pygments
50 requests
51 requests-toolbelt
52 setuptools
53 rich
54 ] ++ requests.optional-dependencies.socks;
55
56 __darwinAllowLocalNetworking = true;
57
58 nativeCheckInputs = [
59 pip
60 pytest-httpbin
61 pytest-lazy-fixture
62 pytest-mock
63 pytestCheckHook
64 responses
65 werkzeug
66 ];
67
68 postInstall = ''
69 # install completions
70 installShellCompletion --cmd http \
71 --bash extras/httpie-completion.bash \
72 --fish extras/httpie-completion.fish
73
74 # convert the docs/README.md file
75 pandoc --standalone -f markdown -t man docs/README.md -o docs/http.1
76 installManPage docs/http.1
77 '';
78
79 pytestFlagsArray = [
80 "httpie"
81 "tests"
82 ];
83
84 pythonImportsCheck = [
85 "httpie"
86 ];
87
88 disabledTestPaths = lib.optionals stdenv.isDarwin [
89 # flaky
90 "tests/test_plugins_cli.py"
91 ];
92
93 disabledTests = [
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 ] ++ lib.optionals stdenv.isDarwin [
115 # flaky
116 "test_daemon_runner"
117 ];
118
119 meta = with lib; {
120 description = "A command line HTTP client whose goal is to make CLI human-friendly";
121 homepage = "https://httpie.org/";
122 changelog = "https://github.com/httpie/httpie/blob/${version}/CHANGELOG.md";
123 license = licenses.bsd3;
124 maintainers = with maintainers; [ antono relrod schneefux ];
125 };
126}