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 six,
13 pytestCheckHook,
14 pytest-mock,
15 pytest-vcr,
16 requests-mock,
17 setuptools,
18}:
19
20buildPythonPackage rec {
21 pname = "mastodon-py";
22 version = "1.8.1";
23 pyproject = true;
24
25 src = fetchFromGitHub {
26 owner = "halcy";
27 repo = "Mastodon.py";
28 rev = "refs/tags/${version}";
29 hash = "sha256-r0AAUjd2MBfZANEpyztMNyaQTlGWvWoUVjJNO1eL218=";
30 };
31
32 postPatch = ''
33 sed -i '/addopts/d' setup.cfg
34 '';
35
36 nativeBuildInputs = [ setuptools ];
37
38 propagatedBuildInputs = [
39 blurhash
40 decorator
41 python-dateutil
42 python-magic
43 requests
44 six
45 ];
46
47 passthru.optional-dependencies = {
48 blurhash = [ blurhash ];
49 webpush = [
50 http-ece
51 cryptography
52 ];
53 };
54
55 nativeCheckInputs = [
56 pytestCheckHook
57 pytest-mock
58 pytest-vcr
59 requests-mock
60 setuptools
61 ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
62
63 disabledTests = [
64 "test_notifications_dismiss_pre_2_9_2"
65 "test_status_card_pre_2_9_2"
66 "test_stream_user_direct"
67 "test_stream_user_local"
68 ];
69
70 pythonImportsCheck = [ "mastodon" ];
71
72 meta = with lib; {
73 changelog = "https://github.com/halcy/Mastodon.py/blob/${src.rev}/CHANGELOG.rst";
74 description = "Python wrapper for the Mastodon API";
75 homepage = "https://github.com/halcy/Mastodon.py";
76 license = licenses.mit;
77 maintainers = with maintainers; [ dotlambda ];
78 };
79}