Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions pkgs/development/python-modules/lexilang/default.nix
Original file line number Diff line number Diff line change
@@ -1,41 +1,44 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, setuptools
, pytestCheckHook
, python
, pythonOlder
, setuptools
}:

buildPythonPackage rec {
pname = "lexilang";
version = "1.0.1";
pyproject = true;

disabled = pythonOlder "3.8";

src = fetchFromGitHub {
owner = "LibreTranslate";
repo = "LexiLang";
rev = "v${version}";
rev = "refs/tags/v${version}";
hash = "sha256-TLkaqCE9NDjN2XuYOUkeeWIRcqkxrdg31fS4mEnlcEo=";
};

nativeBuildInputs = [
setuptools
];

nativeCheckInputs = [
pytestCheckHook
];

checkPhase = ''
runHook preCheck
${python.interpreter} test.py
runHook postCheck
'';

pythonImportsCheck = [
"lexilang"
];

meta = with lib; {
description = "Simple, fast dictionary-based language detector for short texts";
description = "Dictionary-based language detector for short texts";
homepage = "https://github.com/LibreTranslate/LexiLang";
changelog = "https://github.com/LibreTranslate/LexiLang/releases/tag/v${version}";
license = licenses.agpl3Only;
maintainers = with maintainers; [ izorkin ];
maintainers = with maintainers; [ fab izorkin ];
};
}
91 changes: 48 additions & 43 deletions pkgs/development/python-modules/libretranslate/default.nix
Original file line number Diff line number Diff line change
@@ -1,88 +1,93 @@
{ lib
, appdirs
, apscheduler
, argos-translate-files
, argostranslate
, buildPythonPackage
, expiringdict
, fetchFromGitHub
, pytestCheckHook
, argostranslate
, flask
, flask-swagger
, flask-swagger-ui
, flask-limiter
, flask-babel
, flask-limiter
, flask-session
, waitress
, expiringdict
, flask-swagger
, flask-swagger-ui
, hatchling
, langdetect
, lexilang
, ltpycld2
, morfessor
, appdirs
, apscheduler
, translatehtml
, argos-translate-files
, requests
, redis
, prometheus-client
, polib
, prometheus-client
, python
, pythonOlder
, pythonRelaxDepsHook
, redis
, requests
, translatehtml
, waitress
}:

buildPythonPackage rec {
pname = "libretranslate";
version = "1.5.2";
version = "1.5.5";
pyproject = true;

format = "setuptools";
disabled = pythonOlder "3.8";

src = fetchFromGitHub {
owner = "LibreTranslate";
repo = "LibreTranslate";
rev = "refs/tags/v${version}";
hash = "sha256-8bbVpC53wH9GvwwHHlPEYQd/zqMXIqrwixwn4HY6FMg=";
hash = "sha256-ARSe4r99ShPB4LJBrE7G53Ws0/fVKjZxUpGAdhWTsRs=";
};

pythonRelaxDeps = true;

nativeBuildInputs = [
hatchling
pythonRelaxDepsHook
];

propagatedBuildInputs = [
appdirs
apscheduler
argos-translate-files
argostranslate
expiringdict
flask
flask-swagger
flask-swagger-ui
flask-limiter
flask-babel
flask-limiter
flask-session
waitress
expiringdict
flask-swagger
flask-swagger-ui
langdetect
lexilang
ltpycld2
morfessor
appdirs
apscheduler
translatehtml
argos-translate-files
requests
redis
prometheus-client
polib
prometheus-client
redis
requests
translatehtml
waitress
];

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/${python.sitePackages}/libretranslate/static $out/share/libretranslate/static
'';

doCheck = false; # needs network access

nativeCheckInputs = [
pytestCheckHook
];
# Tests need network access
doCheck = false;

# required for import check to work (argostranslate)
env.HOME = "/tmp";

pythonImportsCheck = [ "libretranslate" ];
pythonImportsCheck = [
"libretranslate"
];

meta = with lib; {
description = "Free and Open Source Machine Translation API. Self-hosted, no limits, no ties to proprietary services";
Expand Down