1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 blurhash,
6 cryptography,
7 decorator,
8 http-ece,
9 python-dateutil,
10 python-magic,
11 requests,
12 pytestCheckHook,
13 pytest-cov-stub,
14 pytest-mock,
15 pytest-vcr,
16 requests-mock,
17 setuptools,
18}:
19
20buildPythonPackage rec {
21 pname = "mastodon-py";
22 version = "2.0.1";
23 pyproject = true;
24
25 src = fetchFromGitHub {
26 owner = "halcy";
27 repo = "Mastodon.py";
28 tag = "v${version}";
29 hash = "sha256-Sqvn7IIzkGnIjMGek1QS4pLXI+LoKykJsVnr/X1QH7U=";
30 };
31
32 build-system = [ setuptools ];
33
34 dependencies = [
35 blurhash
36 decorator
37 python-dateutil
38 python-magic
39 requests
40 ];
41
42 optional-dependencies = {
43 blurhash = [ blurhash ];
44 webpush = [
45 http-ece
46 cryptography
47 ];
48 };
49
50 nativeCheckInputs = [
51 pytestCheckHook
52 pytest-cov-stub
53 pytest-mock
54 pytest-vcr
55 requests-mock
56 ]
57 ++ lib.flatten (builtins.attrValues optional-dependencies);
58
59 disabledTests = [
60 "test_notifications_dismiss_pre_2_9_2"
61 "test_status_card_pre_2_9_2"
62 "test_stream_user_direct"
63 "test_stream_user_local"
64 ];
65
66 pythonImportsCheck = [ "mastodon" ];
67
68 meta = with lib; {
69 changelog = "https://github.com/halcy/Mastodon.py/blob/${src.tag}/CHANGELOG.rst";
70 description = "Python wrapper for the Mastodon API";
71 homepage = "https://github.com/halcy/Mastodon.py";
72 license = licenses.mit;
73 maintainers = with maintainers; [ dotlambda ];
74 };
75}