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