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