summary refs log tree commit diff
path: root/pkgs/development/python-modules/httpie/default.nix
blob: 22b6918bccc919274aa2d342fc80755dfba92614 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
{ lib
, stdenv
, buildPythonPackage
, fetchFromGitHub
, installShellFiles
, pandoc
, pythonOlder
# BuildInputs
, charset-normalizer
, defusedxml
, multidict
, pygments
, requests
, requests-toolbelt
, setuptools
, rich
, pysocks
# CheckInputs
, pip
, pytest-httpbin
, pytest-lazy-fixture
, pytest-mock
, pytestCheckHook
, responses
, werkzeug
}:

buildPythonPackage rec {
  pname = "httpie";
  version = "3.2.2";
  format = "setuptools";

  src = fetchFromGitHub {
    owner = "httpie";
    repo = "httpie";
    rev = version;
    hash = "sha256-hPsjEpvT6tnPm68AUB2Tv3Gon4DfSzO2VYCGqP8ozSI=";
  };

  nativeBuildInputs = [
    installShellFiles
    pandoc
  ];

  propagatedBuildInputs = [
    charset-normalizer
    defusedxml
    multidict
    pygments
    requests
    requests-toolbelt
    setuptools
    rich
  ] ++ requests.optional-dependencies.socks;

  __darwinAllowLocalNetworking = true;

  nativeCheckInputs = [
    pip
    pytest-httpbin
    pytest-lazy-fixture
    pytest-mock
    pytestCheckHook
    responses
    werkzeug
  ];

  postInstall = ''
    # install completions
    installShellCompletion --cmd http \
      --bash extras/httpie-completion.bash \
      --fish extras/httpie-completion.fish

    # convert the docs/README.md file
    pandoc --standalone -f markdown -t man docs/README.md -o docs/http.1
    installManPage docs/http.1
  '';

  pytestFlagsArray = [
    "httpie"
    "tests"
  ];

  pythonImportsCheck = [
    "httpie"
  ];

  disabledTestPaths = lib.optionals stdenv.isDarwin [
    # flaky
    "tests/test_plugins_cli.py"
  ];

  disabledTests = [
    # flaky
    "test_stdin_read_warning"
    # Re-evaluate those tests with the next release
    "test_duplicate_keys_support_from_response"
    "test_invalid_xml"
    "test_json_formatter_with_body_preceded_by_non_json_data"
    "test_pretty_options_with_and_without_stream_with_converter"
    "test_response_mime_overwrite"
    "test_terminal_output_response_charset_detection"
    "test_terminal_output_response_charset_override"
    "test_terminal_output_response_content_type_charset_with_stream"
    "test_terminal_output_response_content_type_charset"
    "test_valid_xml"
    "test_xml_format_options"
    "test_xml_xhtm"
  ] ++ lib.optionals stdenv.isDarwin [
    # flaky
    "test_daemon_runner"
  ];

  meta = with lib; {
    description = "A command line HTTP client whose goal is to make CLI human-friendly";
    homepage = "https://httpie.org/";
    changelog = "https://github.com/httpie/httpie/blob/${version}/CHANGELOG.md";
    license = licenses.bsd3;
    maintainers = with maintainers; [ antono relrod schneefux ];
  };
}