1{
2 lib,
3 aiohttp-retry,
4 aiohttp,
5 aiounittest,
6 buildPythonPackage,
7 cryptography,
8 django,
9 fetchFromGitHub,
10 mock,
11 multidict,
12 pyjwt,
13 pyngrok,
14 pytestCheckHook,
15 pythonAtLeast,
16 pythonOlder,
17 pytz,
18 requests,
19 setuptools,
20}:
21
22buildPythonPackage rec {
23 pname = "twilio";
24 version = "9.4.1";
25 pyproject = true;
26
27 disabled = pythonOlder "3.7";
28
29 src = fetchFromGitHub {
30 owner = "twilio";
31 repo = "twilio-python";
32 rev = "refs/tags/${version}";
33 hash = "sha256-sZhKFnCmARocnOqM1NE6eGU/6UtfJSQTK+bv5HHHU1U=";
34 };
35
36 build-system = [ setuptools ];
37
38 dependencies = [
39 aiohttp
40 aiohttp-retry
41 pyjwt
42 pyngrok
43 pytz
44 requests
45 ];
46
47 nativeCheckInputs = [
48 aiounittest
49 cryptography
50 django
51 mock
52 multidict
53 pytestCheckHook
54 ];
55
56 disabledTests = [
57 # Tests require network access
58 "test_set_default_user_agent"
59 "test_set_user_agent_extensions"
60 ];
61
62 disabledTestPaths =
63 [
64 # Tests require API token
65 "tests/cluster/test_webhook.py"
66 "tests/cluster/test_cluster.py"
67 ]
68 ++ lib.optionals (pythonAtLeast "3.11") [
69 # aiounittest is not supported on Python 3.12
70 "tests/unit/http/test_async_http_client.py"
71 ];
72
73 pythonImportsCheck = [ "twilio" ];
74
75 meta = with lib; {
76 description = "Twilio API client and TwiML generator";
77 homepage = "https://github.com/twilio/twilio-python/";
78 changelog = "https://github.com/twilio/twilio-python/blob/${version}/CHANGES.md";
79 license = licenses.mit;
80 maintainers = with maintainers; [ fab ];
81 };
82}