1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6 poetry-core,
7 aw-core,
8 requests,
9 persist-queue,
10 click,
11 tabulate,
12 typing-extensions,
13 pytestCheckHook,
14 gitUpdater,
15}:
16
17buildPythonPackage rec {
18 pname = "aw-client";
19 version = "0.5.13";
20
21 format = "pyproject";
22
23 # pypi distribution doesn't include tests, so build from source instead
24 src = fetchFromGitHub {
25 owner = "ActivityWatch";
26 repo = "aw-client";
27 rev = "v${version}";
28 sha256 = "sha256-A9f1Wj4F6qRvCVj3iRQvsnILewJK1L5tfI2MnAXZ4nY=";
29 };
30
31 disabled = pythonOlder "3.8";
32
33 nativeBuildInputs = [ poetry-core ];
34
35 propagatedBuildInputs = [
36 aw-core
37 requests
38 persist-queue
39 click
40 tabulate
41 typing-extensions
42 ];
43
44 nativeCheckInputs = [ pytestCheckHook ];
45
46 # Only run this test, the others are integration tests that require
47 # an instance of aw-server running in order to function.
48 pytestFlagsArray = [ "tests/test_requestqueue.py" ];
49
50 preCheck = ''
51 # Fake home folder for tests that write to $HOME
52 export HOME="$TMPDIR"
53 '';
54
55 pythonImportsCheck = [ "aw_client" ];
56
57 passthru.updateScript = gitUpdater { rev-prefix = "v"; };
58
59 meta = with lib; {
60 description = "Client library for ActivityWatch";
61 mainProgram = "aw-client";
62 homepage = "https://github.com/ActivityWatch/aw-client";
63 maintainers = with maintainers; [ huantian ];
64 license = licenses.mpl20;
65 };
66}