libretranslate: init at 1.3.11

This commit is contained in:
misuzu 2023-04-27 19:29:06 +03:00
parent 44733abecd
commit 6c76b3454a
3 changed files with 97 additions and 0 deletions

View file

@ -0,0 +1,93 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, pytestCheckHook
, argostranslate
, flask
, flask-swagger
, flask-swagger-ui
, flask-limiter
, flask-babel
, flask-session
, waitress
, expiringdict
, ltpycld2
, morfessor
, appdirs
, apscheduler
, translatehtml
, argos-translate-files
, requests
, redis
, prometheus-client
, polib
}:
buildPythonPackage rec {
pname = "libretranslate";
version = "1.3.11";
format = "setuptools";
src = fetchFromGitHub {
owner = "LibreTranslate";
repo = "LibreTranslate";
rev = "refs/tags/v${version}";
hash = "sha256-S2J7kcoZFHOjVm2mb3TblWf9/FzkxZEB3h27BCaPYgY=";
};
propagatedBuildInputs = [
argostranslate
flask
flask-swagger
flask-swagger-ui
flask-limiter
flask-babel
flask-session
waitress
expiringdict
ltpycld2
morfessor
appdirs
apscheduler
translatehtml
argos-translate-files
requests
redis
prometheus-client
polib
];
postPatch = ''
substituteInPlace requirements.txt \
--replace "==" ">="
substituteInPlace setup.py \
--replace "'pytest-runner'" ""
'';
postInstall = ''
# expose static files to be able to serve them via web-server
mkdir -p $out/share/libretranslate
ln -s $out/lib/python*/site-packages/libretranslate/static $out/share/libretranslate/static
'';
doCheck = false; # needs network access
nativeCheckInputs = [
pytestCheckHook
];
# required for import check to work (argostranslate)
env.HOME = "/tmp";
pythonImportsCheck = [ "libretranslate" ];
meta = with lib; {
description = "Free and Open Source Machine Translation API. Self-hosted, no limits, no ties to proprietary services";
homepage = "https://libretranslate.com";
changelog = "https://github.com/LibreTranslate/LibreTranslate/releases/tag/v${version}";
license = licenses.agpl3Only;
maintainers = with maintainers; [ misuzu ];
};
}

View file

@ -2577,6 +2577,8 @@ with pkgs;
retroarch-assets = callPackage ../applications/emulators/retroarch/retroarch-assets.nix { };
libretranslate = with python3.pkgs; toPythonApplication libretranslate;
libretro = recurseIntoAttrs
(callPackage ../applications/emulators/retroarch/cores.nix {
retroarch = retroarchBare;

View file

@ -5728,6 +5728,8 @@ self: super: with self; {
(p: p.py)
];
libretranslate = callPackage ../development/python-modules/libretranslate { };
librosa = callPackage ../development/python-modules/librosa { };
librouteros = callPackage ../development/python-modules/librouteros { };