nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 python3Packages,
4 fetchFromGitHub,
5 fetchpatch2,
6 writableTmpDirAsHomeHook,
7 versionCheckHook,
8}:
9
10python3Packages.buildPythonApplication rec {
11 pname = "babeldoc";
12 version = "0.5.22";
13 pyproject = true;
14
15 src = fetchFromGitHub {
16 owner = "funstory-ai";
17 repo = "BabelDOC";
18 tag = "v${version}";
19 hash = "sha256-ArLTv5AjpUdbsN8bQs03ATwg5ugXetld2FmHhicU8OE=";
20 };
21
22 patches = [
23 (fetchpatch2 {
24 name = "rename-python-levenshtein-to-levenshtein";
25 url = "https://github.com/funstory-ai/BabelDOC/pull/542.patch?full_index=1";
26 hash = "sha256-rjXhKVFivkJo54WdYiihqB3lrlu4YEwVZZkE4WBatWs=";
27 })
28 ];
29
30 build-system = with python3Packages; [ hatchling ];
31
32 dependencies =
33 with python3Packages;
34 [
35 bitstring
36 configargparse
37 httpx
38 huggingface-hub
39 numpy
40 onnx
41 onnxruntime
42 openai
43 orjson
44 charset-normalizer
45 cryptography
46 peewee
47 psutil
48 pymupdf
49 rich
50 toml
51 tqdm
52 xsdata
53 msgpack
54 pydantic
55 tenacity
56 scikit-image
57 freetype-py
58 tiktoken
59 levenshtein
60 opencv-python-headless
61 rapidocr-onnxruntime
62 pyzstd
63 hyperscan
64 rtree
65 chardet
66 scipy
67 uharfbuzz
68 scikit-learn
69 ]
70 ++ httpx.optional-dependencies.socks
71 ++ (with xsdata.optional-dependencies; cli ++ lxml ++ soap);
72
73 pythonImportsCheck = [ "babeldoc" ];
74
75 nativeCheckInputs = [
76 writableTmpDirAsHomeHook
77 python3Packages.pytestCheckHook
78 versionCheckHook
79 ];
80 versionCheckKeepEnvironment = "HOME";
81
82 meta = {
83 description = "PDF scientific paper translation and bilingual comparison library";
84 homepage = "https://github.com/funstory-ai/BabelDOC";
85 changelog = "https://github.com/funstory-ai/BabelDOC/releases/tag/${src.tag}";
86 license = lib.licenses.agpl3Only;
87 maintainers = with lib.maintainers; [ ryota2357 ];
88 mainProgram = "babeldoc";
89 };
90}