1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch2,
6 pytest-asyncio,
7 pytest-httpserver,
8 pytestCheckHook,
9 pythonOlder,
10 pyyaml,
11 requests,
12 setuptools,
13 tomli,
14 tomli-w,
15 types-pyyaml,
16 types-toml,
17 urllib3,
18}:
19
20buildPythonPackage rec {
21 pname = "responses";
22 version = "0.25.0";
23 pyproject = true;
24
25 disabled = pythonOlder "3.8";
26
27 __darwinAllowLocalNetworking = true;
28
29 src = fetchFromGitHub {
30 owner = "getsentry";
31 repo = pname;
32 rev = "refs/tags/${version}";
33 hash = "sha256-FHtuZ6NUmCveAJOXEajfTLRMR8W1Jz/pjFKdE6PHW2g=";
34 };
35
36 patches = [
37 (fetchpatch2 {
38 # adds missing pytest asyncio markers
39 url = "https://github.com/getsentry/responses/commit/d5e7402f1782692d04742562370abaca8d54a972.patch";
40 hash = "sha256-A/DYSKvuangolkcQX4k/uom//AQ9in7BsTmVtlCqmXQ=";
41 })
42 ];
43
44 nativeBuildInputs = [ setuptools ];
45
46 propagatedBuildInputs = [
47 pyyaml
48 requests
49 types-pyyaml
50 types-toml
51 urllib3
52 ];
53
54 nativeCheckInputs = [
55 pytest-asyncio
56 pytest-httpserver
57 pytestCheckHook
58 tomli-w
59 ] ++ lib.optionals (pythonOlder "3.11") [ tomli ];
60
61 pythonImportsCheck = [ "responses" ];
62
63 meta = with lib; {
64 description = "Python module for mocking out the requests Python library";
65 homepage = "https://github.com/getsentry/responses";
66 changelog = "https://github.com/getsentry/responses/blob/${version}/CHANGES";
67 license = licenses.asl20;
68 maintainers = with maintainers; [ fab ];
69 };
70}