From 6a4715fd1afdcf2e36ef074f86ab05cb02ae855c Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sat, 17 Aug 2024 11:59:30 +0200 Subject: [PATCH 1/3] python312Packages.torch-pitch-shift: refactor - fix build --- .../torch-pitch-shift/default.nix | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/pkgs/development/python-modules/torch-pitch-shift/default.nix b/pkgs/development/python-modules/torch-pitch-shift/default.nix index f6d35338dad8..910b65c6363a 100644 --- a/pkgs/development/python-modules/torch-pitch-shift/default.nix +++ b/pkgs/development/python-modules/torch-pitch-shift/default.nix @@ -3,11 +3,11 @@ buildPythonPackage, fetchFromGitHub, setuptools, - wheel, packaging, primepy, torch, torchaudio, + pythonOlder, }: buildPythonPackage rec { @@ -15,30 +15,35 @@ buildPythonPackage rec { version = "1.2.4"; pyproject = true; + disabled = pythonOlder "3.8"; + src = fetchFromGitHub { owner = "KentoNishi"; repo = "torch-pitch-shift"; - rev = "v${version}"; + rev = "refs/tags/v${version}"; hash = "sha256-s3z+6jOGC7RfF9TzVZ9HFbIFz2BsBm6Yhx7lgaEKv6o="; }; - nativeBuildInputs = [ - setuptools - wheel - ]; + pythonRelaxDeps = [ "torchaudio" ]; - propagatedBuildInputs = [ + build-system = [ setuptools ]; + + dependencies = [ packaging primepy torch torchaudio ]; + # Module has no tests + doCheck = false; + pythonImportsCheck = [ "torch_pitch_shift" ]; meta = with lib; { description = "Pitch-shift audio clips quickly with PyTorch (CUDA supported)! Additional utilities for searching efficient transformations are included"; homepage = "https://github.com/KentoNishi/torch-pitch-shift"; + changelog = "https://github.com/KentoNishi/torch-pitch-shift/releases/tag/v${version}"; license = licenses.mit; maintainers = with maintainers; [ matthewcroughan ]; }; From 3c70aa8423432ca728eb27c2c22361e45a768764 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sat, 17 Aug 2024 16:19:32 +0200 Subject: [PATCH 2/3] python312Packages.torch-audiomentations: refactor - enable tests --- .../torch-audiomentations/default.nix | 35 ++++++++++++++----- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/pkgs/development/python-modules/torch-audiomentations/default.nix b/pkgs/development/python-modules/torch-audiomentations/default.nix index 2a9985ce91b4..7a4205268e3e 100644 --- a/pkgs/development/python-modules/torch-audiomentations/default.nix +++ b/pkgs/development/python-modules/torch-audiomentations/default.nix @@ -2,13 +2,15 @@ lib, buildPythonPackage, fetchFromGitHub, - setuptools, - wheel, julius, librosa, + pytest-cov-stub, + pytestCheckHook, + pythonOlder, + setuptools, + torch-pitch-shift, torch, torchaudio, - torch-pitch-shift, }: buildPythonPackage rec { @@ -16,6 +18,8 @@ buildPythonPackage rec { version = "0.11.1"; pyproject = true; + disabled = pythonOlder "3.8"; + src = fetchFromGitHub { owner = "asteroid-team"; repo = "torch-audiomentations"; @@ -23,7 +27,11 @@ buildPythonPackage rec { hash = "sha256-0+5wc+mP4c221q6mdaqPalfumTOtdnkjnIPtLErOp9E="; }; - propagatedBuildInputs = [ + pythonRelaxDeps = [ "torchaudio" ]; + + build-system = [ setuptools ]; + + dependencies = [ julius librosa torch @@ -31,16 +39,27 @@ buildPythonPackage rec { torch-pitch-shift ]; - nativeBuildInputs = [ - setuptools - wheel + nativeCheckInputs = [ + pytest-cov-stub + pytestCheckHook ]; pythonImportsCheck = [ "torch_audiomentations" ]; + disabledTestPaths = [ + # librosa issues + "tests/test_mix.py" + "tests/test_convolution.py" + "tests/test_impulse_response.py" + "tests/test_background_noise.py" + ]; + + disabledTests = [ "test_transform_is_differentiable" ]; + meta = with lib; { - description = "Fast audio data augmentation in PyTorch. Inspired by audiomentations. Useful for deep learning"; + description = "Fast audio data augmentation in PyTorch"; homepage = "https://github.com/asteroid-team/torch-audiomentations"; + changelog = "https://github.com/asteroid-team/torch-audiomentations/releases/tag/v${version}"; license = licenses.mit; maintainers = with maintainers; [ matthewcroughan ]; }; From af9f6622b8668a45db98c98147483d84e69e224f Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sat, 17 Aug 2024 16:58:55 +0200 Subject: [PATCH 3/3] python312Packages.pyannote-audio: refactor --- .../python-modules/pyannote-audio/default.nix | 38 ++++++++++++------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/pkgs/development/python-modules/pyannote-audio/default.nix b/pkgs/development/python-modules/pyannote-audio/default.nix index 7507b56528e0..3a3ee228bcc8 100644 --- a/pkgs/development/python-modules/pyannote-audio/default.nix +++ b/pkgs/development/python-modules/pyannote-audio/default.nix @@ -1,30 +1,32 @@ { lib, - buildPythonPackage, - fetchFromGitHub, - setuptools, - wheel, asteroid-filterbanks, + buildPythonPackage, einops, + fetchFromGitHub, huggingface-hub, - pytorch-lightning, + hydra-core, + numpy, omegaconf, pyannote-core, pyannote-database, pyannote-metrics, pyannote-pipeline, + pyscaffold, + pythonOlder, + pytorch-lightning, pytorch-metric-learning, rich, semver, + setuptools, soundfile, speechbrain, tensorboardx, - torch, torch-audiomentations, + torch, torchaudio, torchmetrics, - numpy, - pyscaffold, + typer, }: buildPythonPackage rec { @@ -32,6 +34,8 @@ buildPythonPackage rec { version = "3.3.0"; pyproject = true; + disabled = pythonOlder "3.9"; + src = fetchFromGitHub { owner = "pyannote"; repo = "pyannote-audio"; @@ -40,20 +44,21 @@ buildPythonPackage rec { fetchSubmodules = true; }; - nativeBuildInputs = [ + pythonRelaxDeps = [ "torchaudio" ]; + + build-system = [ pyscaffold setuptools - wheel ]; postPatch = '' substituteInPlace setup.cfg \ - --replace "pyscaffold>=3.2a0,<3.3a0" "pyscaffold" + --replace-fail "pyscaffold>=3.2a0,<3.3a0" "pyscaffold" substituteInPlace requirements.txt \ - --replace "lightning" "pytorch-lightning" + --replace-fail "lightning" "pytorch-lightning" ''; - propagatedBuildInputs = [ + dependencies = [ asteroid-filterbanks einops huggingface-hub @@ -76,6 +81,13 @@ buildPythonPackage rec { pytorch-lightning ]; + optional-dependencies = { + cli = [ + hydra-core + typer + ]; + }; + pythonImportsCheck = [ "pyannote.audio" ]; meta = with lib; {