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