summary refs log tree commit diff
path: root/pkgs/development/python-modules/mastodon-py/default.nix
blob: 5034346b9cfe3dcef91fe75d02749dfee54d4af8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
{ lib
, buildPythonPackage
, fetchFromGitHub
, blurhash
, cryptography
, decorator
, http-ece
, python-dateutil
, python-magic
, requests
, six
, pytestCheckHook
, pytest-mock
, pytest-vcr
, requests-mock
, setuptools
}:

buildPythonPackage rec {
  pname = "mastodon-py";
  version = "1.8.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "halcy";
    repo = "Mastodon.py";
    rev = "refs/tags/${version}";
    hash = "sha256-r0AAUjd2MBfZANEpyztMNyaQTlGWvWoUVjJNO1eL218=";
  };

  postPatch = ''
    sed -i '/addopts/d' setup.cfg
  '';

  nativeBuildInputs = [
    setuptools
  ];

  propagatedBuildInputs = [
    blurhash
    decorator
    python-dateutil
    python-magic
    requests
    six
  ];

  passthru.optional-dependencies = {
    blurhash = [
      blurhash
    ];
    webpush = [
      http-ece
      cryptography
    ];
  };

  nativeCheckInputs = [
    pytestCheckHook
    pytest-mock
    pytest-vcr
    requests-mock
    setuptools
  ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);

  disabledTests = [
    "test_notifications_dismiss_pre_2_9_2"
    "test_status_card_pre_2_9_2"
    "test_stream_user_direct"
    "test_stream_user_local"
  ];

  pythonImportsCheck = [ "mastodon" ];

  meta = with lib; {
    changelog = "https://github.com/halcy/Mastodon.py/blob/${src.rev}/CHANGELOG.rst";
    description = "Python wrapper for the Mastodon API";
    homepage = "https://github.com/halcy/Mastodon.py";
    license = licenses.mit;
    maintainers = with maintainers; [ dotlambda ];
  };
}