python3Packages.speechrecognition: add optional dependencies

This commit is contained in:
jopejoe1 2024-08-14 22:15:40 +02:00
parent 9eea49356e
commit 07544dd438

View File

@ -2,15 +2,17 @@
lib,
buildPythonPackage,
fetchFromGitHub,
numpy,
flac,
openai,
openai-whisper,
pocketsphinx,
pyaudio,
pytestCheckHook,
pythonOlder,
torch,
requests,
setuptools,
soundfile,
typing-extensions,
flac,
}:
buildPythonPackage rec {
@ -39,26 +41,29 @@ buildPythonPackage rec {
build-system = [ setuptools ];
dependencies = [
pyaudio
requests
typing-extensions
];
optional-dependencies = {
whisper-api = [ openai ];
whisper-local = [
openai-whisper
soundfile
];
};
nativeCheckInputs = [
numpy
pytestCheckHook
torch
soundfile
];
pocketsphinx
] ++ optional-dependencies.whisper-local ++ optional-dependencies.whisper-api;
pythonImportsCheck = [ "speech_recognition" ];
disabledTests = [
# Test files are missing in source
"test_flac"
# Attribute error
"test_whisper"
# PocketSphinx is not available in Nixpkgs
"test_sphinx"
# Parsed string does not match expected
"test_sphinx_keywords"
];
meta = with lib; {