pdf2zh-next 2.0.0rc1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. pdf2zh_next-2.0.0rc1/.dockerignore +175 -0
  2. pdf2zh_next-2.0.0rc1/.github/FUNDING.yml +15 -0
  3. pdf2zh_next-2.0.0rc1/.github/ISSUE_TEMPLATE/blank.yaml +14 -0
  4. pdf2zh_next-2.0.0rc1/.github/ISSUE_TEMPLATE/config.yml +1 -0
  5. pdf2zh_next-2.0.0rc1/.github/ISSUE_TEMPLATE//345/212/237/350/203/275/350/257/267/346/261/202_cn.yaml +25 -0
  6. pdf2zh_next-2.0.0rc1/.github/ISSUE_TEMPLATE//345/212/237/350/203/275/350/257/267/346/261/202_en.yaml +26 -0
  7. pdf2zh_next-2.0.0rc1/.github/ISSUE_TEMPLATE//351/227/256/351/242/230/345/217/215/351/246/210_cn.yaml +94 -0
  8. pdf2zh_next-2.0.0rc1/.github/ISSUE_TEMPLATE//351/227/256/351/242/230/345/217/215/351/246/210_en.yaml +93 -0
  9. pdf2zh_next-2.0.0rc1/.github/dependabot.yml +21 -0
  10. pdf2zh_next-2.0.0rc1/.github/release-drafter.yml +55 -0
  11. pdf2zh_next-2.0.0rc1/.github/workflows/exe-build.yml +171 -0
  12. pdf2zh_next-2.0.0rc1/.github/workflows/fork-build.yml +325 -0
  13. pdf2zh_next-2.0.0rc1/.github/workflows/fork-test.yml +24 -0
  14. pdf2zh_next-2.0.0rc1/.github/workflows/lint.yml +17 -0
  15. pdf2zh_next-2.0.0rc1/.github/workflows/pr-lint.yml +46 -0
  16. pdf2zh_next-2.0.0rc1/.github/workflows/python-test.yml +71 -0
  17. pdf2zh_next-2.0.0rc1/.github/workflows/release.yml +574 -0
  18. pdf2zh_next-2.0.0rc1/.gitignore +174 -0
  19. pdf2zh_next-2.0.0rc1/.pre-commit-config.yaml +14 -0
  20. pdf2zh_next-2.0.0rc1/Dockerfile +32 -0
  21. pdf2zh_next-2.0.0rc1/LICENSE +661 -0
  22. pdf2zh_next-2.0.0rc1/PKG-INFO +214 -0
  23. pdf2zh_next-2.0.0rc1/README.md +176 -0
  24. pdf2zh_next-2.0.0rc1/app.json +5 -0
  25. pdf2zh_next-2.0.0rc1/docs/APIS.md +93 -0
  26. pdf2zh_next-2.0.0rc1/docs/FAQ.md +70 -0
  27. pdf2zh_next-2.0.0rc1/docs/Home.md +10 -0
  28. pdf2zh_next-2.0.0rc1/docs/README_ja-JP.md +389 -0
  29. pdf2zh_next-2.0.0rc1/docs/README_ko-KR.md +382 -0
  30. pdf2zh_next-2.0.0rc1/docs/README_zh-CN.md +312 -0
  31. pdf2zh_next-2.0.0rc1/docs/README_zh-TW.md +366 -0
  32. pdf2zh_next-2.0.0rc1/docs/advanced/Documentation-of-Translation-Services.md +80 -0
  33. pdf2zh_next-2.0.0rc1/docs/advanced/Language-Codes.md +109 -0
  34. pdf2zh_next-2.0.0rc1/docs/advanced/advanced.md +282 -0
  35. pdf2zh_next-2.0.0rc1/docs/advanced/introduction.md +15 -0
  36. pdf2zh_next-2.0.0rc1/docs/community/CODE_OF_CONDUCT.md +128 -0
  37. pdf2zh_next-2.0.0rc1/docs/community/Contribution-Guide.md +110 -0
  38. pdf2zh_next-2.0.0rc1/docs/getting-started/INSTALLATION_docker.md +54 -0
  39. pdf2zh_next-2.0.0rc1/docs/getting-started/INSTALLATION_uv.md +34 -0
  40. pdf2zh_next-2.0.0rc1/docs/getting-started/INSTALLATION_winexe.md +59 -0
  41. pdf2zh_next-2.0.0rc1/docs/getting-started/USAGE_commandline.md +50 -0
  42. pdf2zh_next-2.0.0rc1/docs/getting-started/USAGE_webui.md +46 -0
  43. pdf2zh_next-2.0.0rc1/docs/getting-started/getting-started.md +19 -0
  44. pdf2zh_next-2.0.0rc1/docs/images/after.png +0 -0
  45. pdf2zh_next-2.0.0rc1/docs/images/banner.png +0 -0
  46. pdf2zh_next-2.0.0rc1/docs/images/before.png +0 -0
  47. pdf2zh_next-2.0.0rc1/docs/images/cmd.explained.png +0 -0
  48. pdf2zh_next-2.0.0rc1/docs/images/cmd.explained.zh.png +0 -0
  49. pdf2zh_next-2.0.0rc1/docs/images/cmd_dark.png +0 -0
  50. pdf2zh_next-2.0.0rc1/docs/images/cmd_dark.svg +1900 -0
  51. pdf2zh_next-2.0.0rc1/docs/images/cmd_light.png +0 -0
  52. pdf2zh_next-2.0.0rc1/docs/images/cmd_light.svg +1793 -0
  53. pdf2zh_next-2.0.0rc1/docs/images/env_dark.png +0 -0
  54. pdf2zh_next-2.0.0rc1/docs/images/env_light.png +0 -0
  55. pdf2zh_next-2.0.0rc1/docs/images/ev_dark.svg +2134 -0
  56. pdf2zh_next-2.0.0rc1/docs/images/ev_light.svg +2044 -0
  57. pdf2zh_next-2.0.0rc1/docs/images/gui.gif +0 -0
  58. pdf2zh_next-2.0.0rc1/docs/images/logo_dark.svg +6 -0
  59. pdf2zh_next-2.0.0rc1/docs/images/logo_light.svg +6 -0
  60. pdf2zh_next-2.0.0rc1/docs/images/logo_photo.svg +5 -0
  61. pdf2zh_next-2.0.0rc1/docs/images/preview.gif +0 -0
  62. pdf2zh_next-2.0.0rc1/docs/index.md +2 -0
  63. pdf2zh_next-2.0.0rc1/docs/supported_languages.md +2 -0
  64. pdf2zh_next-2.0.0rc1/mkdocs.yml +142 -0
  65. pdf2zh_next-2.0.0rc1/pdf2zh_next/__init__.py +69 -0
  66. pdf2zh_next-2.0.0rc1/pdf2zh_next/config/__init__.py +55 -0
  67. pdf2zh_next-2.0.0rc1/pdf2zh_next/config/cli_env_model.py +96 -0
  68. pdf2zh_next-2.0.0rc1/pdf2zh_next/config/main.py +632 -0
  69. pdf2zh_next-2.0.0rc1/pdf2zh_next/config/model.py +306 -0
  70. pdf2zh_next-2.0.0rc1/pdf2zh_next/config/translate_engine_model.py +578 -0
  71. pdf2zh_next-2.0.0rc1/pdf2zh_next/const.py +16 -0
  72. pdf2zh_next-2.0.0rc1/pdf2zh_next/gui.py +1415 -0
  73. pdf2zh_next-2.0.0rc1/pdf2zh_next/high_level.py +621 -0
  74. pdf2zh_next-2.0.0rc1/pdf2zh_next/http_api.py +0 -0
  75. pdf2zh_next-2.0.0rc1/pdf2zh_next/main.py +104 -0
  76. pdf2zh_next-2.0.0rc1/pdf2zh_next/translator/__init__.py +13 -0
  77. pdf2zh_next-2.0.0rc1/pdf2zh_next/translator/base_rate_limiter.py +3 -0
  78. pdf2zh_next-2.0.0rc1/pdf2zh_next/translator/base_translator.py +188 -0
  79. pdf2zh_next-2.0.0rc1/pdf2zh_next/translator/cache.py +152 -0
  80. pdf2zh_next-2.0.0rc1/pdf2zh_next/translator/rate_limiter/qps_rate_limiter.py +38 -0
  81. pdf2zh_next-2.0.0rc1/pdf2zh_next/translator/translator_impl/anythingllm.py +55 -0
  82. pdf2zh_next-2.0.0rc1/pdf2zh_next/translator/translator_impl/azure.py +47 -0
  83. pdf2zh_next-2.0.0rc1/pdf2zh_next/translator/translator_impl/azureopenai.py +85 -0
  84. pdf2zh_next-2.0.0rc1/pdf2zh_next/translator/translator_impl/bing.py +66 -0
  85. pdf2zh_next-2.0.0rc1/pdf2zh_next/translator/translator_impl/deepl.py +41 -0
  86. pdf2zh_next-2.0.0rc1/pdf2zh_next/translator/translator_impl/dify.py +56 -0
  87. pdf2zh_next-2.0.0rc1/pdf2zh_next/translator/translator_impl/google.py +60 -0
  88. pdf2zh_next-2.0.0rc1/pdf2zh_next/translator/translator_impl/ollama.py +92 -0
  89. pdf2zh_next-2.0.0rc1/pdf2zh_next/translator/translator_impl/openai.py +90 -0
  90. pdf2zh_next-2.0.0rc1/pdf2zh_next/translator/translator_impl/qwenmt.py +114 -0
  91. pdf2zh_next-2.0.0rc1/pdf2zh_next/translator/translator_impl/siliconflow.py +89 -0
  92. pdf2zh_next-2.0.0rc1/pdf2zh_next/translator/translator_impl/tmt.py +50 -0
  93. pdf2zh_next-2.0.0rc1/pdf2zh_next/translator/translator_impl/xinference.py +88 -0
  94. pdf2zh_next-2.0.0rc1/pdf2zh_next/translator/utils.py +43 -0
  95. pdf2zh_next-2.0.0rc1/pdf2zh_next/utils/asynchronize/__init__.py +93 -0
  96. pdf2zh_next-2.0.0rc1/pyproject.toml +160 -0
  97. pdf2zh_next-2.0.0rc1/script/Dockerfile.China +19 -0
  98. pdf2zh_next-2.0.0rc1/script/Dockerfile.Demo +31 -0
  99. pdf2zh_next-2.0.0rc1/script/_pystand_static.int +33 -0
  100. pdf2zh_next-2.0.0rc1/script/setup.bat +27 -0
  101. pdf2zh_next-2.0.0rc1/setup.cfg +4 -0
  102. pdf2zh_next-2.0.0rc1/test/test_cache.py +212 -0
  103. pdf2zh_next-2.0.0rc1/test/test_translator.py.disable +229 -0
  104. pdf2zh_next-2.0.0rc1/tests/config/conftest.py +23 -0
  105. pdf2zh_next-2.0.0rc1/tests/config/test_main.py +555 -0
  106. pdf2zh_next-2.0.0rc1/tests/config/test_model.py +405 -0
@@ -0,0 +1,175 @@
1
+ .github
2
+ docs
3
+ .git
4
+ .pre-commit-config.yaml
5
+ uv.lock
6
+ pdf2zh_files
7
+ gui/pdf2zh_files
8
+ gradio_files
9
+ tmp
10
+ gui/gradio_files
11
+ gui/tmp
12
+ # Byte-compiled / optimized / DLL files
13
+ __pycache__/
14
+ *.py[cod]
15
+ *$py.class
16
+
17
+ # C extensions
18
+ *.so
19
+
20
+ # Distribution / packaging
21
+ .Python
22
+ build/
23
+ develop-eggs/
24
+ dist/
25
+ downloads/
26
+ eggs/
27
+ .eggs/
28
+ lib/
29
+ lib64/
30
+ parts/
31
+ sdist/
32
+ var/
33
+ wheels/
34
+ share/python-wheels/
35
+ *.egg-info/
36
+ .installed.cfg
37
+ *.egg
38
+ MANIFEST
39
+
40
+ # PyInstaller
41
+ # Usually these files are written by a python script from a template
42
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
43
+ *.manifest
44
+ *.spec
45
+
46
+ # Installer logs
47
+ pip-log.txt
48
+ pip-delete-this-directory.txt
49
+
50
+ # Unit test / coverage reports
51
+ htmlcov/
52
+ .tox/
53
+ .nox/
54
+ .coverage
55
+ .coverage.*
56
+ .cache
57
+ nosetests.xml
58
+ coverage.xml
59
+ *.cover
60
+ *.py,cover
61
+ .hypothesis/
62
+ .pytest_cache/
63
+ cover/
64
+
65
+ # Translations
66
+ *.mo
67
+ *.pot
68
+
69
+ # Django stuff:
70
+ *.log
71
+ local_settings.py
72
+ db.sqlite3
73
+ db.sqlite3-journal
74
+
75
+ # Flask stuff:
76
+ instance/
77
+ .webassets-cache
78
+
79
+ # Scrapy stuff:
80
+ .scrapy
81
+
82
+ # Sphinx documentation
83
+ docs/_build/
84
+
85
+ # PyBuilder
86
+ .pybuilder/
87
+ target/
88
+
89
+ # Jupyter Notebook
90
+ .ipynb_checkpoints
91
+
92
+ # IPython
93
+ profile_default/
94
+ ipython_config.py
95
+
96
+ # pyenv
97
+ # For a library or package, you might want to ignore these files since the code is
98
+ # intended to run in multiple environments; otherwise, check them in:
99
+ # .python-version
100
+
101
+ # pipenv
102
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
103
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
104
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
105
+ # install all needed dependencies.
106
+ #Pipfile.lock
107
+
108
+ # poetry
109
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
110
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
111
+ # commonly ignored for libraries.
112
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
113
+ #poetry.lock
114
+
115
+ # pdm
116
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
117
+ #pdm.lock
118
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
119
+ # in version control.
120
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
121
+ .pdm.toml
122
+ .pdm-python
123
+ .pdm-build/
124
+
125
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
126
+ __pypackages__/
127
+
128
+ # Celery stuff
129
+ celerybeat-schedule
130
+ celerybeat.pid
131
+
132
+ # SageMath parsed files
133
+ *.sage.py
134
+
135
+ # Environments
136
+ .env
137
+ .venv
138
+ env/
139
+ venv/
140
+ ENV/
141
+ env.bak/
142
+ venv.bak/
143
+
144
+ # Spyder project settings
145
+ .spyderproject
146
+ .spyproject
147
+
148
+ # Rope project settings
149
+ .ropeproject
150
+
151
+ # mkdocs documentation
152
+ /site
153
+
154
+ # mypy
155
+ .mypy_cache/
156
+ .dmypy.json
157
+ dmypy.json
158
+
159
+ # Pyre type checker
160
+ .pyre/
161
+
162
+ # pytype static type analyzer
163
+ .pytype/
164
+
165
+ # Cython debug symbols
166
+ cython_debug/
167
+
168
+ # PyCharm
169
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
170
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
171
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
172
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
173
+ .idea/
174
+ .vscode
175
+ .DS_Store
@@ -0,0 +1,15 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: [Byaidu, reycn, Wybxc, hellofinch] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4
+ patreon: # Replace with a single Patreon username
5
+ open_collective: # Replace with a single Open Collective username
6
+ ko_fi: # Replace with a single Ko-fi username
7
+ tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8
+ community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
+ liberapay: # Replace with a single Liberapay username
10
+ issuehunt: # Replace with a single IssueHunt username
11
+ lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
12
+ polar: # Replace with a single Polar username
13
+ buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
14
+ thanks_dev: # Replace with a single thanks.dev username
15
+ custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
@@ -0,0 +1,14 @@
1
+ name: Blank Issue
2
+ description: Create a blank issue for discussion
3
+ body:
4
+ - type: checkboxes
5
+ id: checks
6
+ attributes:
7
+ label: before ...
8
+ options:
9
+ - label: This issue is not about question or bug.
10
+ required: true
11
+ - type: textarea
12
+ id: describe
13
+ attributes:
14
+ label: Add a description
@@ -0,0 +1 @@
1
+ blank_issues_enabled: false
@@ -0,0 +1,25 @@
1
+ name: 功能请求
2
+ description: 使用中文进行功能请求
3
+ labels: ['enhancement']
4
+ body:
5
+ - type: textarea
6
+ id: describe
7
+ attributes:
8
+ label: 在什么场景下,需要你请求的功能?
9
+ description: 简要描述相关的使用场景
10
+ validations:
11
+ required: false
12
+ - type: textarea
13
+ id: solution
14
+ attributes:
15
+ label: 解决方案
16
+ description: 描述你想要的解决方案
17
+ validations:
18
+ required: false
19
+ - type: textarea
20
+ id: additional
21
+ attributes:
22
+ label: 其他内容
23
+ description: 关于该功能请求的任何其他项目。
24
+ validations:
25
+ required: false
@@ -0,0 +1,26 @@
1
+ name: Feature request
2
+ description: Suggest an idea for this project
3
+ labels: ['enhancement']
4
+ body:
5
+ - type: textarea
6
+ id: describe
7
+ attributes:
8
+ label: Is your feature request related to a problem?
9
+ description: A clear and concise description of what the problem is
10
+ placeholder: Ex. I'm always frustrated when ...
11
+ validations:
12
+ required: false
13
+ - type: textarea
14
+ id: solution
15
+ attributes:
16
+ label: Describe the solution you'd like
17
+ description: A clear and concise description of what you want to happen
18
+ validations:
19
+ required: false
20
+ - type: textarea
21
+ id: additional
22
+ attributes:
23
+ label: Additional context
24
+ description: Add any other projects about the feature request here.
25
+ validations:
26
+ required: false
@@ -0,0 +1,94 @@
1
+ name: 上报 Bug
2
+ description: 使用中文进行 Bug 报告
3
+ labels: ['bug']
4
+ body:
5
+ - type: checkboxes
6
+ id: checks
7
+ attributes:
8
+ label: 在提问之前...
9
+ options:
10
+ - label: 我已经搜索了现有的 issues
11
+ required: true
12
+ - label: 我在提问题之前至少花费了 5 分钟来思考和准备
13
+ required: true
14
+ - label: 我已经认真且完整的阅读了 wiki
15
+ required: true
16
+ - label: 我已经认真检查了问题和网络环境无关(包括但不限于Google不可用,模型下载失败)
17
+ required: true
18
+ - type: markdown
19
+ attributes:
20
+ value: |
21
+ 感谢您使用本项目并反馈!
22
+ 请再次确认上述复选框所述的内容已经认真执行!
23
+ - type: textarea
24
+ id: environment
25
+ attributes:
26
+ label: 使用的环境
27
+ placeholder: |
28
+ - **OS**: Ubuntu 24.10
29
+ - **Python**: 3.12.0
30
+ - **pdf2zh**: 1.9.0
31
+ render: markdown
32
+ validations:
33
+ required: false
34
+ - type: dropdown
35
+ id: install
36
+ attributes:
37
+ label: 请选择安装方式
38
+ options:
39
+ - pip
40
+ - exe
41
+ - 源码
42
+ - docker
43
+ validations:
44
+ required: true
45
+ - type: textarea
46
+ id: describe
47
+ attributes:
48
+ label: 描述你的问题
49
+ description: 简要描述你的问题
50
+ validations:
51
+ required: true
52
+ - type: textarea
53
+ id: reproduce
54
+ attributes:
55
+ label: 如何复现
56
+ description: 重现该行为的步骤
57
+ value: |
58
+ 1. 执行 '...'
59
+ 2. 选择 '....'
60
+ 3. 出现问题
61
+ validations:
62
+ required: false
63
+ - type: textarea
64
+ id: expected
65
+ attributes:
66
+ label: 预期行为
67
+ description: 简要描述你期望得到的反馈
68
+ validations:
69
+ required: false
70
+ - type: textarea
71
+ id: logs
72
+ attributes:
73
+ label: 相关 Logs
74
+ description: 请复制并粘贴任何相关的日志输出。
75
+ render: Text
76
+ validations:
77
+ required: false
78
+ - type: textarea
79
+ id: PDFfile
80
+ attributes:
81
+ label: 原始PDF文件
82
+ description: |
83
+ 如果涉及到排版错误的问题,请一定提供原始的PDF文件,方便复现错误。
84
+ validations:
85
+ required: false
86
+ - type: textarea
87
+ id: others
88
+ attributes:
89
+ label: 还有别的吗?
90
+ description: |
91
+ 相关的配置?链接?参考资料?
92
+ 任何能让我们对你所遇到的问题有更多了解的东西。
93
+ validations:
94
+ required: false
@@ -0,0 +1,93 @@
1
+ name: Bug Report
2
+ description: Create a report to help us improve
3
+ labels: ['bug']
4
+ body:
5
+ - type: checkboxes
6
+ id: checks
7
+ attributes:
8
+ label: Before you asking
9
+ options:
10
+ - label: I have searched the existing issues
11
+ required: true
12
+ - label: I spend at least 5 minutes for thinking and preparing
13
+ required: true
14
+ - label: I have thoroughly and completely read the wiki.
15
+ required: true
16
+ - label: I have carefully checked the issue, and it is unrelated to the network environment.
17
+ required: true
18
+ - type: markdown
19
+ attributes:
20
+ value: |
21
+ Thank you for using this project and providing feedback!
22
+ - type: textarea
23
+ id: environment
24
+ attributes:
25
+ label: Environment
26
+ placeholder: |
27
+ - **OS**: Ubuntu 24.10
28
+ - **Python**: 3.12.0
29
+ - **pdf2zh**: 1.9.0
30
+ render: markdown
31
+ validations:
32
+ required: false
33
+ - type: dropdown
34
+ id: install
35
+ attributes:
36
+ label: How to install pdf2zh_next
37
+ options:
38
+ - pip
39
+ - exe
40
+ - source
41
+ - docker
42
+ validations:
43
+ required: true
44
+ - type: textarea
45
+ id: describe
46
+ attributes:
47
+ label: Describe the bug
48
+ description: A clear and concise description of what the bug is.
49
+ validations:
50
+ required: true
51
+ - type: textarea
52
+ id: reproduce
53
+ attributes:
54
+ label: To Reproduce
55
+ description: Steps to reproduce the behavior
56
+ value: |
57
+ 1. execute '...'
58
+ 2. select '....'
59
+ 3. see errors
60
+ validations:
61
+ required: false
62
+ - type: textarea
63
+ id: expected
64
+ attributes:
65
+ label: Expected behavior
66
+ description: A clear and concise description of what you expected to happen.
67
+ validations:
68
+ required: false
69
+ - type: textarea
70
+ id: logs
71
+ attributes:
72
+ label: Relevant log output
73
+ description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
74
+ render: Text
75
+ validations:
76
+ required: false
77
+ - type: textarea
78
+ id: PDFfile
79
+ attributes:
80
+ label: Origin PDF file
81
+ description: |
82
+ If the issue involves formatting errors, please provide the original PDF file to facilitate reproduction of the error.
83
+ validations:
84
+ required: false
85
+ - type: textarea
86
+ id: others
87
+ attributes:
88
+ label: Anything else?
89
+ description: |
90
+ Related configs? Links? References?
91
+ Anything that will give us more context about the issue you are encountering!
92
+ validations:
93
+ required: false
@@ -0,0 +1,21 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: github-actions
4
+ directory: "/"
5
+ schedule:
6
+ interval: weekly
7
+ # - package-ecosystem: pip
8
+ # directory: "/.github/workflows"
9
+ # schedule:
10
+ # interval: weekly
11
+ # - package-ecosystem: pip
12
+ # directory: "/docs"
13
+ # schedule:
14
+ # interval: weekly
15
+ - package-ecosystem: pip
16
+ directory: "/"
17
+ schedule:
18
+ interval: weekly
19
+ versioning-strategy: lockfile-only
20
+ allow:
21
+ - dependency-type: "all"
@@ -0,0 +1,55 @@
1
+ name-template: 'v$RESOLVED_VERSION'
2
+ tag-template: 'v$RESOLVED_VERSION'
3
+ categories:
4
+ - title: '🚀 Features'
5
+ labels:
6
+ - 'feature'
7
+ - 'enhancement'
8
+ - title: '🐛 Bug Fixes'
9
+ labels:
10
+ - 'fix'
11
+ - 'bugfix'
12
+ - 'bug'
13
+ - title: '🧰 Maintenance'
14
+ labels:
15
+ - 'chore'
16
+ - 'maintenance'
17
+ - 'refactor'
18
+ - title: '📝 Documentation'
19
+ labels:
20
+ - 'docs'
21
+ - 'documentation'
22
+ change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
23
+ change-title-escapes: '\<*_&' # You can add # and @ to disable mentions
24
+ version-resolver:
25
+ major:
26
+ labels:
27
+ - 'major'
28
+ minor:
29
+ labels:
30
+ - 'minor'
31
+ patch:
32
+ labels:
33
+ - 'patch'
34
+ default: patch
35
+ template: |
36
+ ## Changes
37
+
38
+ $CHANGES
39
+
40
+ ## Contributors
41
+
42
+ $CONTRIBUTORS
43
+
44
+ ## Windows Specific
45
+
46
+ If you cannot open it after downloading, please install https://aka.ms/vs/17/release/vc_redist.x64.exe and try again.
47
+
48
+ ## Assets
49
+
50
+ - pdf2zh-v$RESOLVED_VERSION-win64.zip: pdf2zh **without** assets(font, model, etc.)
51
+ - pdf2zh-v$RESOLVED_VERSION-with-assets-win64.zip: (**Recommended**) pdf2zh **with** assets(font, model, etc.)
52
+
53
+ > [!NOTE]
54
+ >
55
+ > The version without assets will also dynamically download resources when running, but the download may fail due to network issues.
@@ -0,0 +1,171 @@
1
+ name: windows exe Release Workflow
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ release_version:
7
+ description: 'Release Version (e.g., v1.0.0)'
8
+ required: true
9
+ type: string
10
+ # push:
11
+ # debug purpose
12
+ env:
13
+ WIN_EXE_PYTHON_VERSION: 3.13.3
14
+ jobs:
15
+ build-win64-exe:
16
+ runs-on: windows-latest
17
+ steps:
18
+ - name: checkout babeldoc metadata
19
+ uses: actions/checkout@v4
20
+ with:
21
+ repository: funstory-ai/BabelDOC
22
+ path: babeldoctemp1234567
23
+ token: ${{ secrets.GITHUB_TOKEN }}
24
+ sparse-checkout: babeldoc/assets/embedding_assets_metadata.py
25
+ - name: Cached Assets
26
+ id: cache-assets
27
+ uses: actions/cache@v4.2.2
28
+ with:
29
+ path: ~/.cache/babeldoc
30
+ key: test-1-babeldoc-assets-${{ hashFiles('babeldoctemp1234567/babeldoc/assets/embedding_assets_metadata.py') }}
31
+ - name: 检出代码
32
+ uses: actions/checkout@v4
33
+
34
+ - name: Setup uv with Python ${{ env.WIN_EXE_PYTHON_VERSION }}
35
+ uses: astral-sh/setup-uv@f94ec6bedd8674c4426838e6b50417d36b6ab231 # v5.3.1
36
+ with:
37
+ python-version: ${{ env.WIN_EXE_PYTHON_VERSION }}
38
+ enable-cache: true
39
+ cache-dependency-glob: "pyproject.toml"
40
+
41
+ - name: 执行所有任务(创建目录、下载、解压、复制文件、安装依赖)
42
+ shell: pwsh
43
+ run: |
44
+ Write-Host "==== 删除 babeldoctemp1234567 文件夹 ===="
45
+ if (Test-Path "./babeldoctemp1234567") {
46
+ Remove-Item -Path "./babeldoctemp1234567" -Recurse -Force
47
+ Write-Host "babeldoctemp1234567 文件夹已成功删除"
48
+ } else {
49
+ Write-Host "babeldoctemp1234567 文件夹不存在,无需删除"
50
+ }
51
+ Write-Host "==== 创建必要的目录 ===="
52
+ New-Item -Path "./build" -ItemType Directory -Force
53
+ New-Item -Path "./build/runtime" -ItemType Directory -Force
54
+ New-Item -Path "./dep_build" -ItemType Directory -Force
55
+
56
+ Write-Host "==== 复制代码到 dep_build ===="
57
+ Get-ChildItem -Path "./" -Exclude "dep_build", "build" | Copy-Item -Destination "./dep_build" -Recurse -Force
58
+
59
+ Write-Host "==== 下载并解压 Python ${{ env.WIN_EXE_PYTHON_VERSION }} ===="
60
+ Write-Host "pythonUrl: https://www.python.org/ftp/python/${{ env.WIN_EXE_PYTHON_VERSION }}/python-${{ env.WIN_EXE_PYTHON_VERSION }}-embed-amd64.zip"
61
+ $pythonUrl = "https://www.python.org/ftp/python/${{ env.WIN_EXE_PYTHON_VERSION }}/python-${{ env.WIN_EXE_PYTHON_VERSION }}-embed-amd64.zip"
62
+ $pythonZip = "./dep_build/python.zip"
63
+ Invoke-WebRequest -Uri $pythonUrl -OutFile $pythonZip
64
+ Expand-Archive -Path $pythonZip -DestinationPath "./build/runtime" -Force
65
+
66
+ Write-Host "==== 下载并解压 PyStand ===="
67
+ $pystandUrl = "https://github.com/skywind3000/PyStand/releases/download/1.1.4/PyStand-v1.1.4-exe.zip"
68
+ $pystandZip = "./dep_build/PyStand.zip"
69
+ Invoke-WebRequest -Uri $pystandUrl -OutFile $pystandZip
70
+ Expand-Archive -Path $pystandZip -DestinationPath "./dep_build/PyStand" -Force
71
+
72
+ Write-Host "==== 复制 PyStand.exe 到 build 并重命名 ===="
73
+ $pystandExe = "./dep_build/PyStand/PyStand-x64-CLI/PyStand.exe"
74
+ $destExe = "./build/pdf2zh.exe"
75
+ if (Test-Path $pystandExe) {
76
+ Copy-Item -Path $pystandExe -Destination $destExe -Force
77
+ } else {
78
+ Write-Host "错误: PyStand.exe 未找到!"
79
+ exit 1
80
+ }
81
+ Write-Host "==== 创建 Python venv 在 dep_build ===="
82
+ uv venv ./dep_build/venv
83
+
84
+ ./dep_build/venv/Scripts/activate
85
+
86
+ Write-Host "==== 在 venv 环境中安装项目依赖 ===="
87
+ uv pip install .
88
+
89
+ Write-Host "==== 复制 venv/Lib/site-packages 到 build/ ===="
90
+ Copy-Item -Path "./dep_build/venv/Lib/site-packages" -Destination "./build/site-packages" -Recurse -Force
91
+
92
+ Write-Host "==== 复制 script/_pystand_static.int 到 build/ ===="
93
+ $staticFile = "./script/_pystand_static.int"
94
+ $destStatic = "./build/_pystand_static.int"
95
+ if (Test-Path $staticFile) {
96
+ Copy-Item -Path $staticFile -Destination $destStatic -Force
97
+ } else {
98
+ Write-Host "错误: script/_pystand_static.int 未找到!"
99
+ exit 1
100
+ }
101
+
102
+ uv run --active babeldoc --generate-offline-assets ./build
103
+
104
+ - name: Upload build artifact
105
+ uses: actions/upload-artifact@v4
106
+ with:
107
+ name: win64-exe
108
+ path: ./build
109
+ if-no-files-found: error
110
+ compression-level: 9
111
+ include-hidden-files: true
112
+
113
+ test-win64-exe:
114
+ needs:
115
+ - build-win64-exe
116
+ runs-on: windows-latest
117
+ steps:
118
+ - name: 检出代码
119
+ uses: actions/checkout@v4
120
+
121
+ - name: Download build artifact
122
+ uses: actions/download-artifact@v4
123
+ with:
124
+ name: win64-exe
125
+ path: ./build
126
+
127
+ - name: Test show version
128
+ run: |
129
+ ./build/pdf2zh.exe --version
130
+
131
+ - name: Test - Translate a PDF file with plain text only
132
+ run: |
133
+ ./build/pdf2zh.exe ./test/file/translate.cli.plain.text.pdf -o ./test/file
134
+
135
+ - name: Test - Translate a PDF file figure
136
+ run: |
137
+ ./build/pdf2zh.exe ./test/file/translate.cli.text.with.figure.pdf -o ./test/file
138
+
139
+ - name: Delete offline assets and cache
140
+ shell: pwsh
141
+ run: |
142
+ Write-Host "==== 查找并删除离线资源包 ===="
143
+ $offlineAssetsPath = Get-ChildItem -Path "./build" -Filter "offline_assets_*.zip" -Recurse | Select-Object -First 1 -ExpandProperty FullName
144
+ if ($offlineAssetsPath) {
145
+ Write-Host "找到离线资源包: $offlineAssetsPath"
146
+ Remove-Item -Path $offlineAssetsPath -Force
147
+ Write-Host "已删除离线资源包"
148
+ } else {
149
+ Write-Host "未找到离线资源包"
150
+ }
151
+
152
+ Write-Host "==== 删除缓存目录 ===="
153
+ $cachePath = "$env:USERPROFILE/.cache/babeldoc"
154
+ if (Test-Path $cachePath) {
155
+ Remove-Item -Path $cachePath -Recurse -Force
156
+ Write-Host "已删除缓存目录: $cachePath"
157
+ } else {
158
+ Write-Host "缓存目录不存在: $cachePath"
159
+ }
160
+
161
+ - name: Test - Translate without offline assets
162
+ run: |
163
+ ./build/pdf2zh.exe ./test/file/translate.cli.plain.text.pdf -o ./test/file
164
+
165
+ - name: Upload test results
166
+ uses: actions/upload-artifact@v4
167
+ with:
168
+ name: test-results
169
+ path: ./test/file/
170
+
171
+