summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/troi/default.nix
blob: 32367c46f5390d922f89233885d7df90b19ec154 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  setuptools,
  setuptools-scm,
  click,
  lb-matching-tools,
  liblistenbrainz,
  more-itertools,
  mutagen,
  peewee,
  psycopg2-binary,
  py-sonic,
  python-dateutil,
  regex,
  requests,
  scikit-learn,
  spotipy,
  tqdm,
  ujson,
  unidecode,
  pytestCheckHook,
  requests-mock,
}:

buildPythonPackage rec {
  pname = "troi";
  version = "2025.08.06.3";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "metabrainz";
    repo = "troi-recommendation-playground";
    tag = "v${version}";
    hash = "sha256-qLnXaNb1Kon+XPJYCPe31EgXpukIfzTa+LADOzFjE9Q=";
  };

  build-system = [
    setuptools
    setuptools-scm
  ];

  pythonRelaxDeps = [ "mutagen" ];
  pythonRemoveDeps = [
    # It's not used anywhere in the code.
    # TODO: Remove in next update. See <https://github.com/metabrainz/troi-recommendation-playground/pull/179>
    "countryinfo"
  ];

  dependencies = [
    click
    lb-matching-tools
    liblistenbrainz
    more-itertools
    mutagen
    peewee
    psycopg2-binary
    py-sonic
    python-dateutil
    regex
    requests
    scikit-learn
    spotipy
    tqdm
    ujson
    unidecode
  ];

  optional-dependencies = {
    # Not packaged yet.
    # nmslib = [ "nmslib-metabrainz" ];
  };

  nativeCheckInputs = [
    pytestCheckHook
    requests-mock
  ];

  pythonImportsCheck = [ "troi" ];

  meta = {
    description = "ListenBrainz' empathic music recommendation/playlisting engine";
    homepage = "https://github.com/metabrainz/troi-recommendation-playground";
    changelog = "https://github.com/metabrainz/troi-recommendation-playground/releases/tag/${src.tag}";
    license = lib.licenses.gpl2Only;
    teams = [ lib.teams.ngi ];
  };
}