Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.
Python ai4sciencedocument-analysisdocxextract-datalayout-analysisocrparserpdfpdf-converterpdf-extractor-llmpdf-extractor-pretrainpdf-extractor-ragpdf-parserpptxpythonxlsx
fix(ci): translate retention help and isolate optional Torch tests
myhloli75c181a3873d
diff --git a/mineru/kit/commands/api_server.py b/mineru/kit/commands/api_server.pyindex ffa53707..11732c0d 100644--- a/mineru/kit/commands/api_server.py+++ b/mineru/kit/commands/api_server.py@@ -46,7 +46,7 @@ def api_server_cmd("--retention-seconds",min=0,envvar="MINERU_API_RETENTION_SECONDS",- help="Terminal retention seconds (default 86400; 0 disables collection)",+ help=t("Terminal retention seconds (default 86400; 0 disables collection)"),),concurrency: int = typer.Option(1, "--concurrency", help=t("Maximum concurrent parse jobs")),url_timeout: int = typer.Option(60, "--url-timeout", help=t("Timeout for URL source downloads")),diff --git a/mineru/kit/router/cli.py b/mineru/kit/router/cli.pyindex a71f5aef..beeebdd0 100644--- a/mineru/kit/router/cli.py+++ b/mineru/kit/router/cli.py@@ -35,7 +35,7 @@ def router_cmd("--retention-seconds",min=0,envvar="MINERU_API_RETENTION_SECONDS",- help="Terminal retention seconds (default 86400; 0 disables collection)",+ help=t("Terminal retention seconds (default 86400; 0 disables collection)"),),preload_models: bool = typer.Option(False, "--preload-models", help=t("Preload models in managed workers")),) -> None:diff --git a/mineru/utils/translations.py b/mineru/utils/translations.pyindex 418412b7..d9af6e20 100644--- a/mineru/utils/translations.py+++ b/mineru/utils/translations.py@@ -488,6 +488,7 @@ ZH_MESSAGES: dict[str, str] = {"Server capability tier: flash, basic, or standard": "服务能力档位: flash、basic 或 standard","Disable Flash tier advertisement and execution": "禁用 Flash 档位的广播与执行","Disable Advanced tier advertisement and execution": "禁用 Advanced 档位的广播与执行",+ "Terminal retention seconds (default 86400; 0 disables collection)": "终态资源保留秒数(默认 86400;0 表示禁用回收)","Maximum concurrent parse jobs": "最大并发解析任务数","Timeout for URL source downloads": "URL 来源下载超时","Allow local source paths": "允许本地来源路径",diff --git a/tests/unittest/test_onnx_model_stack.py b/tests/unittest/test_onnx_model_stack.pyindex b3e1810d..e42f7b0c 100644--- a/tests/unittest/test_onnx_model_stack.py+++ b/tests/unittest/test_onnx_model_stack.py@@ -220,8 +220,10 @@ def test_seal_uses_poly_crops_and_keeps_variable_vertex_counts(monkeypatch: pytedef test_atom_and_context_caches_are_isolated_by_stack(monkeypatch: pytest.MonkeyPatch) -> None:"""同一 CPU 上的 full/light 原子模型与上下文必须分别缓存。"""- from mineru.model.runtime import hybrid+ from mineru.model.runtime import cpu_threads, hybrid+ # 缓存测试使用模型替身,同时隔离真实 Torch 的线程初始化依赖。+ monkeypatch.setattr(cpu_threads, "initialize_torch_threads", Mock(return_value=2))monkeypatch.setattr(hybrid.AtomModelSingleton, "_models", {})monkeypatch.setattr(hybrid.HybridLocalModelContextSingleton, "_models", {})factory = Mock(side_effect=lambda **kwargs: object())diff --git a/tests/unittest/test_torch_cpu_threads.py b/tests/unittest/test_torch_cpu_threads.pyindex 722b430c..3da413f7 100644--- a/tests/unittest/test_torch_cpu_threads.py+++ b/tests/unittest/test_torch_cpu_threads.py@@ -76,6 +76,8 @@ assert "torch" not in sys.modulesdef test_real_torch_thread_pool_propagation() -> None:"""用独立进程验证实际 PyTorch 的后续线程按首次选定上限执行算子。"""+ # 基础 ONNX 安装不要求 Torch,真实算子验证仅在可选后端可用时执行。+ pytest.importorskip("torch")code = """import osos.environ["MINERU_CPU_NUM_THREADS"]="2"os.environ.pop("OMP_NUM_THREADS",None)