about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/shazamio/default.nix
blob: 7190c1e2c0ae750e87da770cf802bf99c377bd3d (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
71
72
73
74
75
76
77
78
{ lib
, buildPythonPackage
, fetchFromGitHub
, fetchpatch
, poetry-core
, wheel
, aiofiles
, aiohttp
, dataclass-factory
, numpy
, pydantic
, pydub
, ffmpeg
, pytest-asyncio
, pytestCheckHook
}:

buildPythonPackage rec {
  pname = "shazamio";
  version = "0.4.0.1";
  format = "pyproject";

  src = fetchFromGitHub {
    owner = "dotX12";
    repo = "ShazamIO";
    rev = version;
    hash = "sha256-dfrdfbGkLYNjlS6Qv9Rnywv6nqiKrNXCICLSuAXpQBU=";
  };

  patches = [
    # remove poetry and virtualenv from build dependencies as they are not used
    # https://github.com/dotX12/ShazamIO/pull/71
    (fetchpatch {
      name = "remove-unused-build-dependencies.patch";
      url = "https://github.com/dotX12/ShazamIO/commit/5c61e1efe51c2826852da5b6aa6ad8ce3d4012a9.patch";
      hash = "sha256-KiU5RVBPnSs5qrReFeTe9ePg1fR7y0NchIIHcQwlPaI=";
    })
  ];

  nativeBuildInputs = [
    poetry-core
    wheel
  ];

  propagatedBuildInputs = [
    aiofiles
    aiohttp
    dataclass-factory
    numpy
    pydantic
    pydub
  ];

  nativeCheckInputs = [
    ffmpeg
    pytest-asyncio
    pytestCheckHook
  ];

  disabledTests = [
    # requires internet access
    "test_about_artist"
    "test_recognize_song_file"
    "test_recognize_song_bytes"
  ];

  pythonImportsCheck = [ "shazamio" ];

  meta = with lib; {
    description = "A free asynchronous library from reverse engineered Shazam API";
    homepage = "https://github.com/dotX12/ShazamIO";
    changelog = "https://github.com/dotX12/ShazamIO/releases/tag/${src.rev}";
    license = licenses.mit;
    maintainers = with maintainers; [ figsoda ];
    # https://github.com/shazamio/ShazamIO/issues/80
    broken = versionAtLeast pydantic.version "2";
  };
}