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.5";
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-++vDura+7AkqM7gV12O2CRRQ1H7G5G22VHGo4OdyffU=";
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 ]
69 ++ optional-dependencies.all;
70
71 pythonImportsCheck = [ "telegram" ];
72
73 disabledTests = [
74 # Tests require network access
75 "TestAIO"
76 "TestAnimation"
77 "TestApplication"
78 "TestAudio"
79 "TestBase"
80 "TestBot"
81 "TestCallback"
82 "TestChat"
83 "TestChosenInlineResult"
84 "TestCommandHandler"
85 "TestConstants"
86 "TestContact"
87 "TestConversationHandler"
88 "TestDice"
89 "TestDict"
90 "TestDocument"
91 "TestFile"
92 "TestForceReply"
93 "TestForum"
94 "TestGame"
95 "TestGet"
96 "TestGiftsWithRequest"
97 "TestHTTP"
98 "TestInline"
99 "TestInput"
100 "TestInvoice"
101 "TestJob"
102 "TestKeyboard"
103 "TestLocation"
104 "TestMask"
105 "TestMenu"
106 "TestMessage"
107 "TestMeta"
108 "TestOrder"
109 "TestPassport"
110 "TestPhoto"
111 "TestPickle"
112 "TestPoll"
113 "TestPre"
114 "TestPrefix"
115 "TestProximity"
116 "TestReply"
117 "TestRequest"
118 "TestSend"
119 "TestSent"
120 "TestShipping"
121 "TestSlot"
122 "TestSticker"
123 "TestString"
124 "TestSuccess"
125 "TestTelegram"
126 "TestType"
127 "TestUpdate"
128 "TestUser"
129 "TestVenue"
130 "TestVideo"
131 "TestVoice"
132 "TestWeb"
133 ];
134
135 meta = with lib; {
136 description = "Python library to interface with the Telegram Bot API";
137 homepage = "https://python-telegram-bot.org";
138 changelog = "https://github.com/python-telegram-bot/python-telegram-bot/blob/${src.tag}/CHANGES.rst";
139 license = licenses.lgpl3Only;
140 maintainers = with maintainers; [
141 veprbl
142 pingiun
143 ];
144 };
145}