about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/toggl-cli/default.nix
blob: 875e70cee58ed26b688eef3635d703b15fb9d495 (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
{ lib, stdenv, buildPythonPackage, fetchPypi, pythonAtLeast, pythonOlder
, click
, click-completion
, factory_boy
, faker
, inquirer
, notify-py
, pbr
, pendulum
, ptable
, pytest
, pytestcov
, pytest-mock
, requests
, twine
, validate-email
}:


buildPythonPackage rec {
  pname = "toggl-cli";
  version = "2.4.1";
  disabled = pythonOlder "3.5";

  src = fetchPypi {
    pname = "togglCli";
    inherit version;
    sha256 = "19lry8adcznzmzbvghyid3yl4j05db6931bw38af5vrkkyzyf62i";
  };

  postPatch = ''
   substituteInPlace requirements.txt \
     --replace "inquirer==2.6.3" "inquirer>=2.6.3" \
     --replace "notify-py==0.2.2" "notify-py>=0.2.2"
  '';

  nativeBuildInputs = [ pbr twine ];
  checkInputs = [ pbr pytest pytestcov pytest-mock faker factory_boy ];

  preCheck = ''
    export TOGGL_API_TOKEN=your_api_token
    export TOGGL_PASSWORD=toggl_password
    export TOGGL_USERNAME=user@example.com
    '';

  checkPhase = ''
   runHook preCheck
   pytest -k "not premium and not TestDateTimeType and not TestDateTimeField" tests/unit --maxfail=20
   runHook postCheck
  '';

  propagatedBuildInputs = [
    click
    click-completion
    inquirer
    notify-py
    pendulum
    ptable
    requests
    pbr
    validate-email
  ];

  meta = with lib; {
    homepage = "https://toggl.uhlir.dev/";
    description = "Command line tool and set of Python wrapper classes for interacting with toggl's API";
    license = licenses.mit;
    maintainers = [ maintainers.mmahut ];
  };
}