1{
2 lib,
3 aiolimiter,
4 apscheduler,
5 beautifulsoup4,
6 buildPythonPackage,
7 cachetools,
8 cffi,
9 cryptography,
10 fetchFromGitHub,
11 flaky,
12 hatchling,
13 httpx,
14 pytest-asyncio,
15 pytest-timeout,
16 pytest-xdist,
17 pytestCheckHook,
18 pythonAtLeast,
19 pythonOlder,
20 pytz,
21 setuptools,
22 tornado,
23}:
24
25buildPythonPackage rec {
26 pname = "python-telegram-bot";
27 version = "22.0";
28 pyproject = true;
29
30 disabled = pythonOlder "3.8";
31
32 src = fetchFromGitHub {
33 owner = "python-telegram-bot";
34 repo = "python-telegram-bot";
35 tag = "v${version}";
36 hash = "sha256-/8sWlq2f71B3Y2fAsdluGqW5I07KNfFmqtXtk+7crE4=";
37 };
38
39 build-system = [
40 setuptools
41 hatchling
42 ];
43
44 dependencies = [ httpx ];
45
46 optional-dependencies = rec {
47 all = ext ++ http2 ++ passport ++ socks;
48 callback-data = [ cachetools ];
49 ext = callback-data ++ job-queue ++ rate-limiter ++ webhooks;
50 http2 = httpx.optional-dependencies.http2;
51 job-queue = [
52 apscheduler
53 pytz
54 ];
55 passport = [ cryptography ] ++ lib.optionals (pythonAtLeast "3.13") [ cffi ];
56 rate-limiter = [ aiolimiter ];
57 socks = httpx.optional-dependencies.socks;
58 webhooks = [ tornado ];
59 };
60
61 nativeCheckInputs = [
62 beautifulsoup4
63 flaky
64 pytest-asyncio
65 pytest-timeout
66 pytest-xdist
67 pytestCheckHook
68 ] ++ optional-dependencies.all;
69
70 pythonImportsCheck = [ "telegram" ];
71
72 disabledTests = [
73 # Tests require network access
74 "TestAIO"
75 "TestAnimation"
76 "TestApplication"
77 "TestAudio"
78 "TestBase"
79 "TestBot"
80 "TestCallback"
81 "TestChat"
82 "TestChosenInlineResult"
83 "TestCommandHandler"
84 "TestConstants"
85 "TestContact"
86 "TestConversationHandler"
87 "TestDice"
88 "TestDict"
89 "TestDocument"
90 "TestFile"
91 "TestForceReply"
92 "TestForum"
93 "TestGame"
94 "TestGet"
95 "TestGiftsWithRequest"
96 "TestHTTP"
97 "TestInline"
98 "TestInput"
99 "TestInvoice"
100 "TestJob"
101 "TestKeyboard"
102 "TestLocation"
103 "TestMask"
104 "TestMenu"
105 "TestMessage"
106 "TestMeta"
107 "TestOrder"
108 "TestPassport"
109 "TestPhoto"
110 "TestPickle"
111 "TestPoll"
112 "TestPre"
113 "TestPrefix"
114 "TestProximity"
115 "TestReply"
116 "TestRequest"
117 "TestSend"
118 "TestSent"
119 "TestShipping"
120 "TestSlot"
121 "TestSticker"
122 "TestString"
123 "TestSuccess"
124 "TestTelegram"
125 "TestType"
126 "TestUpdate"
127 "TestUser"
128 "TestVenue"
129 "TestVideo"
130 "TestVoice"
131 "TestWeb"
132 ];
133
134 meta = with lib; {
135 description = "Python library to interface with the Telegram Bot API";
136 homepage = "https://python-telegram-bot.org";
137 changelog = "https://github.com/python-telegram-bot/python-telegram-bot/blob/${src.tag}/CHANGES.rst";
138 license = licenses.lgpl3Only;
139 maintainers = with maintainers; [
140 veprbl
141 pingiun
142 ];
143 };
144}