1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, fetchpatch
5, filetype
6, future
7, hypothesis
8, pytestCheckHook
9, pythonOlder
10, requests
11, requests-oauthlib
12, responses
13}:
14
15buildPythonPackage rec {
16 pname = "python-twitter";
17 version = "3.5";
18 format = "setuptools";
19
20 disabled = pythonOlder "3.7";
21
22 src = fetchFromGitHub {
23 owner = "bear";
24 repo = pname;
25 rev = "v${version}";
26 sha256 = "08ydmf6dcd416cvw6xq1wxsz6b9s21f2mf9fh3y4qz9swj6n9h8z";
27 };
28
29 patches = [
30 # Fix tests. Remove with the next release
31 (fetchpatch {
32 url = "https://github.com/bear/python-twitter/commit/f7eb83d9dca3ba0ee93e629ba5322732f99a3a30.patch";
33 sha256 = "008b1bd03wwngs554qb136lsasihql3yi7vlcacmk4s5fmr6klqw";
34 })
35 ];
36
37 propagatedBuildInputs = [
38 filetype
39 future
40 requests
41 requests-oauthlib
42 ];
43
44 nativeCheckInputs = [
45 pytestCheckHook
46 responses
47 hypothesis
48 ];
49
50 postPatch = ''
51 substituteInPlace setup.py \
52 --replace "'pytest-runner'" ""
53 '';
54
55 pythonImportsCheck = [
56 "twitter"
57 ];
58
59 meta = with lib; {
60 description = "Python wrapper around the Twitter API";
61 homepage = "https://github.com/bear/python-twitter";
62 license = licenses.asl20;
63 maintainers = [ maintainers.marsam ];
64 };
65}