Commit 07544dd4 authored by jopejoe1's avatar jopejoe1
Browse files

python3Packages.speechrecognition: add optional dependencies

parent 9eea4935
Loading
Loading
Loading
Loading
+18 −13
Original line number Diff line number Diff line
@@ -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
  ];

  nativeCheckInputs = [
    numpy
    pytestCheckHook
    torch
  optional-dependencies = {
    whisper-api = [ openai ];
    whisper-local = [
      openai-whisper
      soundfile
    ];
  };

  nativeCheckInputs = [
    pytestCheckHook
    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; {