2023-07-09 09:35:53 +00:00
|
|
|
[build-system]
|
|
|
|
requires = ["hatchling"]
|
|
|
|
build-backend = "hatchling.build"
|
|
|
|
|
|
|
|
[project]
|
|
|
|
requires-python = ">=3.8"
|
|
|
|
name = "libretranslate"
|
|
|
|
description = "Free and Open Source Machine Translation API. Self-hosted, no limits, no ties to proprietary services."
|
|
|
|
readme = "README.md"
|
|
|
|
license = { file = "LICENSE" }
|
|
|
|
authors = [
|
|
|
|
{ name = "Piero Toffanin", email = "pt@uav4geo.com" },
|
|
|
|
{ name = "LibreTranslate Authors" },
|
|
|
|
]
|
|
|
|
maintainers = [
|
|
|
|
{ name = "Piero Toffanin", email = "pt@uav4geo.com" },
|
|
|
|
{ name = "LibreTranslate Authors" },
|
|
|
|
]
|
|
|
|
keywords = [
|
|
|
|
"Python",
|
|
|
|
"Translate",
|
|
|
|
"Translation",
|
2023-07-09 10:38:03 +00:00
|
|
|
"API",
|
2023-07-09 09:35:53 +00:00
|
|
|
]
|
|
|
|
classifiers = [
|
|
|
|
"Operating System :: OS Independent",
|
2023-07-09 10:18:58 +00:00
|
|
|
"License :: OSI Approved :: GNU Affero General Public License v3",
|
2023-07-09 09:35:53 +00:00
|
|
|
"Programming Language :: Python :: 3",
|
|
|
|
"Programming Language :: Python :: 3.8",
|
|
|
|
"Programming Language :: Python :: 3.9",
|
|
|
|
"Programming Language :: Python :: 3.10"
|
|
|
|
]
|
|
|
|
dynamic = ["version"]
|
|
|
|
|
|
|
|
dependencies = [
|
|
|
|
"argostranslate ==1.8.0",
|
|
|
|
"Flask ==2.2.2",
|
|
|
|
"flask-swagger ==0.2.14",
|
|
|
|
"flask-swagger-ui ==4.11.1",
|
|
|
|
"Flask-Limiter ==2.6.3",
|
|
|
|
"Flask-Babel ==3.1.0",
|
|
|
|
"Flask-Session ==0.4.0",
|
|
|
|
"waitress ==2.1.2",
|
|
|
|
"expiringdict ==1.2.2",
|
|
|
|
" LTpycld2==0.42",
|
|
|
|
"morfessor ==2.0.6",
|
|
|
|
"appdirs ==1.4.4",
|
|
|
|
"APScheduler ==3.9.1",
|
|
|
|
"translatehtml ==1.5.2",
|
2023-08-05 20:56:28 +00:00
|
|
|
"argos-translate-files ==1.1.4",
|
2023-07-09 09:35:53 +00:00
|
|
|
"itsdangerous ==2.1.2",
|
|
|
|
"Werkzeug ==2.2.2",
|
|
|
|
"requests ==2.28.1",
|
|
|
|
"redis ==4.3.4",
|
|
|
|
"prometheus-client ==0.15.0",
|
|
|
|
"polib ==1.1.1",
|
|
|
|
]
|
|
|
|
|
|
|
|
[project.scripts]
|
|
|
|
libretranslate = "libretranslate.main:main"
|
|
|
|
ltmanage = "libretranslate.manage:manage"
|
|
|
|
|
|
|
|
|
|
|
|
[project.optional-dependencies]
|
|
|
|
test = [
|
|
|
|
"pytest >=7.2.0",
|
|
|
|
"pytest-cov",
|
2023-07-23 11:24:15 +00:00
|
|
|
"pre-commit >=3.0.0",
|
2023-07-09 09:35:53 +00:00
|
|
|
"types-requests",
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
[project.urls]
|
|
|
|
Homepage = "https://libretranslate.com"
|
|
|
|
Source = "https://github.com/LibreTranslate/LibreTranslate"
|
|
|
|
Documentation = "https://github.com/LibreTranslate/LibreTranslate"
|
|
|
|
Tracker = "https://github.com/LibreTranslate/LibreTranslate/issues"
|
|
|
|
History = "https://github.com/LibreTranslate/LibreTranslate/releases"
|
|
|
|
|
|
|
|
|
|
|
|
# ENVIRONMENTS AND SCRIPTS
|
|
|
|
[tool.hatch.envs.default]
|
|
|
|
features = [
|
|
|
|
"test",
|
|
|
|
]
|
2023-07-23 11:24:15 +00:00
|
|
|
post-install-commands = [
|
|
|
|
"pre-commit install",
|
|
|
|
]
|
2023-07-09 09:35:53 +00:00
|
|
|
|
2023-07-10 06:11:51 +00:00
|
|
|
|
2023-07-09 09:35:53 +00:00
|
|
|
[tool.hatch.envs.default.scripts]
|
|
|
|
dev = "python main.py {args}"
|
2023-07-10 06:11:51 +00:00
|
|
|
locales = "python scripts/compile_locales.py"
|
2023-07-09 09:35:53 +00:00
|
|
|
fmt = [
|
2023-07-23 11:24:15 +00:00
|
|
|
"pre-commit run --all --all-files",
|
2023-07-09 09:35:53 +00:00
|
|
|
]
|
|
|
|
test = [
|
2023-07-09 10:38:03 +00:00
|
|
|
"fmt",
|
2023-07-09 09:35:53 +00:00
|
|
|
"pytest {args}",
|
|
|
|
]
|
|
|
|
cov = [
|
|
|
|
"pytest --cov-report html {args}",
|
|
|
|
"python -c 'import webbrowser; webbrowser.open(\"http://0.0.0.0:3000\")'",
|
|
|
|
"python -m http.server 3000 --directory ./htmlcov",
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
[[tool.hatch.envs.all.matrix]]
|
|
|
|
python = ["3.8", "3.9", "3.10", "3.11"]
|
|
|
|
|
|
|
|
|
|
|
|
# TOOLS
|
|
|
|
[tool.hatch.version]
|
|
|
|
path = "VERSION"
|
2023-07-09 10:18:58 +00:00
|
|
|
pattern = "^(?P<version>[0-9]*.[0-9]*.[0-9]*)$"
|
2023-07-09 09:35:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
[tool.pytest.ini_options]
|
|
|
|
addopts = [
|
|
|
|
"-v",
|
|
|
|
"--cov=libretranslate",
|
|
|
|
"--color=yes",
|
|
|
|
"--cov-report=term-missing",
|
|
|
|
]
|
|
|
|
|
|
|
|
|
2023-07-09 10:38:03 +00:00
|
|
|
# https://beta.ruff.rs/docs/rules
|
2023-07-09 09:35:53 +00:00
|
|
|
[tool.ruff]
|
|
|
|
src = ["libretranslate", "scripts"]
|
|
|
|
target-version = "py38"
|
|
|
|
line-length = 136
|
|
|
|
select = [
|
2023-07-09 10:18:58 +00:00
|
|
|
"I", # isort
|
|
|
|
"N", # pep8-naming
|
|
|
|
"S", # bandit
|
2023-07-09 09:35:53 +00:00
|
|
|
"A", # flake8-builtins
|
2023-07-09 10:18:58 +00:00
|
|
|
"YTT", # flake8-2020
|
2023-07-09 09:35:53 +00:00
|
|
|
"B", # flake8-bugbear
|
2023-07-09 10:23:48 +00:00
|
|
|
# "C", # flake8-comprehensions
|
2023-07-09 09:35:53 +00:00
|
|
|
"ICN", # flake8-import-conventions
|
2023-07-09 10:29:11 +00:00
|
|
|
# "SIM", # flake8-simplify
|
2023-07-09 10:18:58 +00:00
|
|
|
"TID", # flake8-tidy-imports
|
2023-07-09 10:23:48 +00:00
|
|
|
# "Q", # flake8-quotes
|
2023-07-09 10:29:11 +00:00
|
|
|
# "FBT", # flake8-boolean-trap
|
2023-07-09 10:18:58 +00:00
|
|
|
"F", # pyflakes
|
|
|
|
"UP", # pyupgrade
|
2023-07-09 10:23:48 +00:00
|
|
|
# "E", # pycodestyle errors
|
|
|
|
# "W", # pycodestyle warnings
|
2023-07-09 10:29:11 +00:00
|
|
|
# "PLC", # pylint convention
|
2023-07-09 09:35:53 +00:00
|
|
|
"PLE", # pylint error
|
2023-07-09 10:23:48 +00:00
|
|
|
# "PLR", # pylint refactor
|
2023-07-09 10:29:11 +00:00
|
|
|
# "PLW", # pylint warning
|
2023-07-10 06:11:51 +00:00
|
|
|
# "RUF", # ruff specific
|
2023-07-09 09:35:53 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
ignore = [
|
2023-07-09 09:43:58 +00:00
|
|
|
"E501", # line too long
|
2023-07-09 10:29:11 +00:00
|
|
|
"A003", # Class attribute is shadowing a python builtin
|
2023-07-09 09:43:58 +00:00
|
|
|
"S101", # Use of `assert` detected
|
2023-07-09 10:29:11 +00:00
|
|
|
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
|
2023-07-09 09:43:58 +00:00
|
|
|
"T201", "T203", # remove print and pprint
|
|
|
|
"E402", # Module level import not at top of file
|
2023-07-09 09:35:53 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
[tool.ruff.per-file-ignores]
|
|
|
|
"__init__.py" = ["I", "F401"] # module imported but unused
|
|
|
|
|
|
|
|
|
|
|
|
[tool.ruff.mccabe]
|
2023-07-09 09:43:58 +00:00
|
|
|
max-complexity = 12
|