1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 numpy,
6 pytestCheckHook,
7 pythonOlder,
8 torch,
9 requests,
10 setuptools,
11 soundfile,
12 typing-extensions,
13}:
14
15buildPythonPackage rec {
16 pname = "speechrecognition";
17 version = "3.10.4";
18 pyproject = true;
19
20 disabled = pythonOlder "3.8";
21
22 src = fetchFromGitHub {
23 owner = "Uberi";
24 repo = "speech_recognition";
25 rev = "refs/tags/${version}";
26 hash = "sha256-icXZUg2lVLo8Z5t9ptDj67BjQLnEgrG8geYZ/lZeJt4=";
27 };
28
29 build-system = [ setuptools ];
30
31 dependencies = [
32 requests
33 typing-extensions
34 ];
35
36 nativeCheckInputs = [
37 numpy
38 pytestCheckHook
39 torch
40 soundfile
41 ];
42
43 pythonImportsCheck = [ "speech_recognition" ];
44
45 disabledTests = [
46 # Test files are missing in source
47 "test_flac"
48 # Attribute error
49 "test_whisper"
50 # PocketSphinx is not available in Nixpkgs
51 "test_sphinx"
52 ];
53
54 meta = with lib; {
55 description = "Speech recognition module for Python, supporting several engines and APIs, online and offline";
56 homepage = "https://github.com/Uberi/speech_recognition";
57 changelog = "https://github.com/Uberi/speech_recognition/releases/tag/${version}";
58 license = with licenses; [
59 gpl2Only
60 bsd3
61 ];
62 maintainers = with maintainers; [ fab ];
63 };
64}