diff --git a/pkgs/development/python-modules/dataclass-factory/default.nix b/pkgs/development/python-modules/dataclass-factory/default.nix new file mode 100644 index 000000000000..28caa864d456 --- /dev/null +++ b/pkgs/development/python-modules/dataclass-factory/default.nix @@ -0,0 +1,45 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, nose2 +, typing-extensions +}: + +buildPythonPackage rec { + pname = "dataclass-factory"; + version = "2.13"; + format = "setuptools"; + + src = fetchFromGitHub { + owner = "reagento"; + repo = "dataclass-factory"; + rev = version; + hash = "sha256-hNPuqs3TvDleIxflCW5rutbXjDotFRLCNJlcTBFxFAw="; + }; + + nativeCheckInputs = [ + nose2 + ]; + + checkInputs = [ + typing-extensions + ]; + + pythonImportsCheck = [ "dataclass_factory" ]; + + checkPhase = '' + runHook preCheck + + nose2 -v tests + + runHook postCheck + ''; + + meta = with lib; { + description = "Modern way to convert python dataclasses or other objects to and from more common types like dicts or json-like structures"; + homepage = "https://github.com/reagento/dataclass-factory"; + changelog = "https://github.com/reagento/dataclass-factory/releases/tag/${src.rev}"; + license = licenses.asl20; + maintainers = with maintainers; [ figsoda ]; + }; +} diff --git a/pkgs/development/python-modules/shazamio/default.nix b/pkgs/development/python-modules/shazamio/default.nix new file mode 100644 index 000000000000..ee1616f7b775 --- /dev/null +++ b/pkgs/development/python-modules/shazamio/default.nix @@ -0,0 +1,76 @@ +{ 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 ]; + }; +} diff --git a/pkgs/tools/audio/shaq/default.nix b/pkgs/tools/audio/shaq/default.nix new file mode 100644 index 000000000000..a7072ece0ff5 --- /dev/null +++ b/pkgs/tools/audio/shaq/default.nix @@ -0,0 +1,64 @@ +{ lib +, python3 +, fetchFromGitHub +, ffmpeg +}: + +python3.pkgs.buildPythonApplication rec { + pname = "shaq"; + version = "0.0.1"; + format = "pyproject"; + + src = fetchFromGitHub { + owner = "woodruffw"; + repo = "shaq"; + rev = "v${version}"; + hash = "sha256-RF606Aeskqbx94H5ivd+RJ+Hk0iYsds/PUY8TZqirs4="; + }; + + nativeBuildInputs = [ + python3.pkgs.flit-core + ]; + + propagatedBuildInputs = with python3.pkgs; [ + pyaudio + pydub + rich + shazamio + ]; + + passthru.optional-dependencies = with python3.pkgs; { + dev = [ + build + shaq + ]; + lint = [ + black + mypy + ruff + ]; + test = [ + pretend + pytest + pytest-cov + ]; + }; + + pythonImportsCheck = [ "shaq" ]; + + makeWrapperArgs = [ + "--prefix" + "PATH" + ":" + (lib.makeBinPath [ ffmpeg ]) + ]; + + meta = with lib; { + description = "A CLI client for Shazam"; + homepage = "https://github.com/woodruffw/shaq"; + changelog = "https://github.com/woodruffw/shaq/releases/tag/${src.rev}"; + license = licenses.mit; + maintainers = with maintainers; [ figsoda mig4ng ]; + mainProgram = "shaq"; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b18f2e140bc6..9d69b32eb3e0 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -25140,6 +25140,8 @@ with pkgs; inherit (skawarePackages) cleanPackaging; }; + shaq = callPackage ../tools/audio/shaq { }; + slang = callPackage ../development/libraries/slang { }; slibGuile = callPackage ../development/libraries/slib { diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 04914a09a073..6bc33c124921 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -2479,6 +2479,8 @@ self: super: with self; { databricks-sql-connector = callPackage ../development/python-modules/databricks-sql-connector { }; + dataclass-factory = callPackage ../development/python-modules/dataclass-factory { }; + dataclass-wizard = callPackage ../development/python-modules/dataclass-wizard { }; dataclasses-json = callPackage ../development/python-modules/dataclasses-json { }; @@ -11716,6 +11718,8 @@ self: super: with self; { sharkiq = callPackage ../development/python-modules/sharkiq { }; + shazamio = callPackage ../development/python-modules/shazamio { }; + sh = callPackage ../development/python-modules/sh { }; shlib = callPackage ../development/python-modules/shlib { };