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 ] ++ requests.optional-dependencies.socks;
59
60 __darwinAllowLocalNetworking = true;
61
62 nativeCheckInputs = [
63 pip
64 pytest-httpbin
65 pytest-lazy-fixture
66 pytest-mock
67 pytestCheckHook
68 responses
69 werkzeug
70 ];
71
72 postInstall = ''
73 # install completions
74 installShellCompletion --cmd http \
75 --bash extras/httpie-completion.bash \
76 --fish extras/httpie-completion.fish
77
78 # convert the docs/README.md file
79 pandoc --standalone -f markdown -t man docs/README.md -o docs/http.1
80 installManPage docs/http.1
81 '';
82
83 pytestFlagsArray = [
84 "httpie"
85 "tests"
86 ];
87
88 pythonImportsCheck = [ "httpie" ];
89
90 disabledTestPaths = [
91 # Tests are flaky
92 "tests/test_plugins_cli.py"
93 ];
94
95 disabledTests =
96 [
97 # argparse output changed
98 "test_naked_invocation"
99 # Test is flaky
100 "test_stdin_read_warning"
101 # httpbin compatibility issues
102 "test_compress_form"
103 "test_binary_suppresses_when_terminal"
104 "test_binary_suppresses_when_not_terminal_but_pretty"
105 "test_binary_included_and_correct_when_suitable"
106 ]
107 ++ lib.optionals stdenv.hostPlatform.isDarwin [
108 # Test is flaky
109 "test_daemon_runner"
110 ];
111
112 meta = with lib; {
113 description = "Command line HTTP client whose goal is to make CLI human-friendly";
114 homepage = "https://httpie.org/";
115 changelog = "https://github.com/httpie/httpie/blob/${version}/CHANGELOG.md";
116 license = licenses.bsd3;
117 maintainers = with maintainers; [
118 antono
119 relrod
120 schneefux
121 ];
122 };
123}