summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/aw-client/default.nix
blob: 9b76949dc1a0dcab5b0245b5f24a40bcbd60732d (plain)
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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  poetry-core,
  aw-core,
  requests,
  persist-queue,
  click,
  tabulate,
  typing-extensions,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "aw-client";
  version = "0.5.15";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "ActivityWatch";
    repo = "aw-client";
    tag = "v${version}";
    hash = "sha256-AS29DIfEQ6/vh8idcMMQoGmiRM8MMf3eVQzvNPsXgpA=";
  };

  build-system = [ poetry-core ];

  dependencies = [
    aw-core
    requests
    persist-queue
    click
    tabulate
    typing-extensions
  ];

  nativeCheckInputs = [ pytestCheckHook ];

  # Only run this test, the others are integration tests that require
  # an instance of aw-server running in order to function.
  enabledTestPaths = [ "tests/test_requestqueue.py" ];

  preCheck = ''
    # Fake home folder for tests that write to $HOME
    export HOME="$TMPDIR"
  '';

  pythonImportsCheck = [ "aw_client" ];

  meta = {
    description = "Client library for ActivityWatch";
    homepage = "https://github.com/ActivityWatch/aw-client";
    changelog = "https://github.com/ActivityWatch/aw-client/releases/tag/v${version}";
    license = lib.licenses.mpl20;
    maintainers = with lib.maintainers; [ huantian ];
    mainProgram = "aw-client";
  };
}