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