1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6 poetry-core,
7 wheel,
8 aiofiles,
9 aiohttp,
10 dataclass-factory,
11 numpy,
12 pydantic,
13 pydub,
14 ffmpeg,
15 pytest-asyncio,
16 pytestCheckHook,
17}:
18
19buildPythonPackage rec {
20 pname = "shazamio";
21 version = "0.8.1";
22 format = "pyproject";
23
24 src = fetchFromGitHub {
25 owner = "dotX12";
26 repo = "ShazamIO";
27 tag = version;
28 hash = "sha256-beEEr9Y8w0XlC/0+mNL/oWscmnfwt9KChlZ7Ullyk3E=";
29 };
30
31 patches = [
32 # remove poetry and virtualenv from build dependencies as they are not used
33 # https://github.com/dotX12/ShazamIO/pull/71
34 (fetchpatch {
35 name = "remove-unused-build-dependencies.patch";
36 url = "https://github.com/dotX12/ShazamIO/commit/5c61e1efe51c2826852da5b6aa6ad8ce3d4012a9.patch";
37 hash = "sha256-KiU5RVBPnSs5qrReFeTe9ePg1fR7y0NchIIHcQwlPaI=";
38 })
39 ];
40
41 nativeBuildInputs = [
42 poetry-core
43 wheel
44 ];
45
46 propagatedBuildInputs = [
47 aiofiles
48 aiohttp
49 dataclass-factory
50 numpy
51 pydantic
52 pydub
53 ];
54
55 nativeCheckInputs = [
56 ffmpeg
57 pytest-asyncio
58 pytestCheckHook
59 ];
60
61 disabledTests = [
62 # requires internet access
63 "test_about_artist"
64 "test_recognize_song_file"
65 "test_recognize_song_bytes"
66 ];
67
68 pythonImportsCheck = [ "shazamio" ];
69
70 meta = with lib; {
71 description = "Free asynchronous library from reverse engineered Shazam API";
72 homepage = "https://github.com/dotX12/ShazamIO";
73 changelog = "https://github.com/dotX12/ShazamIO/releases/tag/${src.tag}";
74 license = licenses.mit;
75 maintainers = with maintainers; [ figsoda ];
76 # https://github.com/shazamio/ShazamIO/issues/80
77 broken = versionAtLeast pydantic.version "2";
78 };
79}