about summary refs log tree commit diff
path: root/pkgs/development/python-modules/httpie/default.nix
blob: 86b4e4e51224f40e2bb5a7fff6b3ce3345e18680 (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,
  charset-normalizer,
  defusedxml,
  fetchFromGitHub,
  installShellFiles,
  multidict,
  pandoc,
  pip,
  pygments,
  pytest-httpbin,
  pytest-lazy-fixture,
  pytest-mock,
  pytestCheckHook,
  requests-toolbelt,
  requests,
  responses,
  rich,
  setuptools,
  werkzeug,
}:

buildPythonPackage rec {
  pname = "httpie";
  version = "3.2.3";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "httpie";
    repo = "httpie";
    rev = "refs/tags/${version}";
    hash = "sha256-ogUqhMVY1fm+hKCMFYqfYsqHX+Gj6y8CMOUsxA3q29g=";
  };

  pythonRelaxDeps = [
    "defusedxml"
    "requests"
  ];

  build-system = [ setuptools ];

  nativeBuildInputs = [
    installShellFiles
    pandoc
  ];

  dependencies = [
    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 = [
    # Tests are flaky
    "tests/test_plugins_cli.py"
  ];

  disabledTests =
    [
      # Test is flaky
      "test_stdin_read_warning"
      # httpbin compatibility issues
      "test_compress_form"
      "test_binary_suppresses_when_terminal"
      "test_binary_suppresses_when_not_terminal_but_pretty"
      "test_binary_included_and_correct_when_suitable"
    ]
    ++ lib.optionals stdenv.hostPlatform.isDarwin [
      # Test is flaky
      "test_daemon_runner"
    ];

  meta = with lib; {
    description = "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
    ];
  };
}