1{ stdenv, buildPythonPackage, fetchPypi, pythonAtLeast, pythonOlder
2, click
3, click-completion
4, factory_boy
5, faker
6, inquirer
7, notify-py
8, pbr
9, pendulum
10, ptable
11, pytest
12, pytestcov
13, pytest-mock
14, requests
15, twine
16, validate-email
17}:
18
19
20buildPythonPackage rec {
21 pname = "toggl-cli";
22 version = "2.2.1";
23 disabled = pythonOlder "3.5";
24
25 src = fetchPypi {
26 pname = "togglCli";
27 inherit version;
28 sha256 = "1izsxag98lvivkwf7724g2ak6icjak9jdqphaq1a79kwdnqprx1m";
29 };
30
31 postPatch = ''
32 substituteInPlace requirements.txt \
33 --replace "inquirer==2.6.3" "inquirer>=2.6.3" \
34 --replace "notify-py==0.2.2" "notify-py>=0.2.2"
35 '';
36
37 nativeBuildInputs = [ pbr twine ];
38 checkInputs = [ pbr pytest pytestcov pytest-mock faker factory_boy ];
39
40 preCheck = ''
41 export TOGGL_API_TOKEN=your_api_token
42 export TOGGL_PASSWORD=toggl_password
43 export TOGGL_USERNAME=user@example.com
44 '';
45
46 checkPhase = ''
47 runHook preCheck
48 pytest -k "not premium and not TestDateTimeType and not TestDateTimeField" tests/unit --maxfail=20
49 runHook postCheck
50 '';
51
52 propagatedBuildInputs = [
53 click
54 click-completion
55 inquirer
56 notify-py
57 pendulum
58 ptable
59 requests
60 pbr
61 validate-email
62 ];
63
64 meta = with stdenv.lib; {
65 homepage = "https://toggl.uhlir.dev/";
66 description = "Command line tool and set of Python wrapper classes for interacting with toggl's API";
67 license = licenses.mit;
68 maintainers = [ maintainers.mmahut ];
69 };
70}