1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6 poetry-core,
7 jsonschema,
8 peewee,
9 platformdirs,
10 iso8601,
11 rfc3339-validator,
12 strict-rfc3339,
13 tomlkit,
14 deprecation,
15 timeslot,
16 pytestCheckHook,
17 gitUpdater,
18}:
19
20buildPythonPackage rec {
21 pname = "aw-core";
22 version = "0.5.17";
23
24 format = "pyproject";
25
26 # pypi distribution doesn't include tests, so build from source instead
27 src = fetchFromGitHub {
28 owner = "ActivityWatch";
29 repo = "aw-core";
30 rev = "v${version}";
31 sha256 = "sha256-bKxf+fqm+6V3JgDluKVpqq5hRL3Z+x8SHMRQmNe8vUA=";
32 };
33
34 disabled = pythonOlder "3.8";
35
36 nativeBuildInputs = [
37 poetry-core
38 ];
39
40 propagatedBuildInputs = [
41 jsonschema
42 peewee
43 platformdirs
44 iso8601
45 rfc3339-validator
46 strict-rfc3339
47 tomlkit
48 deprecation
49 timeslot
50 ];
51
52 pythonRelaxDeps = [
53 "platformdirs"
54 ];
55
56 nativeCheckInputs = [ pytestCheckHook ];
57
58 preCheck = ''
59 # Fake home folder for tests that write to $HOME
60 export HOME="$TMPDIR"
61 '';
62
63 pythonImportsCheck = [ "aw_core" ];
64
65 passthru.updateScript = gitUpdater { rev-prefix = "v"; };
66
67 meta = {
68 description = "Core library for ActivityWatch";
69 mainProgram = "aw-cli";
70 homepage = "https://github.com/ActivityWatch/aw-core";
71 maintainers = with lib.maintainers; [ huantian ];
72 license = lib.licenses.mpl20;
73 };
74}