mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-22 03:53:47 +00:00
Merge pull request #228563 from misuzu/libretranslate
libretranslate: init at 1.3.11
This commit is contained in:
commit
0e6e548e9c
@ -0,0 +1,41 @@
|
||||
{ lib
|
||||
, buildPythonPackage
|
||||
, fetchPypi
|
||||
, lxml
|
||||
, translatehtml
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "argos-translate-files";
|
||||
version = "1.1.3";
|
||||
|
||||
format = "setuptools";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "c6931ea8fbabdc24903ceaabfe848be0fa4a0477d00451a8dfbc1525b623f0ba";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = [
|
||||
lxml
|
||||
translatehtml
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
ln -s */requires.txt requirements.txt
|
||||
'';
|
||||
|
||||
# required for import check to work (argostranslate)
|
||||
env.HOME = "/tmp";
|
||||
|
||||
pythonImportsCheck = [ "argostranslatefiles" ];
|
||||
|
||||
doCheck = false; # no tests
|
||||
|
||||
meta = with lib; {
|
||||
description = "Translate files using Argos Translate";
|
||||
homepage = "https://www.argosopentech.com";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ misuzu ];
|
||||
};
|
||||
}
|
64
pkgs/development/python-modules/argostranslate/default.nix
Normal file
64
pkgs/development/python-modules/argostranslate/default.nix
Normal file
@ -0,0 +1,64 @@
|
||||
{ lib
|
||||
, buildPythonPackage
|
||||
, fetchPypi
|
||||
, pytestCheckHook
|
||||
, ctranslate2
|
||||
, ctranslate2-cpp
|
||||
, sentencepiece
|
||||
, stanza
|
||||
}:
|
||||
let
|
||||
ctranslate2OneDNN = ctranslate2.override {
|
||||
ctranslate2-cpp = ctranslate2-cpp.override {
|
||||
# https://github.com/OpenNMT/CTranslate2/issues/1294
|
||||
withOneDNN = true;
|
||||
withOpenblas = false;
|
||||
};
|
||||
};
|
||||
in
|
||||
buildPythonPackage rec {
|
||||
pname = "argostranslate";
|
||||
version = "1.8.0";
|
||||
|
||||
format = "setuptools";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "9b109255d6a2c692c6f3bfbde494d1a27b3d5ed1c1d1d78711cdc1b1e3744c64";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = [
|
||||
ctranslate2OneDNN
|
||||
sentencepiece
|
||||
stanza
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
ln -s */requires.txt requirements.txt
|
||||
|
||||
substituteInPlace requirements.txt \
|
||||
--replace "==" ">="
|
||||
'';
|
||||
|
||||
doCheck = false; # needs network access
|
||||
|
||||
nativeCheckInputs = [
|
||||
pytestCheckHook
|
||||
];
|
||||
|
||||
# required for import check to work
|
||||
# PermissionError: [Errno 13] Permission denied: '/homeless-shelter'
|
||||
env.HOME = "/tmp";
|
||||
|
||||
pythonImportsCheck = [
|
||||
"argostranslate"
|
||||
"argostranslate.translate"
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
description = "Open-source offline translation library written in Python";
|
||||
homepage = "https://www.argosopentech.com";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ misuzu ];
|
||||
};
|
||||
}
|
93
pkgs/development/python-modules/libretranslate/default.nix
Normal file
93
pkgs/development/python-modules/libretranslate/default.nix
Normal 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 ];
|
||||
};
|
||||
}
|
29
pkgs/development/python-modules/ltpycld2/default.nix
Normal file
29
pkgs/development/python-modules/ltpycld2/default.nix
Normal file
@ -0,0 +1,29 @@
|
||||
{ stdenv
|
||||
, lib
|
||||
, buildPythonPackage
|
||||
, fetchPypi
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "LTpycld2";
|
||||
version = "0.42";
|
||||
|
||||
format = "setuptools";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "948d0c1ab5518ab4efcbcc3cd73bb29f809f1dfb30f4d2fbd81b175a1ffeb516";
|
||||
};
|
||||
|
||||
doCheck = false; # completely broken tests
|
||||
|
||||
pythonImportsCheck = [ "pycld2" ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "Python bindings around Google Chromium's embedded compact language detection library (CLD2)";
|
||||
homepage = "https://github.com/LibreTranslate/pycld2";
|
||||
license = licenses.asl20;
|
||||
maintainers = with maintainers; [ misuzu ];
|
||||
broken = stdenv.isDarwin;
|
||||
};
|
||||
}
|
27
pkgs/development/python-modules/morfessor/default.nix
Normal file
27
pkgs/development/python-modules/morfessor/default.nix
Normal file
@ -0,0 +1,27 @@
|
||||
{ lib
|
||||
, buildPythonPackage
|
||||
, fetchPypi
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "Morfessor";
|
||||
version = "2.0.6";
|
||||
|
||||
format = "setuptools";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "bb3beac234341724c5f640f65803071f62373a50dba854d5a398567f9aefbab2";
|
||||
};
|
||||
|
||||
checkPhase = "python -m unittest -v morfessor/test/*";
|
||||
|
||||
pythonImportsCheck = [ "morfessor" ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "A tool for unsupervised and semi-supervised morphological segmentation";
|
||||
homepage = "https://github.com/aalto-speech/morfessor";
|
||||
license = licenses.bsd2;
|
||||
maintainers = with maintainers; [ misuzu ];
|
||||
};
|
||||
}
|
44
pkgs/development/python-modules/translatehtml/default.nix
Normal file
44
pkgs/development/python-modules/translatehtml/default.nix
Normal file
@ -0,0 +1,44 @@
|
||||
{ lib
|
||||
, buildPythonPackage
|
||||
, fetchPypi
|
||||
, argostranslate
|
||||
, beautifulsoup4
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "translatehtml";
|
||||
version = "1.5.2";
|
||||
|
||||
format = "setuptools";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "6b30ceb8b6f174917e2660caf2d2ccbaa71d8d24c815316edf56b061d678820d";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = [
|
||||
argostranslate
|
||||
beautifulsoup4
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
ln -s */requires.txt requirements.txt
|
||||
|
||||
substituteInPlace requirements.txt \
|
||||
--replace "==" ">="
|
||||
'';
|
||||
|
||||
# required for import check to work (argostranslate)
|
||||
env.HOME = "/tmp";
|
||||
|
||||
pythonImportsCheck = [ "translatehtml" ];
|
||||
|
||||
doCheck = false; # no tests
|
||||
|
||||
meta = with lib; {
|
||||
description = "Translate HTML using Beautiful Soup and Argos Translate.";
|
||||
homepage = "https://www.argosopentech.com";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ misuzu ];
|
||||
};
|
||||
}
|
@ -2581,6 +2581,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;
|
||||
|
@ -612,6 +612,12 @@ self: super: with self; {
|
||||
|
||||
argon2-cffi-bindings = callPackage ../development/python-modules/argon2-cffi-bindings { };
|
||||
|
||||
argostranslate = callPackage ../development/python-modules/argostranslate {
|
||||
ctranslate2-cpp = pkgs.ctranslate2;
|
||||
};
|
||||
|
||||
argos-translate-files = callPackage ../development/python-modules/argos-translate-files { };
|
||||
|
||||
argparse-addons = callPackage ../development/python-modules/argparse-addons { };
|
||||
|
||||
argparse-dataclass = callPackage ../development/python-modules/argparse-dataclass { };
|
||||
@ -5728,6 +5734,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 { };
|
||||
@ -5947,6 +5955,8 @@ self: super: with self; {
|
||||
|
||||
lsprotocol = callPackage ../development/python-modules/lsprotocol { };
|
||||
|
||||
ltpycld2 = callPackage ../development/python-modules/ltpycld2 { };
|
||||
|
||||
luddite = callPackage ../development/python-modules/luddite { };
|
||||
|
||||
ludios_wpull = callPackage ../development/python-modules/ludios_wpull { };
|
||||
@ -6434,6 +6444,8 @@ self: super: with self; {
|
||||
|
||||
moretools = callPackage ../development/python-modules/moretools { };
|
||||
|
||||
morfessor = callPackage ../development/python-modules/morfessor { };
|
||||
|
||||
morphys = callPackage ../development/python-modules/morphys { };
|
||||
|
||||
mortgage = callPackage ../development/python-modules/mortgage { };
|
||||
@ -12438,6 +12450,8 @@ self: super: with self; {
|
||||
|
||||
transitions = callPackage ../development/python-modules/transitions { };
|
||||
|
||||
translatehtml = callPackage ../development/python-modules/translatehtml { };
|
||||
|
||||
translatepy = callPackage ../development/python-modules/translatepy { };
|
||||
|
||||
translationstring = callPackage ../development/python-modules/translationstring { };
|
||||
|
Loading…
Reference in New Issue
Block a user