1{ 2 lib, 3 buildPythonPackage, 4 fetchPypi, 5 pytestCheckHook, 6 ctranslate2, 7 ctranslate2-cpp, 8 sentencepiece, 9 stanza, 10}: 11let 12 ctranslate2OneDNN = ctranslate2.override { 13 ctranslate2-cpp = ctranslate2-cpp.override { 14 # https://github.com/OpenNMT/CTranslate2/issues/1294 15 withOneDNN = true; 16 withOpenblas = false; 17 }; 18 }; 19in 20buildPythonPackage rec { 21 pname = "argostranslate"; 22 version = "1.9.6"; 23 24 format = "setuptools"; 25 26 src = fetchPypi { 27 inherit pname version; 28 hash = "sha256-3YzBMnqmcTIpn5UOFg3SDTFLjPSE9UDw0i8fB8LYh2s="; 29 }; 30 31 propagatedBuildInputs = [ 32 ctranslate2OneDNN 33 sentencepiece 34 stanza 35 ]; 36 37 postPatch = '' 38 ln -s */requires.txt requirements.txt 39 40 substituteInPlace requirements.txt \ 41 --replace "==" ">=" 42 ''; 43 44 doCheck = false; # needs network access 45 46 nativeCheckInputs = [ pytestCheckHook ]; 47 48 # required for import check to work 49 # PermissionError: [Errno 13] Permission denied: '/homeless-shelter' 50 env.HOME = "/tmp"; 51 52 pythonImportsCheck = [ 53 "argostranslate" 54 "argostranslate.translate" 55 ]; 56 57 meta = { 58 description = "Open-source offline translation library written in Python"; 59 homepage = "https://www.argosopentech.com"; 60 license = lib.licenses.mit; 61 maintainers = with lib.maintainers; [ misuzu ]; 62 }; 63}