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
feat: rearrange skill
jinzhenj10ea049abe7b
diff --git a/.github/scripts/alpha_release.py b/.github/scripts/alpha_release.pynew file mode 100644index 00000000..335eadf5--- /dev/null+++ b/.github/scripts/alpha_release.py@@ -0,0 +1,121 @@+from __future__ import annotations++import argparse+import ast+import re+import zipfile+from dataclasses import dataclass+from email.parser import Parser+from pathlib import Path+++ALPHA_TAG_PATTERN = re.compile(r"^v(?P<version>(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)a[1-9]\d*)$")+++@dataclass(frozen=True)+class WheelMetadata:+ name: str+ version: str+++def parse_alpha_tag(tag: str) -> str:+ match = ALPHA_TAG_PATTERN.fullmatch(tag)+ if match is None:+ raise ValueError(f"Invalid Alpha release tag {tag!r}; expected canonical format vX.Y.ZaN, for example v4.0.0a1.")+ return match.group("version")+++def read_declared_version(version_file: str | Path) -> str:+ path = Path(version_file)+ module = ast.parse(path.read_text(encoding="utf-8"), filename=str(path))+ declared_versions: list[str] = []++ for statement in module.body:+ if not isinstance(statement, ast.Assign) or len(statement.targets) != 1:+ continue+ target = statement.targets[0]+ if not isinstance(target, ast.Name) or target.id != "__version__":+ continue+ if not isinstance(statement.value, ast.Constant) or not isinstance(statement.value.value, str):+ raise ValueError(f"{path} must assign __version__ to a string literal.")+ declared_versions.append(statement.value.value)++ if len(declared_versions) != 1:+ raise ValueError(f"{path} must contain exactly one top-level __version__ assignment.")+ return declared_versions[0]+++def validate_source(tag: str, version_file: str | Path) -> str:+ tag_version = parse_alpha_tag(tag)+ declared_version = read_declared_version(version_file)+ if declared_version != tag_version:+ raise ValueError(+ f"Release tag {tag!r} declares version {tag_version!r}, but {version_file} declares {declared_version!r}."+ )+ return tag_version+++def read_wheel_metadata(wheel: str | Path) -> WheelMetadata:+ path = Path(wheel)+ with zipfile.ZipFile(path) as archive:+ metadata_files = [name for name in archive.namelist() if name.endswith(".dist-info/METADATA")]+ if len(metadata_files) != 1:+ raise ValueError(f"{path} must contain exactly one .dist-info/METADATA file.")+ metadata_text = archive.read(metadata_files[0]).decode("utf-8")++ metadata = Parser().parsestr(metadata_text)+ name = metadata.get("Name")+ version = metadata.get("Version")+ if not name or not version:+ raise ValueError(f"{path} metadata must contain Name and Version fields.")+ return WheelMetadata(name=name, version=version)+++def validate_wheel(wheel: str | Path, *, expected_name: str, expected_version: str) -> WheelMetadata:+ metadata = read_wheel_metadata(wheel)+ if metadata.name != expected_name:+ raise ValueError(f"Wheel project name is {metadata.name!r}; expected {expected_name!r}.")+ if metadata.version != expected_version:+ raise ValueError(f"Wheel version is {metadata.version!r}; expected {expected_version!r}.")+ return metadata+++def _build_parser() -> argparse.ArgumentParser:+ parser = argparse.ArgumentParser(description="Validate MinerU Alpha release source and wheel metadata.")+ subparsers = parser.add_subparsers(dest="command", required=True)++ source_parser = subparsers.add_parser("validate-source", help="Validate the release tag against mineru/version.py.")+ source_parser.add_argument("--tag", required=True)+ source_parser.add_argument("--version-file", required=True)++ wheel_parser = subparsers.add_parser("validate-wheel", help="Validate the built wheel name and version.")+ wheel_parser.add_argument("--wheel", required=True)+ wheel_parser.add_argument("--expected-name", default="mineru")+ wheel_parser.add_argument("--expected-version", required=True)++ return parser+++def main() -> int:+ parser = _build_parser()+ args = parser.parse_args()++ if args.command == "validate-source":+ print(validate_source(args.tag, args.version_file))+ return 0++ if args.command == "validate-wheel":+ metadata = validate_wheel(+ args.wheel,+ expected_name=args.expected_name,+ expected_version=args.expected_version,+ )+ print(f"Validated {metadata.name} {metadata.version}.")+ return 0++ parser.error(f"Unsupported command: {args.command}")+ return 2+++if __name__ == "__main__":+ raise SystemExit(main())diff --git a/.github/scripts/next_dev_release.py b/.github/scripts/next_dev_release.pydeleted file mode 100644index a17e2798..00000000--- a/.github/scripts/next_dev_release.py+++ /dev/null@@ -1,314 +0,0 @@-from __future__ import annotations--import argparse-import json-from dataclasses import dataclass-from dataclasses import field-from datetime import UTC, datetime-from pathlib import Path---DEFAULT_BASE_VERSION = "4.0.0"---@dataclass(frozen=True)-class ReleaseRecord:- version: str- source_branch: str- source_commit: str- trigger: str- published_at: str---@dataclass(frozen=True)-class ReleaseState:- package: str- version: str- source_branch: str- source_commit: str- published_at: str- last_auto_date: str | None = None- daily_sequences: dict[str, int] = field(default_factory=dict)- releases: list[ReleaseRecord] = field(default_factory=list)---@dataclass(frozen=True)-class ReleasePlan:- should_publish: bool- version: str- release_date: str- sequence: int- reason: str---def build_version(base_version: str = DEFAULT_BASE_VERSION, now: datetime | None = None, sequence: int = 0) -> str:- current = now or datetime.now(UTC)- return build_version_for_date(base_version, current.strftime("%Y%m%d"), sequence)---def build_version_for_date(base_version: str, release_date: str, sequence: int) -> str:- if sequence < 0 or sequence > 99:- raise ValueError("Daily release sequence must be between 0 and 99.")- return f"{base_version}.dev{release_date}{sequence:02d}"---def read_state(state_file: str | Path) -> ReleaseState | None:- path = Path(state_file)- if not path.is_file():- return None- payload = json.loads(path.read_text(encoding="utf-8"))- releases = [- ReleaseRecord(- version=release["version"],- source_branch=release["source_branch"],- source_commit=release["source_commit"],- trigger=release.get("trigger", "unknown"),- published_at=release["published_at"],- )- for release in payload.get("releases", [])- ]- return ReleaseState(- package=payload["package"],- version=payload["version"],- source_branch=payload["source_branch"],- source_commit=payload["source_commit"],- published_at=payload["published_at"],- last_auto_date=payload.get("last_auto_date"),- daily_sequences={key: int(value) for key, value in payload.get("daily_sequences", {}).items()},- releases=releases,- )---def _known_published_commits(state: ReleaseState | None) -> set[str]:- if state is None:- return set()- commits = {state.source_commit}- commits.update(release.source_commit for release in state.releases)- return commits---def plan_release(- state: ReleaseState | None,- *,- base_version: str,- source_commit: str,- trigger: str,- force_publish: bool = False,- now: datetime | None = None,-) -> ReleasePlan:- current = now or datetime.now(UTC)- release_date = current.strftime("%Y%m%d")- iso_date = current.date().isoformat()-- if trigger == "schedule" and state is not None and state.last_auto_date == iso_date:- sequence = state.daily_sequences.get(release_date, 0)- version = build_version_for_date(base_version, release_date, sequence)- return ReleasePlan(False, version, release_date, sequence, f"automatic release already ran on {iso_date}")-- published_commits = _known_published_commits(state)- if source_commit in published_commits and not force_publish:- sequence = 0 if state is None else state.daily_sequences.get(release_date, 0)- version = build_version_for_date(base_version, release_date, sequence)- return ReleasePlan(False, version, release_date, sequence, "source commit was already published")-- previous_sequence = -1 if state is None else state.daily_sequences.get(release_date, -1)- sequence = previous_sequence + 1- version = build_version_for_date(base_version, release_date, sequence)- return ReleasePlan(True, version, release_date, sequence, "publish requested")---def write_state(- state_file: str | Path,- *,- package: str,- version: str,- source_branch: str,- source_commit: str,- trigger: str = "unknown",- release_date: str | None = None,- sequence: int | None = None,- published_at: str | None = None,-) -> None:- path = Path(state_file)- previous = read_state(path)- published_at_value = published_at or datetime.now(UTC).replace(microsecond=0).isoformat().replace("+00:00", "Z")- daily_sequences = dict(previous.daily_sequences) if previous is not None else {}- if release_date is not None and sequence is not None:- daily_sequences[release_date] = sequence-- releases = list(previous.releases) if previous is not None else []- releases.append(- ReleaseRecord(- version=version,- source_branch=source_branch,- source_commit=source_commit,- trigger=trigger,- published_at=published_at_value,- )- )-- last_auto_date = previous.last_auto_date if previous is not None else None- if trigger == "schedule":- if release_date is not None:- last_auto_date = f"{release_date[:4]}-{release_date[4:6]}-{release_date[6:]}"- elif published_at_value.endswith("Z"):- last_auto_date = published_at_value[:10]- else:- last_auto_date = datetime.now(UTC).date().isoformat()-- path.parent.mkdir(parents=True, exist_ok=True)- payload = {- "package": package,- "version": version,- "source_branch": source_branch,- "source_commit": source_commit,- "published_at": published_at_value,- "last_auto_date": last_auto_date,- "daily_sequences": daily_sequences,- "releases": [- {- "version": release.version,- "source_branch": release.source_branch,- "source_commit": release.source_commit,- "trigger": release.trigger,- "published_at": release.published_at,- }- for release in releases- ],- }- path.write_text(f"{json.dumps(payload, ensure_ascii=True, indent=2)}\n", encoding="utf-8")---def patch_pyproject_package_name(pyproject_path: str | Path, package_name: str) -> None:- path = Path(pyproject_path)- lines = path.read_text(encoding="utf-8").splitlines()- in_project_section = False- replaced = False- updated_lines: list[str] = []-- for line in lines:- stripped = line.strip()- if stripped.startswith("[") and stripped.endswith("]"):- in_project_section = stripped == "[project]"- if in_project_section and stripped.startswith("name = "):- updated_lines.append(f'name = "{package_name}"')- replaced = True- else:- updated_lines.append(line)-- if not replaced:- raise ValueError(f"Could not find [project].name in {path}")-- path.write_text("\n".join(updated_lines) + "\n", encoding="utf-8")---def patch_version_file(version_file_path: str | Path, version: str) -> None:- Path(version_file_path).write_text(f'__version__ = "{version}"\n', encoding="utf-8")---def patch_workspace(- *,- pyproject_path: str | Path,- version_file_path: str | Path,- package_name: str,- version: str,-) -> None:- patch_pyproject_package_name(pyproject_path, package_name)- patch_version_file(version_file_path, version)---def _build_parser() -> argparse.ArgumentParser:- parser = argparse.ArgumentParser(description="Helper utilities for mineru-next-dev daily release workflow.")- subparsers = parser.add_subparsers(dest="command", required=True)-- version_parser = subparsers.add_parser("version", help="Generate the next-dev package version.")- version_parser.add_argument("--base-version", default=DEFAULT_BASE_VERSION)- version_parser.add_argument("--sequence", type=int, default=0)-- plan_parser = subparsers.add_parser("plan-github-output", help="Write the release plan as GitHub output lines.")- plan_parser.add_argument("--state-file", required=True)- plan_parser.add_argument("--base-version", default=DEFAULT_BASE_VERSION)- plan_parser.add_argument("--source-commit", required=True)- plan_parser.add_argument("--trigger", required=True)- plan_parser.add_argument("--force-publish", choices=["true", "false"], default="false")-- state_commit_parser = subparsers.add_parser("state-commit", help="Print the last published source commit from state.")- state_commit_parser.add_argument("--state-file", required=True)-- write_state_parser = subparsers.add_parser("write-state", help="Write release state JSON.")- write_state_parser.add_argument("--state-file", required=True)- write_state_parser.add_argument("--package", required=True)- write_state_parser.add_argument("--version", required=True)- write_state_parser.add_argument("--source-branch", required=True)- write_state_parser.add_argument("--source-commit", required=True)- write_state_parser.add_argument("--trigger", required=True)- write_state_parser.add_argument("--release-date", required=True)- write_state_parser.add_argument("--sequence", type=int, required=True)- write_state_parser.add_argument("--published-at")-- patch_parser = subparsers.add_parser("patch-workspace", help="Patch package name and version in the workspace.")- patch_parser.add_argument("--pyproject", required=True)- patch_parser.add_argument("--version-file", required=True)- patch_parser.add_argument("--package-name", required=True)- patch_parser.add_argument("--version", required=True)-- return parser---def main() -> int:- parser = _build_parser()- args = parser.parse_args()-- if args.command == "version":- print(build_version(base_version=args.base_version, sequence=args.sequence))- return 0-- if args.command == "plan-github-output":- plan = plan_release(- read_state(args.state_file),- base_version=args.base_version,- source_commit=args.source_commit,- trigger=args.trigger,- force_publish=args.force_publish == "true",- )- print(f"should_publish={str(plan.should_publish).lower()}")- print(f"version={plan.version}")- print(f"release_date={plan.release_date}")- print(f"sequence={plan.sequence}")- print(f"skip_reason={plan.reason}")- return 0-- if args.command == "state-commit":- state = read_state(args.state_file)- print("" if state is None else state.source_commit)- return 0-- if args.command == "write-state":- write_state(- args.state_file,- package=args.package,- version=args.version,- source_branch=args.source_branch,- source_commit=args.source_commit,- trigger=args.trigger,- release_date=args.release_date,- sequence=args.sequence,- published_at=args.published_at,- )- return 0-- if args.command == "patch-workspace":- patch_workspace(- pyproject_path=args.pyproject,- version_file_path=args.version_file,- package_name=args.package_name,- version=args.version,- )- return 0-- parser.error(f"Unsupported command: {args.command}")- return 2---if __name__ == "__main__":- raise SystemExit(main())diff --git a/.github/workflows/alpha-release.yml b/.github/workflows/alpha-release.ymlnew file mode 100644index 00000000..988c2a51--- /dev/null+++ b/.github/workflows/alpha-release.yml@@ -0,0 +1,139 @@+name: MinerU Alpha release++on:+ push:+ tags:+ - "v*.*.*a*"++permissions:+ contents: read++concurrency:+ group: mineru-alpha-release-${{ github.ref }}+ cancel-in-progress: false++jobs:+ build:+ name: Validate and build Alpha wheel+ runs-on: ubuntu-latest+ outputs:+ version: ${{ steps.source.outputs.version }}+ steps:+ - name: Checkout tagged source+ uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6+ with:+ ref: ${{ github.ref }}+ fetch-depth: 0+ persist-credentials: false++ - name: Set up Python+ uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6+ with:+ python-version: "3.12"++ - name: Verify annotated tag and next branch ancestry+ run: |+ if [[ "$(git cat-file -t "$GITHUB_REF")" != "tag" ]]; then+ echo "Alpha releases require an annotated Git tag." >&2+ exit 1+ fi++ git fetch --no-tags origin next:refs/remotes/origin/next+ if ! git merge-base --is-ancestor HEAD refs/remotes/origin/next; then+ echo "Alpha release tag must point to a commit contained in origin/next." >&2+ exit 1+ fi++ - name: Validate Alpha tag and source version+ id: source+ run: |+ version="$(python .github/scripts/alpha_release.py validate-source \+ --tag "$GITHUB_REF_NAME" \+ --version-file mineru/version.py)"+ echo "version=$version" >> "$GITHUB_OUTPUT"++ - name: Install build tooling+ run: python -m pip install --upgrade build twine++ - name: Build and check wheel+ run: |+ python -m build --wheel+ python -m twine check --strict dist/*++ wheels=(dist/*.whl)+ if [[ "${#wheels[@]}" -ne 1 ]]; then+ echo "Expected exactly one wheel, found ${#wheels[@]}." >&2+ exit 1+ fi+ python .github/scripts/alpha_release.py validate-wheel \+ --wheel "${wheels[0]}" \+ --expected-name mineru \+ --expected-version "${{ steps.source.outputs.version }}"++ - name: Smoke-test wheel installation+ env:+ EXPECTED_VERSION: ${{ steps.source.outputs.version }}+ run: |+ python -m venv "$RUNNER_TEMP/mineru-alpha-smoke"+ "$RUNNER_TEMP/mineru-alpha-smoke/bin/python" -m pip install --no-deps dist/*.whl+ "$RUNNER_TEMP/mineru-alpha-smoke/bin/python" - <<'PY'+ import os+ from importlib.metadata import version++ installed_version = version("mineru")+ expected_version = os.environ["EXPECTED_VERSION"]+ if installed_version != expected_version:+ raise SystemExit(f"Installed mineru version {installed_version!r} != {expected_version!r}")+ PY++ - name: Upload validated wheel+ uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6+ with:+ name: mineru-${{ steps.source.outputs.version }}+ path: dist/*.whl+ if-no-files-found: error+ retention-days: 30++ publish-pypi:+ name: Publish Alpha wheel to PyPI+ needs: build+ runs-on: ubuntu-latest+ environment:+ name: pypi+ url: https://pypi.org/project/mineru/${{ needs.build.outputs.version }}/+ permissions:+ id-token: write+ steps:+ - name: Download validated wheel+ uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7+ with:+ name: mineru-${{ needs.build.outputs.version }}+ path: dist++ - name: Publish wheel through PyPI Trusted Publishing+ uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1++ github-release:+ name: Create GitHub pre-release+ needs: [build, publish-pypi]+ runs-on: ubuntu-latest+ permissions:+ contents: write+ steps:+ - name: Download published wheel+ uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7+ with:+ name: mineru-${{ needs.build.outputs.version }}+ path: dist++ - name: Create GitHub pre-release+ env:+ GH_TOKEN: ${{ github.token }}+ VERSION: ${{ needs.build.outputs.version }}+ run: |+ gh release create "$GITHUB_REF_NAME" dist/*.whl \+ --repo "$GITHUB_REPOSITORY" \+ --verify-tag \+ --prerelease \+ --title "MinerU $VERSION" \+ --generate-notesdiff --git a/.github/workflows/next-dev-release.yml b/.github/workflows/next-dev-release.ymldeleted file mode 100644index cfc3d39c..00000000--- a/.github/workflows/next-dev-release.yml+++ /dev/null@@ -1,137 +0,0 @@-name: mineru-next-dev-release--on:- schedule:- - cron: "20 2 * * *"- workflow_dispatch:- inputs:- force_publish:- description: "Publish a new build even when the current next commit was already published."- required: false- default: false- type: boolean--permissions:- contents: write--concurrency:- group: mineru-next-dev-release- cancel-in-progress: false--jobs:- publish-next-dev:- if: github.repository == 'johnking0099/MinerU-Repo'- runs-on: ubuntu-latest- env:- PACKAGE_NAME: mineru-next-dev- BASE_VERSION: 4.0.0- SOURCE_BRANCH: next- STATE_BRANCH: release-state- STATE_FILE: .github/release-state/mineru-next-dev.json- steps:- - name: Checkout next- uses: actions/checkout@v6- with:- ref: next- fetch-depth: 0-- - name: Set up Python- uses: actions/setup-python@v6- with:- python-version: "3.12"-- - name: Resolve release metadata- id: release_meta- run: |- echo "current_commit=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"-- - name: Prepare release-state worktree- id: release_state- env:- FORCE_PUBLISH: ${{ inputs.force_publish || false }}- run: |- state_dir="$RUNNER_TEMP/release-state"- git fetch origin "$STATE_BRANCH" || true-- if git show-ref --verify --quiet "refs/remotes/origin/$STATE_BRANCH"; then- git worktree add --force "$state_dir" "refs/remotes/origin/$STATE_BRANCH"- else- git worktree add --detach "$state_dir" HEAD- git -C "$state_dir" checkout --orphan "$STATE_BRANCH"- git -C "$state_dir" rm -rf --ignore-unmatch . >/dev/null 2>&1 || true- git -C "$state_dir" clean -fdx >/dev/null 2>&1 || true- fi-- previous_commit="$(python .github/scripts/next_dev_release.py state-commit --state-file "$state_dir/$STATE_FILE")"- python .github/scripts/next_dev_release.py plan-github-output \- --state-file "$state_dir/$STATE_FILE" \- --base-version "$BASE_VERSION" \- --source-commit "${{ steps.release_meta.outputs.current_commit }}" \- --trigger "${{ github.event_name }}" \- --force-publish "$FORCE_PUBLISH" >> "$GITHUB_OUTPUT"-- echo "state_dir=$state_dir" >> "$GITHUB_OUTPUT"- echo "previous_commit=$previous_commit" >> "$GITHUB_OUTPUT"-- - name: Stop when release plan skips publish- if: steps.release_state.outputs.should_publish != 'true'- run: |- echo "Skip publish: ${{ steps.release_state.outputs.skip_reason }}."-- - name: Install build tooling- if: steps.release_state.outputs.should_publish == 'true'- run: |- python -m pip install --upgrade pip- python -m pip install build twine-- - name: Patch package metadata for next-dev release- if: steps.release_state.outputs.should_publish == 'true'- run: |- python .github/scripts/next_dev_release.py patch-workspace \- --pyproject pyproject.toml \- --version-file mineru/version.py \- --package-name "$PACKAGE_NAME" \- --version "${{ steps.release_state.outputs.version }}"-- - name: Build distribution- if: steps.release_state.outputs.should_publish == 'true'- run: |- python -m build --wheel- python -m twine check dist/*-- - name: Publish to PyPI- if: steps.release_state.outputs.should_publish == 'true'- env:- PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}- run: |- python -m twine upload dist/* -u __token__ -p "$PYPI_TOKEN"-- - name: Update release-state branch- if: steps.release_state.outputs.should_publish == 'true'- run: |- state_dir="${{ steps.release_state.outputs.state_dir }}"- python .github/scripts/next_dev_release.py write-state \- --state-file "$state_dir/$STATE_FILE" \- --package "$PACKAGE_NAME" \- --version "${{ steps.release_state.outputs.version }}" \- --source-branch "$SOURCE_BRANCH" \- --source-commit "${{ steps.release_meta.outputs.current_commit }}" \- --trigger "${{ github.event_name }}" \- --release-date "${{ steps.release_state.outputs.release_date }}" \- --sequence "${{ steps.release_state.outputs.sequence }}"-- git -C "$state_dir" config user.name "github-actions[bot]"- git -C "$state_dir" config user.email "41898282+github-actions[bot]@users.noreply.github.com"- git -C "$state_dir" add "$STATE_FILE"-- if git -C "$state_dir" diff --cached --quiet; then- echo "No release-state changes to commit."- else- git -C "$state_dir" commit -m "Update mineru-next-dev release state for ${{ steps.release_state.outputs.version }}"- git -C "$state_dir" push origin HEAD:"$STATE_BRANCH"- fi-- - name: Remove release-state worktree- if: always() && steps.release_state.outputs.state_dir != ''- run: |- git worktree remove --force "${{ steps.release_state.outputs.state_dir }}" || truediff --git a/README.md b/README.mdindex 54d30644..24642d0d 100644--- a/README.md+++ b/README.md@@ -1,425 +1,786 @@-<div align="center" xmlns="http://www.w3.org/1999/html">-<!-- logo -->-<p align="center">- <img src="https://gcore.jsdelivr.net/gh/opendatalab/MinerU@master/docs/images/MinerU-logo.png" width="300px" style="vertical-align:middle;">-</p>+---+name: mineru+description: Use MinerU when an agent needs to read, parse, OCR, search, inspect, or cite local documents, including PDFs, scanned documents, images, DOCX, PPTX, XLSX, academic papers, long documents, tables, formulas, and document locators. Use for agent-native document reading workflows that should prefer local privacy, structured errors, continuation, and stable page/block locators.+---++# MinerU-<!-- icon -->+[Agent Guide](README.md) | [English](README_en.md) | [简体中文](README_zh.md)-[](https://github.com/opendatalab/MinerU)-[](https://github.com/opendatalab/MinerU)-[](https://github.com/opendatalab/MinerU/issues)-[](https://github.com/opendatalab/MinerU/issues)-[](https://pypi.org/project/mineru/)-[](https://pypi.org/project/mineru/)-[](https://pepy.tech/project/mineru)-[](https://pepy.tech/project/mineru)-[](https://mineru.net/OpenSourceTools/Extractor?source=github)-[](https://huggingface.co/spaces/opendatalab/MinerU)-[](https://www.modelscope.cn/studios/OpenDataLab/MinerU)-[](https://colab.research.google.com/gist/myhloli/a3cb16570ab3cfeadf9d8f0ac91b4fca/mineru_demo.ipynb)-[](https://arxiv.org/abs/2409.18839)-[](https://arxiv.org/abs/2509.22186)-[](https://arxiv.org/abs/2604.04771)-[](https://deepwiki.com/opendatalab/MinerU)+MinerU is a command-line document reader for agents. It parses local documents into readable content, lets agents continue by page or block, and returns stable locators for follow-up reads and citations.+## Pre-release Status-<a href="https://trendshift.io/repositories/11174" target="_blank"><img src="https://trendshift.io/api/badge/repositories/11174" alt="opendatalab%2FMinerU | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>+The current MinerU release line is in Alpha pre-release. Package installers normally prefer stable releases, so explicitly enable pre-release resolution whenever installing or upgrading MinerU from a package index. The installation commands in this skill already include the required installer-specific options.-<!-- language -->+## What MinerU Is Not-[English](README.md) | [简体中文](README_zh-CN.md)+MinerU is not a browser, RAG framework, embedding system, vector database, or chat-with-doc application. It can be used as the document parsing step in a larger pipeline, but this skill only uses the `mineru` command.-<!-- hot link -->+## When To Use MinerU-<p align="center">-🚀<a href="https://mineru.net/?source=github">Access MinerU Now→✅ Zero-Install Web Version ✅ Full-Featured Desktop Client ✅ Instant API Access; Skip deployment headaches – get all product formats in one click. Developers, dive in!</a>-</p>+Use this skill when the user asks an agent to:-<!-- join us -->+- Read, inspect, summarize, quote, cite, or answer questions about a local document.+- Convert document content into Markdown for analysis.+- OCR scanned PDFs or images.+- Extract content from PDFs, DOCX, PPTX, XLSX, images, or other MinerU-supported document formats.+- Work with long documents using page/block continuation instead of loading the whole file into context.+- Search documents MinerU has already indexed.+- Retrieve page or block images for visual inspection.+- Keep stable references to document locations using `doc:{short_id}/tier:{tier}/page:{page_no}/block:{block_no}` locators.-<p align="center">- 👋 join us on <a href="https://discord.gg/Tdedn9GTXq" target="_blank">Discord</a> and <a href="https://mineru.net/community-portal/?aliasId=3c430f94" target="_blank">WeChat</a>-</p>+## Supported Inputs-</div>+Use MinerU for local document files such as:+| Type | Examples |+|---|---|+| PDF | `.pdf`, including scanned PDFs and academic papers |+| Images | `.png`, `.jpg`, `.jpeg`, `.webp`, `.bmp`, and similar image files |+| Word | `.docx` |+| PowerPoint | `.pptx` |+| Excel | `.xlsx` |-<details>-<summary>MinerU — High-accuracy document parsing engine for LLM · RAG · Agent workflows</summary>-Converts PDF · DOCX · PPTX · XLSX · Images · Web pages into structured Markdown / JSON · VLM+OCR dual engine · 109 languages <br>-MCP Server · LangChain / Dify / FastGPT native integration · 10+ domestic AI chip support--**🔍 Core Parsing Capabilities**+MinerU is especially useful when documents contain OCR text, tables, formulas, figures, or complex page layouts.-- Native support for `DOCX`, `PPTX`, and `XLSX` parsing-- Formulas → LaTeX · Tables → HTML, accurate layout reconstruction-- Supports scanned docs, handwriting, multi-column layouts, cross-page table merging-- Output follows human reading order with automatic header/footer removal-- VLM + OCR dual engine, 109-language OCR recognition+## Do Not-**🔌 Integration**+Do not:-| Use Case | Solution |-|----------|----------|-| AI Coding Tools | MCP Server — Cursor · Claude Desktop · Windsurf |-| RAG Frameworks | LangChain · LlamaIndex · RAGFlow · RAG-Anything · Flowise · Dify · FastGPT |-| Development | Python / Go / TypeScript SDK · CLI · REST API · Docker |-| No-Code | mineru.net online · Gradio WebUI · Desktop client |+- Summarize a document before reading it with `mineru`.+- Reimplement PDF/OCR extraction when `mineru` can read the document.-**🖥️ Deployment (Private · Fully Offline)**+## Agent Contract-| Inference Backend | Best For |-|------------------|---------|-| hybrid-engine --effort low | Fast local parsing, no VLM calls, runs on CPU or GPU |-| hybrid-engine | High accuracy, native text extraction, low hallucination, supports VLM acceleration ecosystem |+- Use `mineru` as the command entrypoint.+- Use `--json` when making control-flow decisions.+- Follow continuation commands and `next_request`.+- Preserve locators for citations and follow-up reads.+- Ask before using `--remote`, changing persistent config, adding watches, stopping or restarting the server, invalidating caches, or running destructive maintenance such as `forget --no-dry-run` or `cleanup --no-dry-run`.-Domestic AI chips: Ascend · Cambricon · Enflame · MetaX · Moore Threads · Kunlunxin · Iluvatar · Hygon · Biren · T-Head-</details>+## Core Decision Tree-# Changelog+Use this decision tree before running commands:-- 2026/06/18 3.4 Released+1. User provided a file path and wants content: run `mineru parse <file>`.+2. User provided a `doc:...` locator: run `mineru read <locator>`.+3. User asks to continue from a previous output: follow the `<!-- Next: ... -->` command exactly.+4. User asks for a specific page or block after parsing: use `mineru read <locator>`, not a fresh parse.+5. User asks to find a document by filename: use `mineru find`.+6. User asks to search inside known indexed documents: use `mineru search`.+7. User asks for parse/file/doc status: use `mineru show` or `mineru list`.+8. User asks to add or refresh a watched folder: use `mineru watch` or `mineru scan`.+9. User asks MinerU to forget a file or folder without deleting it: use `mineru forget`.+10. User asks to force a reparse: use `mineru parse --force` or `mineru invalidate`.- This release focuses on **OCR capability upgrades for the pipeline backend**, **OCR processing pipeline optimization**, and **model download experience improvements**. The main updates include:+## Common Workflows- - OCR model upgrade and processing acceleration- - The OCR model for the `pipeline` backend has been upgraded to `PP-OCRv6`, improving OCR accuracy by about `11%` on OmniDocBench v1.6.- - Removed Japanese, Traditional Chinese, English, and Latin options from OCR language selection. These scenarios are now routed to the `ch` OCR model, simplifying model configuration and language selection.- - Optimized the OCR inference and processing pipeline, increasing OCR processing speed by about `100%` and significantly improving parsing efficiency for batch documents and OCR-intensive documents.+### First read from a file- - Model download logic optimization- - Added automatic model source selection, allowing first-time installations to choose a better model source based on the current network environment.- - Before downloading models, MinerU now prioritizes checking locally downloaded model cache files. Cache hits can be reused directly, reducing repeated downloads and unnecessary remote requests.- - For more details about model source configuration, automatic source selection, and local model usage, see the [Model Source Documentation](https://opendatalab.github.io/MinerU/usage/model_source/).+```bash+mineru parse "document.pdf" --json+```- With the 3.4 release, MinerU further improves the parsing accuracy and processing efficiency of the `pipeline` backend in OCR scenarios. It also optimizes model downloads, cache reuse, and local configuration write-back, making first-time installation, model updates, and multi-environment deployment more stable and automated.+Then answer from `content.content`. If `next_request` exists and the question needs more context, continue.-- 2026/06/11 3.3 Released+### Continue progressively- This release focuses on **Hybrid parsing performance optimization** and **VLM model capability upgrades**. The main updates include:+```bash+mineru parse "book.pdf" --pages 1~10 --limit 12000 --json+mineru read "doc:ab12cd3/tier:high/page:11" --limit 12000 --json+```- - New `effort` parsing-strength parameter for the Hybrid backend- - Added two parsing-strength levels, `medium` and `high`, allowing users to balance parsing speed, parsing accuracy, and feature requirements.- - On OmniDocBench v1.6, `medium` reduces overall accuracy by only `0.13` points compared with `high`, while delivering `35%` ~ `220%` parsing speed improvements across different devices and scenarios.- - The default Hybrid backend now uses `effort=medium`, significantly improving overall parsing efficiency while maintaining high parsing accuracy.- - The `medium` level does not support `image analysis`; for maximum parsing accuracy or `image analysis` support, switch to `effort=high`.+Continue with returned `next_request.locator`.- - VLM model upgraded to `MinerU2.5-Pro-2605-1.2B`- - Fixed multiple model issues found in the `2604` version, further improving parsing stability on complex documents.- - Added native multilingual OCR support, reducing the need for extra language-parameter configuration.+### Read or inspect a known location-- 2026/04/18 3.1.0 Released+```bash+mineru read "doc:ab12cd3/tier:high/page:42" --context 1 --json+mineru read "doc:ab12cd3/tier:high/page:12/block:5" --format image --output ./page12-block5.png+```- This release focuses on **licensing openness, parsing accuracy, and full-format native support**. The main updates include:+### Search local library, then read- - License upgrade- - MinerU has officially moved from `AGPLv3` to the [MinerU Open Source License](https://github.com/opendatalab/MinerU/blob/master/LICENSE.md), a custom license based on `Apache 2.0`.- - This change significantly reduces adoption friction for both community users and commercial deployments, making MinerU easier to integrate into real-world workflows.- - VLM main model upgrade- - The primary VLM model has been upgraded to `MinerU2.5-Pro-2604-1.2B`, bringing overall parsing accuracy to a state-of-the-art level.- - The new model now supports image and chart parsing, truncated paragraph merging, cross-page table merging, and image recognition inside tables, further strengthening performance on complex document layouts.- - Full-format native parsing support- - Native parsing support has now been extended to `PPTX` and `XLSX`.- - MinerU now fully supports parsing across images, `PDF`, `DOCX`, `PPTX`, and `XLSX`, providing a more complete multi-format document understanding workflow.+```bash+mineru search "liquidated damages" --min-tier medium --json+mineru read "doc:ab12cd3/tier:high/page:18" --json+```- With the 3.1.0 release, MinerU becomes more open, more accurate, and easier to adopt in production. The new license lowers the barrier for both community and commercial use, `MinerU2.5-Pro-2604-1.2B` improves parsing quality on complex content, and native `PPTX` / `XLSX` support completes end-to-end coverage of mainstream document formats.+## Installation And Setup-- 2026/03/29 3.0.0 Released+Always check whether `mineru` is already available before installing.- This release delivers a systematic upgrade centered on **parsing capability, system architecture, and engineering usability**. The main updates include:-- - Native `DOCX` parsing- - Official support for native `DOCX` parsing, delivering high-precision results without hallucinations.- - Compared with the traditional workflow of first converting `DOCX` to `PDF` and then parsing it, end-to-end speed is improved by tens of times, making it better suited for scenarios with high requirements for both accuracy and throughput.- - `pipeline` backend upgrade- - The `pipeline` backend achieves a score of `86.2` on OmniDocBench (v1.5), surpassing the accuracy of the previous-generation mainstream VLM `MinerU2.0-2505-0.9B`.- - Added support for parsing images/formulas inside tables, seal text recognition, vertical text support, and interline formula numbering recognition, continuously improving parsing quality for complex document scenarios.- - While maintaining high accuracy, it keeps resource usage extremely low and continues to support inference in pure CPU environments.- - `API / CLI / Router` orchestration upgrade- - `mineru` now runs as an orchestration client based on `mineru-api`; when `--api-url` is not provided, it will automatically start a local temporary service.- - `mineru-api` adds a new asynchronous task endpoint `POST /tasks`, supporting task submission, status querying, and result retrieval; meanwhile, it retains the synchronous parsing endpoint `POST /file_parse` for compatibility with legacy plugins.- - Added `mineru-router`, designed for unified entry deployment and task routing across multiple services and multiple GPUs; its interfaces are fully compatible with `mineru-api` and support automatic task load balancing.- - Deployment and usability improvements- - Resolved compatibility issues with `torch >= 2.8`; the base image has been upgraded to `vllm0.11.2 + torch2.9.0`, unifying installation paths across different Compute Capabilities.- - Optimized the parsing pipeline with a sliding-window mechanism, significantly reducing peak memory usage in long-document scenarios, so documents with tens of thousands of pages no longer need to be split manually.- - Batch inference in `pipeline` now supports streaming writes to disk, allowing completed parsing results to be written out in time and further improving the experience for long-running tasks.- - Completed thread-safety optimization and now fully supports multi-threaded concurrent inference; together with `mineru-router`, this enables one-click multi-GPU deployment and makes it easy to build high-concurrency, high-throughput parsing systems.- - Completely removed the use of two AGPLv3 models (`doclayoutyolo` and `mfd_yolov8`) and one CC-BY-NC-SA 4.0 model (`layoutreader`).-- This update is not just a set of feature enhancements, but a key leap forward in MinerU's overall system capabilities. We specifically addressed the peak memory usage issue in long-document parsing. Through optimizations such as sliding windows and streaming writes to disk, ultra-long document parsing has moved from “requiring manual splitting and careful handling” to being “stable, scalable, and ready for production workloads.” At the same time, we completed thread-safety optimization and fully enabled multi-threaded concurrent inference, further improving single-machine resource utilization and runtime stability under high-concurrency workloads. On top of this, with `mineru-router` and the new `API / CLI` orchestration framework, MinerU now supports one-click multi-GPU deployment, unified access across multiple services, and automatic task load balancing, significantly reducing the difficulty of large-scale deployment. As a result, MinerU is evolving from a standalone data production tool into a large-scale document parsing foundation for high-concurrency and high-throughput scenarios, providing enterprise-grade document data processing with infrastructure that is more stable, more efficient, and easier to scale.+```bash+command -v mineru+mineru --help+```-> 📝 View the complete [Changelog](https://opendatalab.github.io/MinerU/reference/changelog/) for more historical version information+If `mineru` is not installed, install it with the first available isolated CLI installer.+MinerU requires Python `>=3.10,<3.14`.-# MinerU+### Install with `uv` (preferred)-## Project Introduction--MinerU is a document parsing tool that converts `PDF`, image, `DOCX`, `PPTX`, and `XLSX` inputs into machine-readable formats such as Markdown and JSON for downstream retrieval, extraction, and processing.-MinerU was born during the pre-training process of [InternLM](https://github.com/InternLM/InternLM). We focus on solving symbol conversion issues in scientific literature and hope to contribute to technological development in the era of large models.-Compared to well-known commercial products, MinerU is still young. If you encounter any issues or if the results are not as expected, please submit an issue on [issue](https://github.com/opendatalab/MinerU/issues) and **attach the relevant document or sample file**.--https://github.com/user-attachments/assets/4bea02c9-6d54-4cd6-97ed-dff14340982c--## Key Features--- Support `PDF`, image, `DOCX`, `PPTX`, and `XLSX` inputs.-- Remove headers, footers, footnotes, page numbers, etc., to ensure semantic coherence.-- Output text in human-readable order, suitable for single-column, multi-column, and complex layouts.-- Preserve the structure of the original document, including headings, paragraphs, lists, etc.-- Extract images, image descriptions, tables, table titles, and footnotes.-- Automatically recognize and convert formulas in the document to LaTeX format.-- Automatically recognize and convert tables in the document to HTML format.-- Automatically detect scanned PDFs and garbled PDFs and enable OCR functionality.-- OCR supports detection and recognition of 109 languages.-- Supports multiple output formats, such as multimodal and NLP Markdown, JSON sorted by reading order, and rich intermediate formats.-- Supports various visualization results, including layout visualization and span visualization, for efficient confirmation of output quality.-- Built-in CLI, FastAPI, Gradio WebUI, for local orchestration and multi-service deployment.-- Supports running in a pure CPU environment, and also supports GPU/MPS acceleration-- Compatible with Windows, Linux, and Mac platforms.--# Quick Start--Document parsing is a difficult and complex task. In scenarios such as complex layouts, scanned pages, and handwritten content, the parsing results may fall short of expectations. We recommend trying the online demo first to evaluate MinerU's parsing quality and suitability before choosing an appropriate deployment method based on your actual needs.-If you have **document** samples with unsatisfactory parsing results, feel free to share them in an [issue](https://github.com/opendatalab/MinerU/issues). We will continue improving the parsing capabilities.-If you encounter any installation issues, please first consult the <a href="#faq">FAQ</a>.--## Online Experience--### Official online web application-The official online version has the same functionality as the client, with a beautiful interface and rich features, requires login to use--- [](https://mineru.net/OpenSourceTools/Extractor?source=github)--### Gradio-based online demo-A WebUI developed based on Gradio, with a simple interface and only core parsing functionality, no login required--- [](https://www.modelscope.cn/studios/OpenDataLab/MinerU)-- [](https://huggingface.co/spaces/opendatalab/MinerU)--## Local Deployment---> [!WARNING]-> **Pre-installation Notice—Hardware and Software Environment Support**->-> To ensure the stability and reliability of the project, we only optimize and test for specific hardware and software environments during development. This ensures that users deploying and running the project on recommended system configurations will get the best performance with the fewest compatibility issues.->-> By focusing resources on the mainline environment, our team can more efficiently resolve potential bugs and develop new features.->-> In non-mainline environments, due to the diversity of hardware and software configurations, as well as third-party dependency compatibility issues, we cannot guarantee 100% project availability. Therefore, for users who wish to use this project in non-recommended environments, we suggest carefully reading the documentation and FAQ first. Most issues already have corresponding solutions in the FAQ. We also encourage community feedback to help us gradually expand support.--<table>- <thead>- <tr>- <th rowspan="2">Parsing Backend</th>- <th rowspan="2">hybrid low</th>- <th colspan="2">*-engine</th>- <th colspan="2">*-http-client</th>- </tr>- <tr>- <th>hybrid</th>- <th>vlm</th>- <th>hybrid</th>- <th>vlm</th>- </tr>- </thead>- <tbody>- <tr>- <th>Backend Features</th>- <td >Good Compatibility</td>- <td colspan="2">High Hardware Requirements</td>- <td colspan="2">For OpenAI Compatible Servers<sup>2</sup></td>- </tr>- <tr>- <th>Accuracy<sup>1</sup></th>- <td style="text-align:center;">86.47</td>- <td style="text-align:center;">95.39 (high)<br>95.26 (medium)</td>- <td style="text-align:center;">95.30</td>- <td style="text-align:center;">95.39 (high)<br>95.26 (medium)</td>- <td style="text-align:center;">95.30</td>- </tr>- <tr>- <th>Operating System</th>- <td colspan="5" style="text-align:center;">Linux<sup>3</sup> / Windows<sup>4</sup> / macOS<sup>5</sup></td>- </tr>- <tr>- <th>Pure CPU Support</th>- <td style="text-align:center;">✅</td>- <td colspan="2" style="text-align:center;">❌</td>- <td colspan="2" style="text-align:center;">✅</td>- </tr>- <tr>- <th>GPU Acceleration</th>- <td colspan="4" style="text-align:center;">Volta and later architecture GPUs or Apple Silicon</td>- <td rowspan="2">Not Required</td>- </tr>- <tr>- <th>Min VRAM</th>- <td style="text-align:center;">4GB</td>- <td colspan="2" style="text-align:center;">8GB</td>- <td style="text-align:center;">2GB</td>- </tr>- <tr>- <th>RAM</th>- <td colspan="3" style="text-align:center;">Min 16GB, Recommended 32GB or more</td>- <td colspan="2" style="text-align:center;">Min 16GB</td>- </tr>- <tr>- <th>Disk Space</th>- <td colspan="3" style="text-align:center;">Min 20GB, SSD Recommended</td>- <td colspan="2" style="text-align:center;">Min 2GB</td>- </tr>- <tr>- <th>Python Version</th>- <td colspan="5" style="text-align:center;">3.10-3.13</td>- </tr>- </tbody>-</table>--<sup>1</sup> Accuracy metrics are the End-to-End Evaluation Overall scores from OmniDocBench (v1.6), based on the latest version of `MinerU`.-<sup>2</sup> Servers compatible with OpenAI API, such as local model servers or remote model services deployed via inference frameworks like `vLLM`/`SGLang`/`LMDeploy`.-<sup>3</sup> Linux only supports distributions from 2019 and later.-<sup>4</sup> Since the key dependency `ray` does not support Python 3.13 on Windows, only versions 3.10~3.12 are supported.-<sup>5</sup> macOS requires version 14.0 or later.---### Install MinerU--#### Install MinerU using pip or uv-```bash-pip install --upgrade pip-pip install uv-uv pip install -U "mineru[all]"-```--#### Install MinerU from source code-```bash-git clone https://github.com/opendatalab/MinerU.git-cd MinerU-uv pip install -e .[all]-```--> [!TIP]-> - `mineru[all]` includes all core features, compatible with Windows / Linux / macOS systems, suitable for most users.-> - If CUDA acceleration is unavailable after installing on Windows, see the [Windows CUDA acceleration FAQ](https://opendatalab.github.io/MinerU/faq/#windows-cuda-acceleration).-> - If you need to specify the inference framework for the VLM model, or only intend to install a lightweight client on an edge device, please refer to the documentation [Extension Modules Installation Guide](https://opendatalab.github.io/MinerU/quick_start/extension_modules/).+If `uv` is available, use any supported Python version for the tool environment.+If no supported interpreter is available, install Python 3.12 with `uv` as a conservative fallback:------#### Deploy MinerU using Docker-MinerU provides a convenient Docker deployment method, which helps quickly set up the environment and solve some tricky environment compatibility issues.+```bash+command -v uv+uv python find 3.12+uv python find 3.13+uv python find 3.11+uv python find 3.10+```-> [!TIP]-> - Docker deployment is only supported on Linux and Windows environments with WSL2 support;-> - macOS users should refer to the two installation methods above for installation instead of using Docker deployment.+If all `uv python find` commands failed, download Python 3.12 with `uv`:++```bash+uv python install 3.12+```-You can get the [Docker Deployment Instructions](https://opendatalab.github.io/MinerU/quick_start/docker_deployment/) in the documentation.+Then install MinerU with the supported interpreter that was found, or with Python 3.12 if it was installed as the fallback:----+```bash+uv tool install --python 3.12 --prerelease allow mineru+```-### Using MinerU+### Install with `pipx`+If `uv` is unavailable but `pipx` is available, inspect `pipx`'s default Python before installing:-If your device meets the GPU acceleration requirements in the table above, you can use a simple command line for document parsing:```bash-mineru -p <input_path> -o <output_path>+command -v pipx+pipx environment --value PIPX_DEFAULT_PYTHON+PIPX_DEFAULT_PYTHON="$(pipx environment --value PIPX_DEFAULT_PYTHON)"+"$PIPX_DEFAULT_PYTHON" --version```-If your device does not meet the GPU acceleration requirements, you can use Hybrid low to run without VLM calls:++Check the `PIPX_DEFAULT_PYTHON` path reported by `pipx`. If that interpreter satisfies `>=3.10,<3.14`, install with `pipx`:+```bash-mineru -p <input_path> -o <output_path> -b hybrid-engine --effort low+pipx install --pip-args="--pre" mineru```-`mineru` currently supports local `PDF`, image, `DOCX`, `PPTX`, and `XLSX` file or directory inputs, and can be used for document parsing through the CLI, API, WebUI, and `mineru-router`. For detailed instructions, please refer to the [Usage Guide](https://opendatalab.github.io/MinerU/usage/).+If `PIPX_DEFAULT_PYTHON` is unsupported, but a supported Python interpreter can be found on the current system, pass it explicitly. `python3.12` is an example; use any interpreter that satisfies `>=3.10,<3.14`.-# FAQ+```bash+command -v python3.12+python3.12 --version+pipx install --python python3.12 --pip-args="--pre" mineru+```-- If you encounter any issues during usage, you can first check the [FAQ](https://opendatalab.github.io/MinerU/faq/) for solutions.-- If your issue remains unresolved, you may also use [DeepWiki](https://deepwiki.com/opendatalab/MinerU) to interact with an AI assistant, which can address most common problems.-- If you still cannot resolve the issue, you are welcome to join our community via [Discord](https://discord.gg/Tdedn9GTXq) or [WeChat](https://mineru.net/community-portal/?aliasId=3c430f94) to discuss with other users and developers.+If no supported system interpreter is available and `pipx` supports Python fetching, ask for approval before downloading a standalone Python:-# All Thanks To Our Contributors+```bash+pipx install --python 3.12 --fetch-python=missing --pip-args="--pre" mineru+```-<a href="https://github.com/opendatalab/MinerU/graphs/contributors">- <img src="https://contrib.rocks/image?repo=opendatalab/MinerU" />-</a>+### Install with global `pip`-# License Information+If neither `uv` nor `pipx` is available, but `pip` or `pip3` is available, check the Python version of the `pip` command, and ask the user before installing into the global python environment:-This repository is licensed under the [MinerU Open Source License](https://github.com/opendatalab/MinerU/blob/master/LICENSE.md), based on Apache 2.0 with additional conditions.+```bash+which -a pip pip3 pip3.10 pip3.11 pip3.12 pip3.13 # find all available pips+pip --version+```-# Acknowledgments+If a `pip` command reports Python `>=3.10,<3.14`, and the user confirms, install with the exact supported `pip` command that was verified. Replace `pip` below with the verified pip command if needed:-- [UniMERNet](https://github.com/opendatalab/UniMERNet)-- [TableStructureRec](https://github.com/RapidAI/TableStructureRec)-- [PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR)-- [PaddleOCR2Pytorch](https://github.com/frotms/PaddleOCR2Pytorch)-- [fast-langdetect](https://github.com/LlmKira/fast-langdetect)-- [pypdfium2](https://github.com/pypdfium2-team/pypdfium2)-- [pdftext](https://github.com/datalab-to/pdftext)-- [pypdf](https://github.com/py-pdf/pypdf)-- [magika](https://github.com/google/magika)-- [vLLM](https://github.com/vllm-project/vllm)-- [LMDeploy](https://github.com/InternLM/lmdeploy)+```bash+pip install --pre mineru+```-# Citation+### If No Supported Installer Is Available-```bibtex-@article{wang2026mineru2,- title={MinerU2. 5-Pro: Pushing the Limits of Data-Centric Document Parsing at Scale},- author={Wang, Bin and He, Tianyao and Ouyang, Linke and Wu, Fan and Zhao, Zhiyuan and Chu, Tao and Qu, Yuan and Jin, Zhenjiang and Zeng, Weijun and Miao, Ziyang and others},- journal={arXiv preprint arXiv:2604.04771},- year={2026}-}+If `uv`, `pipx`, `pip`, and `pip3` are all unavailable, or none of them can install with Python `>=3.10,<3.14`, recommend that the user install `uv` first.-@article{dong2026minerudiffusion,- title={MinerU-Diffusion: Rethinking Document OCR as Inverse Rendering via Diffusion Decoding},- author={Dong, Hejun and Niu, Junbo and Wang, Bin and Zeng, Weijun and Zhang, Wentao and He, Conghui},- journal={arXiv preprint arXiv:2603.22458},- year={2026}-}+### After Installation-@article{niu2025mineru2,- title={Mineru2. 5: A decoupled vision-language model for efficient high-resolution document parsing},- author={Niu, Junbo and Liu, Zheng and Gu, Zhuangcheng and Wang, Bin and Ouyang, Linke and Zhao, Zhiyuan and Chu, Tao and He, Tianyao and Wu, Fan and Zhang, Qintong and others},- journal={arXiv preprint arXiv:2509.22186},- year={2025}-}+Verify the installed CLI:++```bash+mineru --help+```++## Privacy Rules++MinerU is privacy-first.++- By default, `mineru` parses documents locally. A document is sent for remote parsing only when the command uses the `--remote` CLI parameter.+- Use local parsing first. If local parsing is not configured or cannot satisfy the request, and the document does not involve private or sensitive content, ask the user before retrying with `--remote`.+- Even if remote parsing is configured, do not upload a document until the user agrees.+- Local failure cannot silently fall back to remote.+- Remote failure may fall back to local if the request can still be satisfied locally.++When remote parsing is acceptable:++```bash+mineru parse "document.pdf" --remote+```++If the request is sensitive, confidential, legal, medical, financial, personal, or proprietary, stay local unless the user gives explicit remote permission.++## Telemetry++MinerU may collect anonymous, locally aggregated usage and diagnostic telemetry to understand command usage, success or failure rates, tier choices, coarse environment categories, and performance timing buckets.++Telemetry does not collect document contents, extracted text or images, file names, file paths, search queries, prompts, snippets, API keys, usernames, hostnames, raw tracebacks, or exact hardware identifiers.++Telemetry starts in an unset consent state. In this state MinerU may keep local aggregate data but will not upload it. Users can enable or disable telemetry explicitly; disabling telemetry stops new telemetry aggregation and removes unsent local telemetry data.++Do not prompt for telemetry consent in agent or non-interactive contexts. If the user asks about telemetry, use:++```bash+mineru telemetry status+mineru telemetry enable+mineru telemetry disable+mineru telemetry preview+mineru telemetry flush+```++## Quality Tiers++MinerU has four tiers:++| Tier | Use for | How to use |+|---|---|---|+| `flash` | Fast discovery, preview, and search indexing | Never use as default final reading quality |+| `medium` | Local higher-quality parsing with optional GPU acceleration | Use when high is unavailable or explicitly requested |+| `high` | Default high-quality parsing for most active reading | Prefer for normal final reading quality |+| `xhigh` | Highest quality with higher compute cost | Use only when the user needs maximum quality and accepts slower parsing |++Default tier behavior:++- Omit `--tier` when the user wants normal reading quality.+- For parse-server based parsing, MinerU chooses `high`, then `xhigh`, then `medium`; `flash` is not a default final reading tier.+- For `mineru read doc:{short_id}`, MinerU reads the best cached result rather than starting a new parse.+- If normal reading quality is unavailable, there are usually three options:+ - Use remote parsing with `--remote`.+ - Start or configure a local parse server if the hardware supports it.+ - Explicitly accept the lower-quality local `flash` tier.+- Use `--tier flash` only when the user explicitly asks for fastest/preview/low-cost parsing or accepts lower quality.++Examples:++```bash+mineru parse "paper.pdf"+mineru parse "paper.pdf" --tier medium+mineru parse "paper.pdf" --tier high+mineru parse "paper.pdf" --tier xhigh+mineru parse "paper.pdf" --tier flash+```++## Server Rules++Most `mineru` commands use the local MinerU background service. If a command fails with `server_not_running`, start it:++```bash+mineru server start+```++Check status when MinerU is not responding, parsing is stuck, or you need to see available tiers:++```bash+mineru server status+mineru server status --json+```++Server commands:++```bash+mineru server start+mineru server stop+mineru server restart+mineru server status+```++Agent rules:++- Start the server when `mineru` reports it is not running.+- Do not restart the server repeatedly without a reason.+- Use `server status --json` when you need machine-readable status.+- If high-quality local parsing is unavailable, report the error and suggested action. Do not switch to remote without permission.++## Local Parse Server++Use a local parse server when the user wants `medium`, `high`, or `xhigh` quality without sending the document to remote parsing.++Hardware guidance:++Local managed `medium` needs extra dependencies. It can run on CPU, but GPU can accelerate it.++Use `medium` when:++- The user wants local high-quality parsing without sending files to remote.+- GPU is unavailable or `high` cannot be used.++Use `high` or `xhigh` when the machine has VLM dependencies, GPU, and enough VRAM or unified memory:++- Volta-or-newer NVIDIA GPU with at least 8 GB VRAM available for MinerU.+- Apple Silicon with at least 16 GB unified memory.+- A MinerU-supported AI accelerator such as `npu`, `gcu`, `musa`, `mlu`, or `sdaa`.++Use `high` for normal high-quality local parsing. Use `xhigh` only when the user wants maximum quality and accepts higher compute cost.++Change local parse-server config or restart the server only when the user asks for or approves local high-quality parsing.++Managed local parsing requires optional runtime dependencies. Install the required extra with the same installation tool and environment that installed the current `mineru` command.++The following examples assume the current install tool is `uv tool`. If `mineru` was installed with another tool or environment, use the equivalent command for that actual tool/environment.++Installing extras with `uv tool install --force --prerelease allow` can reinstall or upgrade the `mineru` package. Restart the MinerU server after installing extras so the CLI client, doclib server, and managed parse server use the same installed version.++Enable managed local parsing for `medium`:++```bash+uv tool install --force --prerelease allow "mineru[medium]"+mineru server restart+mineru config set parse_server.local.managed_tier medium+mineru config set parse_server.local.mode managed+mineru server status --json+```++Enable managed local parsing for `high`:++```bash+uv tool install --force --prerelease allow "mineru[high]"+mineru server restart+mineru config set parse_server.local.managed_tier high+mineru config set parse_server.local.mode managed+mineru server status --json+```++Enable managed local parsing for `xhigh`:++```bash+uv tool install --force --prerelease allow "mineru[xhigh]"+mineru server restart+mineru config set parse_server.local.managed_tier xhigh+mineru config set parse_server.local.mode managed+mineru server status --json+```++Rules:++- Determine how the current `mineru` command was installed, then install the extra through that same tool/environment.+- After installing extras, restart the MinerU server to avoid CLI/server version mismatch.+- Set `parse_server.local.managed_tier` before `parse_server.local.mode=managed`.+- Poll `mineru server status --json` and use managed parsing only after the target tier is healthy.+- Use `high` as the practical local default when the machine satisfies the local high-tier hardware guidance above.+- Use local `xhigh` only when the user explicitly wants maximum quality.+- If local `medium`, `high`, or `xhigh` cannot start, do not add `--remote` automatically; ask the user first.++## First Read From A File++Use `mineru parse` for the first active read from a local file path.++```bash+mineru parse "report.pdf"+```++By default, readable content is printed to stdout. Use `--output` only when the user wants the result saved to a file.++Use JSON when you need structured status, tier, content, and continuation:++```bash+mineru parse "report.pdf" --json+```++For a specific page range:++```bash+mineru parse "report.pdf" --pages 1~10+mineru parse "report.pdf" --pages all+```++For bounded context:++```bash+mineru parse "report.pdf" --limit 12000+```++For no synchronous wait:-@article{wang2024mineru,- title={Mineru: An open-source solution for precise document content extraction},- author={Wang, Bin and Xu, Chao and Zhao, Xiaomeng and Ouyang, Linke and Wu, Fan and Zhao, Zhiyuan and Xu, Rui and Liu, Kaiwen and Qu, Yuan and Shang, Fukai and others},- journal={arXiv preprint arXiv:2409.18839},- year={2024}+```bash+mineru parse "report.pdf" --no-wait --json+```++For longer wait:++```bash+mineru parse "report.pdf" --wait 180 --json+```++For output to a file:++```bash+mineru parse "report.pdf" --output ./report.md+```++Rules:++- Quote paths with spaces.+- For paged documents, the default active read range is the first page window, usually `1~10`; continue with the returned marker or `next_request` instead of reading the whole document by default.+- Use the default tier unless the user has a quality/speed/privacy preference.+- Use `--pages all` only when the user asks for the whole document or the document is known to be small enough.+- Prefer `--limit` and continuation for long documents.+- Once you have a locator, switch to `mineru read`.++## Continue Reading++MinerU output may include a command to continue reading:++```text+<!-- Next: mineru read doc:ab12cd3/tier:high/page:11 -->+```++or:++```text+<!-- Next: mineru parse report.pdf --pages 11~20 -->+```++Run the suggested command exactly unless the user asks for a different page, block, format, or limit.++Agent rules:++- Do not guess the next page or block if MinerU provides a next command.+- Do not restart parsing from page 1 when continuing.+- For non-paged long documents, continuation may use an `--after` cursor from `next_request.after`; use that exact cursor.+- Prefer `mineru read` when the next command or JSON output gives a locator.+- Use `--limit` to keep output within the conversation budget.+- Preserve locators for citations and follow-up reads.++## Read By Locator++Use `mineru read` when a document has already been parsed or when the user gives a locator.++Locator forms:++```text+doc:{short_id}+doc:{short_id}/tier:{tier}+doc:{short_id}/tier:{tier}/page:{page_no}+doc:{short_id}/tier:{tier}/page:{page_no}/block:{block_no}+doc:{short_id}/tier:{tier}/page:{page_no}/block:{block_no}/char:{offset}+```++Examples:++```bash+mineru read "doc:ab12cd3/tier:high/page:4"+mineru read "doc:ab12cd3/tier:high/page:4/block:7"+mineru read "doc:ab12cd3/tier:high/page:4/block:7" --context 2+mineru read "doc:ab12cd3/tier:high/page:4" --limit 8000 --json+```++Rules:++- Page and block numbers are 1-based.+- Character offsets are 0-based within the block text.+- `--context N` means surrounding pages for page locators and surrounding blocks for block locators.+- If only `doc:{short_id}` is provided, MinerU should choose the highest cached result. If none exists, parse the document first or report the error.++## Read Page Or Block Images++Use image output only when the user needs visual inspection, layout evidence, cropped figures, page screenshots, or block-level visual verification.++```bash+mineru read "doc:ab12cd3/tier:high/page:4" --format image+mineru read "doc:ab12cd3/tier:high/page:4/block:7" --format image+mineru read "doc:ab12cd3/tier:high/page:4/block:7" --format image --output ./block-7.png+```++Rules:++- PDF page image is supported for page locators.+- PDF block image requires a valid non-empty bbox.+- Office block image is only expected for image blocks.+- Multi-page image export is not the default reading workflow.+- If no `--output` is provided, MinerU prints the generated asset path.++## Search And Find++Use `find` for filenames and local paths:++```bash+mineru find "annual report"+mineru find "contract" --ext pdf+mineru find "invoice" --json+```++Use `search` for parsed document content:++```bash+mineru search "revenue recognition"+mineru search "transformer architecture" --type pdf+mineru search "appendix" --min-tier medium --limit 10 --json+```++Rules:++- `find` does not search document content.+- `search` only searches content MinerU has already indexed.+- If search returns only low-quality or `flash` snippets and the user needs an answer, parse or read the target document at default quality before relying on the content.+- Do not repeat sensitive search snippets in final output unless needed to answer the user.++## Inspect Status++Use `show` for one resource:++```bash+mineru show file "report.pdf"+mineru show file "report.pdf" --json+mineru show parse 123 --json+mineru show doc "<sha256>" --json+mineru show scan 456 --json+```++Use `list` for collections:++```bash+mineru list docs+mineru list files --ext pdf+mineru list parses --status parsing+mineru list scans --status running+mineru list docs --json+```++Rules:++- Use `show file` after parse timeout to see active parses and cached tiers.+- Use `list parses` to inspect queued, parsing, failed, or done parse tasks.+- Use JSON modes when you need structured output.++## Watch, Scan, And Local Library Maintenance++Use `scan` for one-time discovery or refresh:++```bash+mineru scan "~/Documents/report.pdf"+mineru scan "~/Documents/project"+mineru scan "~/Documents/project" --no-wait --json+```++Use `watch` for persistent folders:++```bash+mineru watch add "~/Documents"+mineru watch add "/Volumes/Archive" --removable+mineru watch list+mineru watch rescan "~/Documents"+mineru watch remove "~/Documents"+```++Watch rules:++- Watch is for discovery and search indexing.+- Watch defaults to `flash`.+- Watch results are not final reading quality.+- Active reading should still use `mineru parse` or `mineru read`.+- The CLI normalizes local path arguments with user-home expansion, absolute paths, and normalized separators.+- For `watch rescan` and `watch remove`, use either a watch id or the watch root path.+- Watch will not trigger remote parsing unless a parsing rule explicitly allows remote.++Use parsing rules only when the user wants automatic parse policy for paths:++```bash+mineru config parsing-rules add "*/papers/*" --tier high --pages all+mineru config parsing-rules add "*/contracts/*" --tier high --remote+mineru config parsing-rules list+mineru config parsing-rules remove 3+```++Use exclude rules to prevent discovery:++```bash+mineru config exclude-rules add "*/node_modules/*"+mineru config exclude-rules list+mineru config exclude-rules remove 5+```++Use `forget` to forget a file or folder from MinerU without deleting source files:++```bash+mineru forget "~/Documents/old.pdf"+mineru forget "~/Documents/project"+mineru forget "~/Documents/project" --no-dry-run+```++Use cleanup for local maintenance:++```bash+mineru cleanup deleted-files+mineru cleanup deleted-files --no-dry-run+mineru cleanup orphan-docs+mineru cleanup orphan-docs --no-dry-run+mineru cleanup temp+mineru cleanup temp --older-than 14+```++Rules:++- `forget` does not delete source files.+- `forget` does not prevent a watched path from being rediscovered.+- If the target is a watch root, remove the watch first. If the target is inside an active watch, warn that a later scan may rediscover it.+- `scan` does not create a watch.+- `scan` refreshes file discovery state only; it does not mean ingest or parsing has completed.+- `cleanup deleted-files` and `cleanup orphan-docs` default to dry-run; add `--no-dry-run` only when the user wants actual cleanup.+- `cleanup orphan-docs --no-dry-run` can delete cached parsed content for documents no longer linked to any known file path; use it only for maintenance.++## Reparse And Cache Control++MinerU caches parse results for the same document and tier.++Force a new parse for the current request:++```bash+mineru parse "report.pdf" --force+```++Invalidate cached parse results:++```bash+mineru invalidate "report.pdf"+mineru invalidate "report.pdf" --tier high+```++Rules:++- Prefer cached results for normal reading.+- Use `--force` when the user asks to reparse or when cached output is known stale or wrong; it skips done cache for this request but does not invalidate or delete old results.+- Use `invalidate` when the user wants future parses and reads to avoid existing done results; invalidation does not automatically start a new parse.+- Do not delete user files as part of cache control.++## Configuration++Show configuration:++```bash+mineru config show+mineru config show --json+```++Set or unset a value only when the user gives an explicit configuration key:++```bash+mineru config get "<key>"+mineru config set "<key>" "<value>"+mineru config unset "<key>"+```++Important environment variables:++| Variable | Meaning |+|---|---|+| `MINERU_HOME` | MinerU home, default `~/.mineru` |+| `MINERU_API_KEY` | API key for remote parsing when remote is explicitly allowed |++Rules:++- Remote URL/API key configuration does not authorize upload by itself.+- `--remote` or a remote-enabled parsing rule is still required.+- Avoid printing secrets from config.++## JSON Output++Use `--json` when an agent needs stable machine-readable fields.++`mineru parse --json` returns:++```json+{+ "parse": { "...": "parse summary" },+ "content": { "...": "readable content and continuation data" }}+```-@article{he2024opendatalab,- title={Opendatalab: Empowering general artificial intelligence with open datasets},- author={He, Conghui and Li, Wei and Jin, Zhenjiang and Xu, Chao and Wang, Bin and Lin, Dahua},- journal={arXiv preprint arXiv:2407.13773},- year={2024}+If parsing is still pending, timed out, or `--no-wait` is used, `content` may be `null`.++Errors use:++```json+{+ "error": {+ "type": "engine_error",+ "code": "quality_tier_unavailable",+ "message": "...",+ "param": "tier",+ "retryable": false,+ "user_action": "...",+ "docs_url": null+ }}```-# Star History--<a>- <picture>- <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=opendatalab/MinerU&type=Date&theme=dark" />- <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=opendatalab/MinerU&type=Date" />- <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=opendatalab/MinerU&type=Date" />- </picture>-</a>---# Links-- [MinerU-Diffusion: Rethinking Document OCR as Inverse Rendering via Diffusion Decoding](https://github.com/opendatalab/MinerU-Diffusion)-- [Easy Data Preparation with latest LLMs-based Operators and Pipelines](https://github.com/OpenDCAI/DataFlow)-- [Vis3 (OSS browser based on s3)](https://github.com/opendatalab/Vis3)-- [LabelU (A Lightweight Multi-modal Data Annotation Tool)](https://github.com/opendatalab/labelU)-- [LabelLLM (An Open-source LLM Dialogue Annotation Platform)](https://github.com/opendatalab/LabelLLM)-- [PDF-Extract-Kit (A Comprehensive Toolkit for High-Quality PDF Content Extraction)](https://github.com/opendatalab/PDF-Extract-Kit)-- [OmniDocBench (A Comprehensive Benchmark for Document Parsing and Evaluation)](https://github.com/opendatalab/OmniDocBench)-- [Magic-HTML (Mixed web page extraction tool)](https://github.com/opendatalab/magic-html)-- [Magic-Doc (Fast speed ppt/pptx/doc/docx/pdf extraction tool)](https://github.com/InternLM/magic-doc)-- [Dingo: A Comprehensive AI Data Quality Evaluation Tool](https://github.com/MigoXLab/dingo)+Agent rules:++- Branch on `error.code`, not on prose in `message`.+- Respect `retryable`.+- Use `user_action` to decide the next command or user-facing suggestion.+- Do not strip locator fields from parsed content; they are needed for continuation and citation.++## Error Recovery++Use this table for common error codes:++| Code | Meaning | Agent action |+|---|---|---|+| `server_not_running` | MinerU background service is unavailable | Run `mineru server start`, then retry once |+| `quality_tier_unavailable` | Normal reading quality is unavailable | Suggest enabling local high-quality parsing, ask before `--remote`, or ask whether `--tier flash` is acceptable |+| `no_engine` | Requested tier is unavailable locally | Suggest another tier or enable local high-quality parsing |+| `engine_unavailable` | Engine process unavailable | Retry if `retryable`; otherwise check `mineru server status` |+| `parse_server_unavailable` | Parsing service cannot be reached | Check `mineru server status`; do not switch privacy boundary |+| `tier_mismatch` | Requested tier unsupported | Ask user to choose a supported tier |+| `parse_failed` | MinerU could not parse the file | Report failure; suggest a different tier only if privacy rules allow |+| `parse_timeout` | Parse exceeded timeout | Retry with longer `--wait`, inspect status, or use lower tier if user accepts |+| `parse_oom` | Memory or VRAM exhausted | Suggest lower quality, smaller `--pages`, or remote only with permission |+| `remote_not_allowed` | Remote might be needed but was not authorized | Ask user whether uploading is acceptable; do not add `--remote` yourself |+| `invalid_api_key` | API key invalid | Ask user to set a valid key |+| `quota_exceeded` | Remote quota exhausted | Suggest waiting or using local |+| `rate_limit_exceeded` | Remote rate limit | Retry later if appropriate |+| `file_not_found` | Path or file id missing | Ask for correct path or run `mineru find` |+| `file_permission_denied` | Local file unreadable | Ask user to fix permissions |+| `file_type_unsupported` | Format unsupported | Report unsupported type |+| `file_encrypted` | Password-protected file | Ask user for an unlocked copy |+| `file_corrupted` | File cannot be read | Ask for a valid copy |+| `page_range_invalid` | Bad `--pages` value | Correct to forms such as `1~5`, `1,3,8~10`, or `all` |+| `not_cached` / `cache_miss` | Requested cached content does not exist | Run `mineru parse` |++Retry rules:++- Retry once for transient server startup or explicitly retryable errors.+- Do not retry parse failures indefinitely.+- Do not change tier, pages, or remote/local privacy boundary without a reason.+- Do not add `--remote` during recovery without user permission.++## Answering Users With MinerU Output++When answering after reading a document:++- Use the parsed content, not assumptions about the document.+- Cite locators when the user needs traceability.+- Prefer concise quotations and page/block references over large copied passages.+- If content was truncated, say that the answer is based on the pages/blocks read so far.+- Continue reading before making claims that require unread sections.+- For tables, formulas, figures, or layout-sensitive questions, read the relevant page/block and use image output if needed.++Citation style examples:++```text+The warranty period is 24 months (doc:ab12cd3/tier:high/page:7/block:3).+```++```text+The method is described across pages 4-5; I checked doc:ab12cd3/tier:high/page:4 and doc:ab12cd3/tier:high/page:5.+```++## Operating Rules++- Do not use `flash` as default final reading quality.+- Do not reparse when a valid locator and cached result are enough.+- Do not ignore continuation commands.+- Do not load a whole long document when page/block continuation can answer the question.+- Do not delete source files.+- Do not expose secrets, API keys, or unnecessary local paths.+- Do not branch on human prose when JSON `error.code` or `next_request` is available.diff --git a/README_en.md b/README_en.mdnew file mode 100644index 00000000..e7273f1c--- /dev/null+++ b/README_en.md@@ -0,0 +1,425 @@+<div align="center" xmlns="http://www.w3.org/1999/html">+<!-- logo -->+<p align="center">+ <img src="https://gcore.jsdelivr.net/gh/opendatalab/MinerU@master/docs/images/MinerU-logo.png" width="300px" style="vertical-align:middle;">+</p>++<!-- icon -->++[](https://github.com/opendatalab/MinerU)+[](https://github.com/opendatalab/MinerU)+[](https://github.com/opendatalab/MinerU/issues)+[](https://github.com/opendatalab/MinerU/issues)+[](https://pypi.org/project/mineru/)+[](https://pypi.org/project/mineru/)+[](https://pepy.tech/project/mineru)+[](https://pepy.tech/project/mineru)+[](https://mineru.net/OpenSourceTools/Extractor?source=github)+[](https://huggingface.co/spaces/opendatalab/MinerU)+[](https://www.modelscope.cn/studios/OpenDataLab/MinerU)+[](https://colab.research.google.com/gist/myhloli/a3cb16570ab3cfeadf9d8f0ac91b4fca/mineru_demo.ipynb)+[](https://arxiv.org/abs/2409.18839)+[](https://arxiv.org/abs/2509.22186)+[](https://arxiv.org/abs/2604.04771)+[](https://deepwiki.com/opendatalab/MinerU)+++<a href="https://trendshift.io/repositories/11174" target="_blank"><img src="https://trendshift.io/api/badge/repositories/11174" alt="opendatalab%2FMinerU | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>++<!-- language -->++[Agent Guide](README.md) | [English](README_en.md) | [简体中文](README_zh.md)++<!-- hot link -->++<p align="center">+🚀<a href="https://mineru.net/?source=github">Access MinerU Now→✅ Zero-Install Web Version ✅ Full-Featured Desktop Client ✅ Instant API Access; Skip deployment headaches – get all product formats in one click. Developers, dive in!</a>+</p>++<!-- join us -->++<p align="center">+ 👋 join us on <a href="https://discord.gg/Tdedn9GTXq" target="_blank">Discord</a> and <a href="https://mineru.net/community-portal/?aliasId=3c430f94" target="_blank">WeChat</a>+</p>++</div>+++<details>+<summary>MinerU — High-accuracy document parsing engine for LLM · RAG · Agent workflows</summary>+Converts PDF · DOCX · PPTX · XLSX · Images · Web pages into structured Markdown / JSON · VLM+OCR dual engine · 109 languages <br>+MCP Server · LangChain / Dify / FastGPT native integration · 10+ domestic AI chip support++**🔍 Core Parsing Capabilities**++- Native support for `DOCX`, `PPTX`, and `XLSX` parsing+- Formulas → LaTeX · Tables → HTML, accurate layout reconstruction+- Supports scanned docs, handwriting, multi-column layouts, cross-page table merging+- Output follows human reading order with automatic header/footer removal+- VLM + OCR dual engine, 109-language OCR recognition++**🔌 Integration**++| Use Case | Solution |+|----------|----------|+| AI Coding Tools | MCP Server — Cursor · Claude Desktop · Windsurf |+| RAG Frameworks | LangChain · LlamaIndex · RAGFlow · RAG-Anything · Flowise · Dify · FastGPT |+| Development | Python / Go / TypeScript SDK · CLI · REST API · Docker |+| No-Code | mineru.net online · Gradio WebUI · Desktop client |++**🖥️ Deployment (Private · Fully Offline)**++| Inference Backend | Best For |+|------------------|---------|+| hybrid-engine --effort low | Fast local parsing, no VLM calls, runs on CPU or GPU |+| hybrid-engine | High accuracy, native text extraction, low hallucination, supports VLM acceleration ecosystem |++Domestic AI chips: Ascend · Cambricon · Enflame · MetaX · Moore Threads · Kunlunxin · Iluvatar · Hygon · Biren · T-Head+</details>++# Changelog++- 2026/06/18 3.4 Released++ This release focuses on **OCR capability upgrades for the pipeline backend**, **OCR processing pipeline optimization**, and **model download experience improvements**. The main updates include:++ - OCR model upgrade and processing acceleration+ - The OCR model for the `pipeline` backend has been upgraded to `PP-OCRv6`, improving OCR accuracy by about `11%` on OmniDocBench v1.6.+ - Removed Japanese, Traditional Chinese, English, and Latin options from OCR language selection. These scenarios are now routed to the `ch` OCR model, simplifying model configuration and language selection.+ - Optimized the OCR inference and processing pipeline, increasing OCR processing speed by about `100%` and significantly improving parsing efficiency for batch documents and OCR-intensive documents.++ - Model download logic optimization+ - Added automatic model source selection, allowing first-time installations to choose a better model source based on the current network environment.+ - Before downloading models, MinerU now prioritizes checking locally downloaded model cache files. Cache hits can be reused directly, reducing repeated downloads and unnecessary remote requests.+ - For more details about model source configuration, automatic source selection, and local model usage, see the [Model Source Documentation](https://opendatalab.github.io/MinerU/usage/model_source/).++ With the 3.4 release, MinerU further improves the parsing accuracy and processing efficiency of the `pipeline` backend in OCR scenarios. It also optimizes model downloads, cache reuse, and local configuration write-back, making first-time installation, model updates, and multi-environment deployment more stable and automated.++- 2026/06/11 3.3 Released++ This release focuses on **Hybrid parsing performance optimization** and **VLM model capability upgrades**. The main updates include:++ - New `effort` parsing-strength parameter for the Hybrid backend+ - Added two parsing-strength levels, `medium` and `high`, allowing users to balance parsing speed, parsing accuracy, and feature requirements.+ - On OmniDocBench v1.6, `medium` reduces overall accuracy by only `0.13` points compared with `high`, while delivering `35%` ~ `220%` parsing speed improvements across different devices and scenarios.+ - The default Hybrid backend now uses `effort=medium`, significantly improving overall parsing efficiency while maintaining high parsing accuracy.+ - The `medium` level does not support `image analysis`; for maximum parsing accuracy or `image analysis` support, switch to `effort=high`.++ - VLM model upgraded to `MinerU2.5-Pro-2605-1.2B`+ - Fixed multiple model issues found in the `2604` version, further improving parsing stability on complex documents.+ - Added native multilingual OCR support, reducing the need for extra language-parameter configuration.++- 2026/04/18 3.1.0 Released++ This release focuses on **licensing openness, parsing accuracy, and full-format native support**. The main updates include:++ - License upgrade+ - MinerU has officially moved from `AGPLv3` to the [MinerU Open Source License](https://github.com/opendatalab/MinerU/blob/master/LICENSE.md), a custom license based on `Apache 2.0`.+ - This change significantly reduces adoption friction for both community users and commercial deployments, making MinerU easier to integrate into real-world workflows.+ - VLM main model upgrade+ - The primary VLM model has been upgraded to `MinerU2.5-Pro-2604-1.2B`, bringing overall parsing accuracy to a state-of-the-art level.+ - The new model now supports image and chart parsing, truncated paragraph merging, cross-page table merging, and image recognition inside tables, further strengthening performance on complex document layouts.+ - Full-format native parsing support+ - Native parsing support has now been extended to `PPTX` and `XLSX`.+ - MinerU now fully supports parsing across images, `PDF`, `DOCX`, `PPTX`, and `XLSX`, providing a more complete multi-format document understanding workflow.++ With the 3.1.0 release, MinerU becomes more open, more accurate, and easier to adopt in production. The new license lowers the barrier for both community and commercial use, `MinerU2.5-Pro-2604-1.2B` improves parsing quality on complex content, and native `PPTX` / `XLSX` support completes end-to-end coverage of mainstream document formats.++- 2026/03/29 3.0.0 Released++ This release delivers a systematic upgrade centered on **parsing capability, system architecture, and engineering usability**. The main updates include:++ - Native `DOCX` parsing+ - Official support for native `DOCX` parsing, delivering high-precision results without hallucinations.+ - Compared with the traditional workflow of first converting `DOCX` to `PDF` and then parsing it, end-to-end speed is improved by tens of times, making it better suited for scenarios with high requirements for both accuracy and throughput.+ - `pipeline` backend upgrade+ - The `pipeline` backend achieves a score of `86.2` on OmniDocBench (v1.5), surpassing the accuracy of the previous-generation mainstream VLM `MinerU2.0-2505-0.9B`.+ - Added support for parsing images/formulas inside tables, seal text recognition, vertical text support, and interline formula numbering recognition, continuously improving parsing quality for complex document scenarios.+ - While maintaining high accuracy, it keeps resource usage extremely low and continues to support inference in pure CPU environments.+ - `API / CLI / Router` orchestration upgrade+ - `mineru` now runs as an orchestration client based on `mineru-api`; when `--api-url` is not provided, it will automatically start a local temporary service.+ - `mineru-api` adds a new asynchronous task endpoint `POST /tasks`, supporting task submission, status querying, and result retrieval; meanwhile, it retains the synchronous parsing endpoint `POST /file_parse` for compatibility with legacy plugins.+ - Added `mineru-router`, designed for unified entry deployment and task routing across multiple services and multiple GPUs; its interfaces are fully compatible with `mineru-api` and support automatic task load balancing.+ - Deployment and usability improvements+ - Resolved compatibility issues with `torch >= 2.8`; the base image has been upgraded to `vllm0.11.2 + torch2.9.0`, unifying installation paths across different Compute Capabilities.+ - Optimized the parsing pipeline with a sliding-window mechanism, significantly reducing peak memory usage in long-document scenarios, so documents with tens of thousands of pages no longer need to be split manually.+ - Batch inference in `pipeline` now supports streaming writes to disk, allowing completed parsing results to be written out in time and further improving the experience for long-running tasks.+ - Completed thread-safety optimization and now fully supports multi-threaded concurrent inference; together with `mineru-router`, this enables one-click multi-GPU deployment and makes it easy to build high-concurrency, high-throughput parsing systems.+ - Completely removed the use of two AGPLv3 models (`doclayoutyolo` and `mfd_yolov8`) and one CC-BY-NC-SA 4.0 model (`layoutreader`).++ This update is not just a set of feature enhancements, but a key leap forward in MinerU's overall system capabilities. We specifically addressed the peak memory usage issue in long-document parsing. Through optimizations such as sliding windows and streaming writes to disk, ultra-long document parsing has moved from “requiring manual splitting and careful handling” to being “stable, scalable, and ready for production workloads.” At the same time, we completed thread-safety optimization and fully enabled multi-threaded concurrent inference, further improving single-machine resource utilization and runtime stability under high-concurrency workloads. On top of this, with `mineru-router` and the new `API / CLI` orchestration framework, MinerU now supports one-click multi-GPU deployment, unified access across multiple services, and automatic task load balancing, significantly reducing the difficulty of large-scale deployment. As a result, MinerU is evolving from a standalone data production tool into a large-scale document parsing foundation for high-concurrency and high-throughput scenarios, providing enterprise-grade document data processing with infrastructure that is more stable, more efficient, and easier to scale.++> 📝 View the complete [Changelog](https://opendatalab.github.io/MinerU/reference/changelog/) for more historical version information++# MinerU++## Project Introduction++MinerU is a document parsing tool that converts `PDF`, image, `DOCX`, `PPTX`, and `XLSX` inputs into machine-readable formats such as Markdown and JSON for downstream retrieval, extraction, and processing.+MinerU was born during the pre-training process of [InternLM](https://github.com/InternLM/InternLM). We focus on solving symbol conversion issues in scientific literature and hope to contribute to technological development in the era of large models.+Compared to well-known commercial products, MinerU is still young. If you encounter any issues or if the results are not as expected, please submit an issue on [issue](https://github.com/opendatalab/MinerU/issues) and **attach the relevant document or sample file**.++https://github.com/user-attachments/assets/4bea02c9-6d54-4cd6-97ed-dff14340982c++## Key Features++- Support `PDF`, image, `DOCX`, `PPTX`, and `XLSX` inputs.+- Remove headers, footers, footnotes, page numbers, etc., to ensure semantic coherence.+- Output text in human-readable order, suitable for single-column, multi-column, and complex layouts.+- Preserve the structure of the original document, including headings, paragraphs, lists, etc.+- Extract images, image descriptions, tables, table titles, and footnotes.+- Automatically recognize and convert formulas in the document to LaTeX format.+- Automatically recognize and convert tables in the document to HTML format.+- Automatically detect scanned PDFs and garbled PDFs and enable OCR functionality.+- OCR supports detection and recognition of 109 languages.+- Supports multiple output formats, such as multimodal and NLP Markdown, JSON sorted by reading order, and rich intermediate formats.+- Supports various visualization results, including layout visualization and span visualization, for efficient confirmation of output quality.+- Built-in CLI, FastAPI, Gradio WebUI, for local orchestration and multi-service deployment.+- Supports running in a pure CPU environment, and also supports GPU/MPS acceleration+- Compatible with Windows, Linux, and Mac platforms.++# Quick Start++Document parsing is a difficult and complex task. In scenarios such as complex layouts, scanned pages, and handwritten content, the parsing results may fall short of expectations. We recommend trying the online demo first to evaluate MinerU's parsing quality and suitability before choosing an appropriate deployment method based on your actual needs.+If you have **document** samples with unsatisfactory parsing results, feel free to share them in an [issue](https://github.com/opendatalab/MinerU/issues). We will continue improving the parsing capabilities.+If you encounter any installation issues, please first consult the <a href="#faq">FAQ</a>.++## Online Experience++### Official online web application+The official online version has the same functionality as the client, with a beautiful interface and rich features, requires login to use++- [](https://mineru.net/OpenSourceTools/Extractor?source=github)++### Gradio-based online demo+A WebUI developed based on Gradio, with a simple interface and only core parsing functionality, no login required++- [](https://www.modelscope.cn/studios/OpenDataLab/MinerU)+- [](https://huggingface.co/spaces/opendatalab/MinerU)++## Local Deployment+++> [!WARNING]+> **Pre-installation Notice—Hardware and Software Environment Support**+>+> To ensure the stability and reliability of the project, we only optimize and test for specific hardware and software environments during development. This ensures that users deploying and running the project on recommended system configurations will get the best performance with the fewest compatibility issues.+>+> By focusing resources on the mainline environment, our team can more efficiently resolve potential bugs and develop new features.+>+> In non-mainline environments, due to the diversity of hardware and software configurations, as well as third-party dependency compatibility issues, we cannot guarantee 100% project availability. Therefore, for users who wish to use this project in non-recommended environments, we suggest carefully reading the documentation and FAQ first. Most issues already have corresponding solutions in the FAQ. We also encourage community feedback to help us gradually expand support.++<table>+ <thead>+ <tr>+ <th rowspan="2">Parsing Backend</th>+ <th rowspan="2">hybrid low</th>+ <th colspan="2">*-engine</th>+ <th colspan="2">*-http-client</th>+ </tr>+ <tr>+ <th>hybrid</th>+ <th>vlm</th>+ <th>hybrid</th>+ <th>vlm</th>+ </tr>+ </thead>+ <tbody>+ <tr>+ <th>Backend Features</th>+ <td >Good Compatibility</td>+ <td colspan="2">High Hardware Requirements</td>+ <td colspan="2">For OpenAI Compatible Servers<sup>2</sup></td>+ </tr>+ <tr>+ <th>Accuracy<sup>1</sup></th>+ <td style="text-align:center;">86.47</td>+ <td style="text-align:center;">95.39 (high)<br>95.26 (medium)</td>+ <td style="text-align:center;">95.30</td>+ <td style="text-align:center;">95.39 (high)<br>95.26 (medium)</td>+ <td style="text-align:center;">95.30</td>+ </tr>+ <tr>+ <th>Operating System</th>+ <td colspan="5" style="text-align:center;">Linux<sup>3</sup> / Windows<sup>4</sup> / macOS<sup>5</sup></td>+ </tr>+ <tr>+ <th>Pure CPU Support</th>+ <td style="text-align:center;">✅</td>+ <td colspan="2" style="text-align:center;">❌</td>+ <td colspan="2" style="text-align:center;">✅</td>+ </tr>+ <tr>+ <th>GPU Acceleration</th>+ <td colspan="4" style="text-align:center;">Volta and later architecture GPUs or Apple Silicon</td>+ <td rowspan="2">Not Required</td>+ </tr>+ <tr>+ <th>Min VRAM</th>+ <td style="text-align:center;">4GB</td>+ <td colspan="2" style="text-align:center;">8GB</td>+ <td style="text-align:center;">2GB</td>+ </tr>+ <tr>+ <th>RAM</th>+ <td colspan="3" style="text-align:center;">Min 16GB, Recommended 32GB or more</td>+ <td colspan="2" style="text-align:center;">Min 16GB</td>+ </tr>+ <tr>+ <th>Disk Space</th>+ <td colspan="3" style="text-align:center;">Min 20GB, SSD Recommended</td>+ <td colspan="2" style="text-align:center;">Min 2GB</td>+ </tr>+ <tr>+ <th>Python Version</th>+ <td colspan="5" style="text-align:center;">3.10-3.13</td>+ </tr>+ </tbody>+</table>++<sup>1</sup> Accuracy metrics are the End-to-End Evaluation Overall scores from OmniDocBench (v1.6), based on the latest version of `MinerU`.+<sup>2</sup> Servers compatible with OpenAI API, such as local model servers or remote model services deployed via inference frameworks like `vLLM`/`SGLang`/`LMDeploy`.+<sup>3</sup> Linux only supports distributions from 2019 and later.+<sup>4</sup> Since the key dependency `ray` does not support Python 3.13 on Windows, only versions 3.10~3.12 are supported.+<sup>5</sup> macOS requires version 14.0 or later.+++### Install MinerU++#### Install MinerU using pip or uv+```bash+pip install --upgrade pip+pip install uv+uv pip install -U "mineru[all]"+```++#### Install MinerU from source code+```bash+git clone https://github.com/opendatalab/MinerU.git+cd MinerU+uv pip install -e .[all]+```++> [!TIP]+> - `mineru[all]` includes all core features, compatible with Windows / Linux / macOS systems, suitable for most users.+> - If CUDA acceleration is unavailable after installing on Windows, see the [Windows CUDA acceleration FAQ](https://opendatalab.github.io/MinerU/faq/#windows-cuda-acceleration).+> - If you need to specify the inference framework for the VLM model, or only intend to install a lightweight client on an edge device, please refer to the documentation [Extension Modules Installation Guide](https://opendatalab.github.io/MinerU/quick_start/extension_modules/).++---++#### Deploy MinerU using Docker+MinerU provides a convenient Docker deployment method, which helps quickly set up the environment and solve some tricky environment compatibility issues.++> [!TIP]+> - Docker deployment is only supported on Linux and Windows environments with WSL2 support;+> - macOS users should refer to the two installation methods above for installation instead of using Docker deployment.++You can get the [Docker Deployment Instructions](https://opendatalab.github.io/MinerU/quick_start/docker_deployment/) in the documentation.++---++### Using MinerU+++If your device meets the GPU acceleration requirements in the table above, you can use a simple command line for document parsing:+```bash+mineru -p <input_path> -o <output_path>+```+If your device does not meet the GPU acceleration requirements, you can use Hybrid low to run without VLM calls:+```bash+mineru -p <input_path> -o <output_path> -b hybrid-engine --effort low+```++`mineru` currently supports local `PDF`, image, `DOCX`, `PPTX`, and `XLSX` file or directory inputs, and can be used for document parsing through the CLI, API, WebUI, and `mineru-router`. For detailed instructions, please refer to the [Usage Guide](https://opendatalab.github.io/MinerU/usage/).++# FAQ++- If you encounter any issues during usage, you can first check the [FAQ](https://opendatalab.github.io/MinerU/faq/) for solutions.+- If your issue remains unresolved, you may also use [DeepWiki](https://deepwiki.com/opendatalab/MinerU) to interact with an AI assistant, which can address most common problems.+- If you still cannot resolve the issue, you are welcome to join our community via [Discord](https://discord.gg/Tdedn9GTXq) or [WeChat](https://mineru.net/community-portal/?aliasId=3c430f94) to discuss with other users and developers.++# All Thanks To Our Contributors++<a href="https://github.com/opendatalab/MinerU/graphs/contributors">+ <img src="https://contrib.rocks/image?repo=opendatalab/MinerU" />+</a>++# License Information++This repository is licensed under the [MinerU Open Source License](https://github.com/opendatalab/MinerU/blob/master/LICENSE.md), based on Apache 2.0 with additional conditions.++# Acknowledgments++- [UniMERNet](https://github.com/opendatalab/UniMERNet)+- [TableStructureRec](https://github.com/RapidAI/TableStructureRec)+- [PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR)+- [PaddleOCR2Pytorch](https://github.com/frotms/PaddleOCR2Pytorch)+- [fast-langdetect](https://github.com/LlmKira/fast-langdetect)+- [pypdfium2](https://github.com/pypdfium2-team/pypdfium2)+- [pdftext](https://github.com/datalab-to/pdftext)+- [pypdf](https://github.com/py-pdf/pypdf)+- [magika](https://github.com/google/magika)+- [vLLM](https://github.com/vllm-project/vllm)+- [LMDeploy](https://github.com/InternLM/lmdeploy)++# Citation++```bibtex+@article{wang2026mineru2,+ title={MinerU2. 5-Pro: Pushing the Limits of Data-Centric Document Parsing at Scale},+ author={Wang, Bin and He, Tianyao and Ouyang, Linke and Wu, Fan and Zhao, Zhiyuan and Chu, Tao and Qu, Yuan and Jin, Zhenjiang and Zeng, Weijun and Miao, Ziyang and others},+ journal={arXiv preprint arXiv:2604.04771},+ year={2026}+}++@article{dong2026minerudiffusion,+ title={MinerU-Diffusion: Rethinking Document OCR as Inverse Rendering via Diffusion Decoding},+ author={Dong, Hejun and Niu, Junbo and Wang, Bin and Zeng, Weijun and Zhang, Wentao and He, Conghui},+ journal={arXiv preprint arXiv:2603.22458},+ year={2026}+}++@article{niu2025mineru2,+ title={Mineru2. 5: A decoupled vision-language model for efficient high-resolution document parsing},+ author={Niu, Junbo and Liu, Zheng and Gu, Zhuangcheng and Wang, Bin and Ouyang, Linke and Zhao, Zhiyuan and Chu, Tao and He, Tianyao and Wu, Fan and Zhang, Qintong and others},+ journal={arXiv preprint arXiv:2509.22186},+ year={2025}+}++@article{wang2024mineru,+ title={Mineru: An open-source solution for precise document content extraction},+ author={Wang, Bin and Xu, Chao and Zhao, Xiaomeng and Ouyang, Linke and Wu, Fan and Zhao, Zhiyuan and Xu, Rui and Liu, Kaiwen and Qu, Yuan and Shang, Fukai and others},+ journal={arXiv preprint arXiv:2409.18839},+ year={2024}+}++@article{he2024opendatalab,+ title={Opendatalab: Empowering general artificial intelligence with open datasets},+ author={He, Conghui and Li, Wei and Jin, Zhenjiang and Xu, Chao and Wang, Bin and Lin, Dahua},+ journal={arXiv preprint arXiv:2407.13773},+ year={2024}+}+```++# Star History++<a>+ <picture>+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=opendatalab/MinerU&type=Date&theme=dark" />+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=opendatalab/MinerU&type=Date" />+ <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=opendatalab/MinerU&type=Date" />+ </picture>+</a>+++# Links+- [MinerU-Diffusion: Rethinking Document OCR as Inverse Rendering via Diffusion Decoding](https://github.com/opendatalab/MinerU-Diffusion)+- [Easy Data Preparation with latest LLMs-based Operators and Pipelines](https://github.com/OpenDCAI/DataFlow)+- [Vis3 (OSS browser based on s3)](https://github.com/opendatalab/Vis3)+- [LabelU (A Lightweight Multi-modal Data Annotation Tool)](https://github.com/opendatalab/labelU)+- [LabelLLM (An Open-source LLM Dialogue Annotation Platform)](https://github.com/opendatalab/LabelLLM)+- [PDF-Extract-Kit (A Comprehensive Toolkit for High-Quality PDF Content Extraction)](https://github.com/opendatalab/PDF-Extract-Kit)+- [OmniDocBench (A Comprehensive Benchmark for Document Parsing and Evaluation)](https://github.com/opendatalab/OmniDocBench)+- [Magic-HTML (Mixed web page extraction tool)](https://github.com/opendatalab/magic-html)+- [Magic-Doc (Fast speed ppt/pptx/doc/docx/pdf extraction tool)](https://github.com/InternLM/magic-doc)+- [Dingo: A Comprehensive AI Data Quality Evaluation Tool](https://github.com/MigoXLab/dingo)diff --git a/README_zh-CN.md b/README_zh.mdsimilarity index 99%rename from README_zh-CN.mdrename to README_zh.mdindex 10ccdbba..85fdb3dd 100644--- a/README_zh-CN.md+++ b/README_zh.md@@ -28,7 +28,7 @@<!-- language -->-[English](README.md) | [简体中文](README_zh-CN.md)+[Agent Guide](README.md) | [English](README_en.md) | [简体中文](README_zh.md)<!-- hot link -->diff --git a/docs/next/cli/mineru-e2e-test-cases.md b/docs/next/cli/mineru-e2e-test-cases.mdindex 2b7f8565..31c69ce1 100644--- a/docs/next/cli/mineru-e2e-test-cases.md+++ b/docs/next/cli/mineru-e2e-test-cases.md@@ -28,6 +28,13 @@- pass / fail / blocked- 失败原因+结构化断言规则:++- 带 `--json` 的命令必须使用 JSON parser 校验 stdout,不允许用字符串截取代替解析。+- JSON 错误优先按 `error.code` 判定;`error.message` 仅用于诊断,不作为稳定协议。用例给出明确错误码时必须精确匹配。+- parse JSON 的 `parse` 对象不包含 `privacy` 和 `via`;需要验证路由时,从 `created_parse_ids` 或 `reused_parse_ids` 提取 parse id,再执行 `mineru show parse <parse_id> --json`。+- 除明确允许的 remote 到同 tier local fallback 外,不允许测试执行器自行改变 tier、page range 或 local/remote 边界重试。+## 2. 前置条件测试环境需提前准备:@@ -51,8 +58,9 @@- `$MINERU_E2E_FIXTURE_DIR/no-read.pdf`,权限不可读文件;若平台无法稳定制造权限场景,可标记相关用例 BLOCKED。- `$MINERU_E2E_FIXTURE_DIR/output-dir/`,用于输出文件测试的目录。- 测试环境允许启动本地 doclib server。-- 测试环境必须安装当前质量解析依赖 extra,以覆盖本地 quality parse-server;默认 tier 相关用例应验证本地 quality tier 可用,不再按缺少本地 quality tier 的预期失败分支判定。-- 除 PARSE-013A1 外,若 remote parse-server 不可用,`--remote` 相关用例按预期失败分支判定;若可用,必须验证 remote/via/privacy 等字段。+- 测试环境必须安装 `xhigh` extra,以覆盖本地 `medium`、`high`、`xhigh` quality parse-server;默认 tier 相关用例应验证本地 quality tier 可用,不再按缺少本地 quality tier 的预期失败分支判定。+- MinerU 的公开 tier 只有 `flash`、`medium`、`high`、`xhigh`;默认 quality tier 选择顺序为 `high`、`xhigh`、`medium`,已缓存结果的读取顺序为 `xhigh`、`high`、`medium`、`flash`。+- 显式指定 quality tier 的 remote 请求应按 remote 成功、remote 失败后同 tier local fallback、remote 与 local 均不可用三个分支判定;不得 fallback 到 `flash`。未指定 tier 时需要先从 remote 能力中按 `high`、`xhigh`、`medium` 选择默认值,无法选择时返回 `quality_tier_unavailable`。- PARSE-013A1 是 remote high 硬性测试,remote parse-server 不可用或不支持 high 均记录为失败。### 2.1 测试 HOME 与隔离配置@@ -80,15 +88,16 @@ rm -rf .venvuv venv .venvsource .venv/bin/activatecd ~/MinerU-Repo-uv pip install ".[high]"+uv pip install ".[xhigh]"cd ~/mineru-e2e-testmineru --help-mineru-kit --help```-安装完成后,`mineru` 和 `mineru-kit` 都应由 `pyproject.toml` 的脚本入口直接提供,不需要配置 shell alias。+当前仓库的 `xhigh` extra 会依次包含 `high` 和 `medium` extra,因此上述安装用于覆盖全部本地 quality tier。-执行 Agent 后续仍只调用 `mineru ...` 命令,不测试 `mineru-kit`,也不直接调用 Python 模块、内部 API 或数据库。+安装完成后,`mineru` 应由 `pyproject.toml` 的脚本入口直接提供,不需要配置 shell alias。++执行 Agent 只调用 `mineru ...` 命令,不测试 `mineru-kit`,也不直接调用 Python 模块、内部 API 或数据库。### 2.3 Fixture 生成方法@@ -972,6 +981,27 @@ mineru watch rescan <watch_id> --no-wait --json- 第二条输出为可直接解析的 JSON- JSON 包含 scan id、status、path 或 watch_id 中的部分字段+### WATCH-004B watch 默认使用 local flash++前置: WATCH-001 已添加 `watch-dir`,且 `watch-doc.pdf` 未命中任何 parsing rule。++命令:++```bash+mineru watch rescan "$MINERU_E2E_FIXTURE_DIR/watch-dir" --wait 60 --json+mineru show file "$MINERU_E2E_FIXTURE_DIR/watch-dir/watch-doc.pdf" --json+mineru list parses --tier flash --status done --json+```++预期:++- 三条命令均 exit code = 0,stdout 均为可直接解析的 JSON+- show file JSON 中 `watch-doc.pdf` 最终存在 `flash` parse/cache+- list parses 中与该文件 sha256 匹配的 parse record 为 `tier = flash`、`privacy = local`、`via = local`+- 未命中 parsing rule 时不自动创建 `medium`、`high`、`xhigh` 或 remote parse record+- watch 结果仅用于发现和索引,不视为默认最终阅读质量+- 不包含 Python traceback+### WATCH-005 删除 watch命令:@@ -1228,19 +1258,24 @@ mineru parse "$MINERU_E2E_FIXTURE_DIR/sample.pdf" --tier flash --pages 1~1 --for命令:```bash-mineru config set parse_server.local.mode managedmineru config set parse_server.local.managed_tier high+mineru config set parse_server.local.mode managedmineru server status --json-mineru parse "$MINERU_E2E_FIXTURE_DIR/sample.pdf" --pages 1~1 --wait 20 --json+mineru parse "$MINERU_E2E_FIXTURE_DIR/sample.pdf" --pages 1~1 --force --wait 180 --json+mineru show parse <created_parse_id> --json```+执行说明:++- 重复执行 `mineru server status --json`,直到 local parse-server healthy 且 `supported_tiers` 包含 `high`,再执行 parse。+- `<created_parse_id>` 从 parse JSON 的 `parse.created_parse_ids[0]` 提取。+预期:-- 三条命令均 exit code = 0-- parse 前 `server status --json` 最终应体现 `parse_server.local.healthy=true`,`supported_tiers` 包含 `high`-- stdout 为可直接解析的 JSON-- 实际 tier 为 high-- 实际 tier 不为 flash+- 五条命令均 exit code = 0+- parse JSON 和 show JSON 均可直接解析+- 默认实际 tier 为 `high`,不为 `flash`+- show JSON 中 `tier = high`、`privacy = local`、`via = local`- 不允许静默返回 flash 内容- 不包含 Python traceback@@ -1249,21 +1284,26 @@ mineru parse "$MINERU_E2E_FIXTURE_DIR/sample.pdf" --pages 1~1 --wait 20 --json命令:```bash-mineru config set parse_server.local.mode managedmineru config set parse_server.local.managed_tier medium+mineru config set parse_server.local.mode managedmineru server status --jsonmineru parse "$MINERU_E2E_FIXTURE_DIR/sample.pdf" --tier medium --pages 1~1 --force --wait 120 --json+mineru show parse <created_parse_id> --json```+执行说明:++- 重复执行 `mineru server status --json`,直到 local parse-server healthy 且 `supported_tiers` 包含 `medium`,再执行 parse。+- `<created_parse_id>` 从 parse JSON 的 `parse.created_parse_ids[0]` 提取。+预期:-- 四条命令均 exit code = 0-- parse 前 `server status --json` 最终应体现 `parse_server.local.healthy=true`,`supported_tiers` 包含 `medium`-- stdout 为可直接解析的 JSON+- 五条命令均 exit code = 0+- parse JSON 和 show JSON 均可直接解析- `parse.tier = medium`- `parse.status = done`- `content` 不为 null-- JSON 不体现 remote/via remote,或明确体现 local transport+- show JSON 中 `tier = medium`、`privacy = local`、`via = local`- 不包含 Python traceback### PARSE-007B PDF local high tier@@ -1271,21 +1311,69 @@ mineru parse "$MINERU_E2E_FIXTURE_DIR/sample.pdf" --tier medium --pages 1~1 --fo命令:```bash-mineru config set parse_server.local.mode managedmineru config set parse_server.local.managed_tier high+mineru config set parse_server.local.mode managedmineru server status --jsonmineru parse "$MINERU_E2E_FIXTURE_DIR/sample.pdf" --tier high --pages 1~1 --force --wait 180 --json+mineru show parse <created_parse_id> --json```+执行说明:++- 重复执行 `mineru server status --json`,直到 local parse-server healthy 且 `supported_tiers` 包含 `high`,再执行 parse。+- `<created_parse_id>` 从 parse JSON 的 `parse.created_parse_ids[0]` 提取。+预期:-- 四条命令均 exit code = 0-- parse 前 `server status --json` 最终应体现 `parse_server.local.healthy=true`,`supported_tiers` 包含 `high`-- stdout 为可直接解析的 JSON+- 五条命令均 exit code = 0+- parse JSON 和 show JSON 均可直接解析- `parse.tier = high`- `parse.status = done`- `content` 不为 null-- JSON 不体现 remote/via remote,或明确体现 local transport+- show JSON 中 `tier = high`、`privacy = local`、`via = local`+- 不包含 Python traceback++### PARSE-007C PDF local xhigh tier++命令:++```bash+mineru config set parse_server.local.managed_tier xhigh+mineru config set parse_server.local.mode managed+mineru server status --json+mineru parse "$MINERU_E2E_FIXTURE_DIR/sample.pdf" --tier xhigh --pages 1~1 --force --wait 300 --json+mineru show parse <created_parse_id> --json+```++执行说明:++- 重复执行 `mineru server status --json`,直到 local parse-server healthy 且 `supported_tiers` 包含 `xhigh`,再执行 parse。+- `<created_parse_id>` 从 parse JSON 的 `parse.created_parse_ids[0]` 提取。++预期:++- 五条命令均 exit code = 0+- parse JSON 和 show JSON 均可直接解析+- `parse.tier = xhigh`+- `parse.status = done`+- `content` 不为 null+- show JSON 中 `tier = xhigh`、`privacy = local`、`via = local`+- 不包含 Python traceback++### PARSE-007D 旧 tier 名称不可用++命令:++```bash+mineru parse "$MINERU_E2E_FIXTURE_DIR/sample.pdf" --tier standard --pages 1~1+mineru parse "$MINERU_E2E_FIXTURE_DIR/sample.pdf" --tier pro --pages 1~1+```++预期:++- 两条命令均 exit code != 0+- 输出明确说明 tier 取值无效,并列出或体现 `flash`、`medium`、`high`、`xhigh` 中的合法值+- 不启动 parse,不生成新的 parse record- 不包含 Python traceback### PARSE-008 输出到文件@@ -1374,7 +1462,7 @@ mineru parse "$MINERU_E2E_FIXTURE_DIR/sample.pdf" --tier flash --pages 1~1 --wai- 输出不包含 `<!-- Next:`- 输出不包含 Python traceback-### PARSE-013 remote parse 分支+### PARSE-013 remote 不接受 flash tier命令:@@ -1384,37 +1472,38 @@ mineru parse "$MINERU_E2E_FIXTURE_DIR/sample.pdf" --tier flash --pages 1~1 --rem预期分支:-- 如果 remote parse-server 可用:- - exit code = 0- - 输出为可直接解析的 JSON- - JSON 体现 remote/via/privacy/tier 中的部分字段-- 如果 remote parse-server 不可用:- - exit code != 0- - 输出包含 remote、parse-server、unavailable、no_engine 或等价可操作错误- - stdout 必须为可直接解析的 JSON error,且包含 `error.code` 和 `error.message`- - 不包含 Python traceback+- exit code != 0+- stdout 为可直接解析的 JSON error+- `error.code = tier_unsupported_for_remote`+- `error.param = tier`+- 不创建 parse record+- 不包含 Python traceback### PARSE-013A remote 默认 tier命令:```bash-mineru parse "$MINERU_E2E_FIXTURE_DIR/sample.pdf" --remote --pages 1~1 --wait 60 --json+mineru parse "$MINERU_E2E_FIXTURE_DIR/sample.pdf" --remote --pages 1~1 --force --wait 180 --json+mineru show parse <created_parse_id> --json```+执行说明:++- parse 成功时,`<created_parse_id>` 从 parse JSON 的 `parse.created_parse_ids[0]` 提取,再执行 show。+预期分支:-- 如果 remote parse-server 可用:- - exit code = 0- - 输出为可直接解析的 JSON- - tier 应为 remote 支持的 quality tier;如果 remote 暴露 `high`,默认应为 `high`- - JSON 体现 remote/via/privacy 中的部分字段- - 不允许在未声明 fallback 的情况下静默返回本地 flash 内容-- 如果 remote parse-server 不可用:+- 如果 remote parse-server 暴露 quality tier:+ - parse 和 show 均 exit code = 0,stdout 均为可直接解析的 JSON+ - 默认 tier 按 `high`、`xhigh`、`medium` 的顺序选择第一个受 remote 支持的 tier+ - show JSON 中 `privacy = remote`、`via = remote`+- 如果 remote parse-server 未暴露任何 quality tier:- exit code != 0- - `--json` 输出必须为可直接解析的 JSON error- - error code/message 包含 remote、parse-server、unavailable、no_engine、quality_tier_unavailable 或等价可操作信息- - 不包含 Python traceback+ - stdout 为可直接解析的 JSON error+ - `error.code = quality_tier_unavailable`+- 不允许 fallback 到 `flash`+- 不包含 Python traceback### PARSE-013A1 PDF remote high tier@@ -1422,15 +1511,20 @@ mineru parse "$MINERU_E2E_FIXTURE_DIR/sample.pdf" --remote --pages 1~1 --wait 60```bashmineru parse "$MINERU_E2E_FIXTURE_DIR/sample.pdf" --tier high --remote --pages 1~1 --force --wait 180 --json+mineru show parse <created_parse_id> --json```+执行说明:++- `<created_parse_id>` 从 parse JSON 的 `parse.created_parse_ids[0]` 提取。+预期:-- exit code = 0-- stdout 为可直接解析的 JSON+- 两条命令均 exit code = 0,stdout 均为可直接解析的 JSON- `parse.tier = high`-- JSON 体现 remote/via/privacy 中的部分字段-- 不允许静默 fallback 到 local flash、local medium、local high 或 remote medium+- show JSON 中 `tier = high`、`privacy = remote`、`via = remote`+- remote 不可用、remote 不支持 high、或实际 `via = local` 均记录为失败+- 不允许 fallback 到 local high、其它 tier 或 flash- 不包含 Python traceback### PARSE-013B remote no-wait@@ -1438,63 +1532,72 @@ mineru parse "$MINERU_E2E_FIXTURE_DIR/sample.pdf" --tier high --remote --pages 1命令:```bash-mineru parse "$MINERU_E2E_FIXTURE_DIR/sample.pdf" --remote --pages 1~1 --no-wait --json+mineru parse "$MINERU_E2E_FIXTURE_DIR/sample.pdf" --tier high --remote --pages 1~1 --force --no-wait --json+mineru show parse <created_parse_id> --json```+执行说明:++- `<created_parse_id>` 从第一条 JSON 的 `parse.created_parse_ids[0]` 提取。+- 第一条必须立即返回;随后可重复执行 show,直到 parse 进入 done 或 failed 终态。+预期分支:-- 如果 remote parse-server 可用:- - exit code = 0- - 输出为可直接解析的 JSON- - 输出为已完成内容、pending/parsing 任务状态或明确缓存结果- - 不长时间阻塞-- 如果 remote parse-server 不可用:- - exit code != 0- - 输出包含 remote、parse-server、unavailable 或等价错误- - stdout 必须为可直接解析的 JSON error,且包含 `error.code` 和 `error.message`- - 不包含 Python traceback+- 第一条 exit code = 0,stdout 为可直接解析的 JSON,不长时间阻塞+- `parse.tier = high`、`parse.created_parse_ids` 非空,状态为 pending、parsing 或 done+- 最终 done 时,show JSON 中 `privacy = remote`,`via` 为 `remote` 或同 tier fallback 的 `local`+- 最终 failed 时,show JSON 中 `error_code` 为 `parse_server_unavailable`、`engine_unavailable`、`tier_mismatch` 或其它结构化执行错误码+- 不允许 fallback 到 `flash` 或其它 tier+- 不包含 Python traceback### PARSE-013C remote force命令:```bash-mineru parse "$MINERU_E2E_FIXTURE_DIR/sample.pdf" --remote --pages 1~1 --force --wait 60 --json+mineru parse "$MINERU_E2E_FIXTURE_DIR/sample.pdf" --tier high --remote --pages 1~1 --force --wait 180 --json+mineru show parse <created_parse_id> --json```+执行说明:++- parse 成功时,`<created_parse_id>` 从 parse JSON 的 `parse.created_parse_ids[0]` 提取,再执行 show。+预期分支:-- 如果 remote parse-server 可用:- - exit code = 0- - 输出为可直接解析的 JSON+- 如果 remote 或同 tier local fallback 可用:+ - parse 和 show 均 exit code = 0,stdout 均为可直接解析的 JSON- 不复用旧的 done batch 作为唯一依据,JSON 中应体现新 parse 或 force 后结果+ - show JSON 中 `privacy = remote`+ - remote 成功时 `via = remote`;remote 不可用但 local high 可用时允许 `via = local`- 后续普通 remote parse 不因 force 损坏缓存-- 如果 remote parse-server 不可用:+- 如果 remote 不支持 high,或 remote 和 local high 均不可用:- exit code != 0- - 输出包含 remote、parse-server、unavailable 或等价错误- - stdout 必须为可直接解析的 JSON error,且包含 `error.code` 和 `error.message`- - 不包含 Python traceback+ - stdout 为可直接解析的 JSON error+ - 依据 `error.code` 判定,不依赖 `error.message` 文案+- 不允许 fallback 到 `flash` 或其它 tier+- 不包含 Python traceback### PARSE-013D remote output命令:```bash-mineru parse "$MINERU_E2E_FIXTURE_DIR/sample.pdf" --remote --pages 1~1 --wait 60 --output "$MINERU_E2E_FIXTURE_DIR/output-dir/remote-output.md"+mineru parse "$MINERU_E2E_FIXTURE_DIR/sample.pdf" --tier high --remote --pages 1~1 --force --wait 180 --output "$MINERU_E2E_FIXTURE_DIR/output-dir/remote-output.md"```预期分支:-- 如果 remote parse-server 可用:+- 如果 remote 或同 tier local fallback 可用:- exit code = 0- 输出包含 `Written to` 或等价成功信息- stdout 不大量打印完整文档内容- 输出路径为命令指定路径-- 如果 remote parse-server 不可用:+- 如果 remote 和 local high 均不可用:- exit code != 0- - 输出包含 remote、parse-server、unavailable 或等价错误- 不创建空的成功输出文件- - 不包含 Python traceback+- 不允许 fallback 到 `flash` 或其它 tier+- 不包含 Python traceback### PARSE-013E remote 与 local cache 隔离@@ -1502,14 +1605,14 @@ mineru parse "$MINERU_E2E_FIXTURE_DIR/sample.pdf" --remote --pages 1~1 --wait 60```bashmineru parse "$MINERU_E2E_FIXTURE_DIR/sample.pdf" --tier flash --pages 1~1 --wait 60 --json-mineru parse "$MINERU_E2E_FIXTURE_DIR/sample.pdf" --remote --pages 1~1 --wait 60 --json+mineru parse "$MINERU_E2E_FIXTURE_DIR/sample.pdf" --tier high --remote --pages 1~1 --force --wait 180 --jsonmineru parse "$MINERU_E2E_FIXTURE_DIR/sample.pdf" --tier flash --pages 1~1 --wait 60 --json```预期:- 第一条和第三条 local flash 命令 exit code = 0,tier = flash-- 第二条按 PARSE-013A 的 remote 可用/不可用分支判定+- 第二条按 PARSE-013C 的 remote/local fallback 分支判定,成功时 tier 必须为 high- remote 成功或失败均不得污染 local flash 缓存- 第三条不应因为第二条 remote 失败而失败@@ -1518,7 +1621,7 @@ mineru parse "$MINERU_E2E_FIXTURE_DIR/sample.pdf" --tier flash --pages 1~1 --wai命令:```bash-mineru config parsing-rules add "*/sample.pdf" --remote --pages 1~1 --name e2e-remote-rule --json+mineru config parsing-rules add "*/sample.pdf" --tier high --remote --pages 1~1 --name e2e-remote-rule --jsonmineru watch add "$MINERU_E2E_FIXTURE_DIR" --label e2e-remote-rule-watch --jsonmineru watch rescan "$MINERU_E2E_FIXTURE_DIR" --wait 60 --jsonmineru list parses --limit 20 --json@@ -1535,10 +1638,29 @@ mineru config parsing-rules remove <rule_id>- add/watch/rescan/list/remove exit code = 0,JSON 可解析- parsing-rule 的 `remote` 字段用于规则命中后的自动解析策略,尤其是 watch 自动触发/后台解析;不要求用户主动 `mineru parse <path>` 在未传 `--remote` 时也按该规则上传远端-- 如果 remote parse-server 可用,规则命中的自动解析任务应体现 remote/privacy/via/tier 中的部分字段,或在 `list parses` 中可观察到对应 remote 解析任务-- 如果 remote parse-server 不可用,规则命中的自动解析任务应记录明确 remote/parse-server 不可用错误;命令带 `--json` 时 stdout 必须为可直接解析的 JSON+- 规则命中的 parse record 应为 `tier = high`、`privacy = remote`+- remote 成功时 parse record 的 `via = remote`+- remote 不可用但 local high 可用时允许 `via = local`;remote 和 local high 均不可用时 parse record 应为 failed,并记录结构化 `error_code`+- 不允许规则任务 fallback 到 `flash` 或其它 tier- remove 后规则不再影响后续 watch 自动解析+### PARSE-013G tier 与文件类型约束++命令:++```bash+mineru parse "$MINERU_E2E_FIXTURE_DIR/sample.docx" --tier high --wait 60 --json+mineru parse "$MINERU_E2E_FIXTURE_DIR/sample.docx" --tier high --remote --wait 60 --json+```++预期:++- 两条命令均 exit code != 0,stdout 均为可直接解析的 JSON error+- 第一条 `error.code = tier_unsupported_for_file_type`,`error.param = tier`+- 第二条 `error.code = remote_unsupported_for_file_type`,`error.param = remote`+- Office 文件只允许 local `flash`,不创建 high/remote parse record+- 不包含 Python traceback+### PARSE-014 非法 format命令:@@ -1609,6 +1731,24 @@ mineru read "doc:<short_id>/tier:flash/page:1" --json- JSON 包含 request_scope- request_scope.locator 包含输入 locator 或规范化 locator+### READ-002A 无 tier locator 读取最高缓存++前置: PARSE-007A、PARSE-007B、PARSE-007C 已为同一 `sample.pdf` 的第 1 页生成 `medium`、`high`、`xhigh` 三种 done 缓存。++命令模板:++```bash+mineru read "doc:<short_id>" --json+```++预期:++- exit code = 0,stdout 为可直接解析的 JSON+- 返回 `tier = xhigh`+- `request_scope.locator` 体现输入 locator 或规范化 locator+- 命令只读取最高已缓存结果,不创建新的 parse record+- 不包含 Python traceback+### READ-003 read context命令模板:@@ -3277,6 +3417,7 @@ mineru server start- WATCH-001A 重复添加 watch- WATCH-002 列出 watch- WATCH-004 watch rescan+- WATCH-004B watch 默认使用 local flash- WATCH-006 删除不存在的 watch- WATCH-007 添加不存在目录- WATCH-009 removable watch@@ -3315,11 +3456,13 @@ mineru server start- PARSE-007 默认 tier 行为- PARSE-007A PDF local medium tier- PARSE-007B PDF local high tier+- PARSE-007C PDF local xhigh tier+- PARSE-007D 旧 tier 名称不可用- PARSE-008 输出到文件- PARSE-010 limit 截断与 next_request- PARSE-011 after 续读- PARSE-012 no-marker-- PARSE-013 remote parse 分支+- PARSE-013 remote 不接受 flash tier- PARSE-013A remote 默认 tier- PARSE-013A1 PDF remote high tier- PARSE-013B remote no-wait@@ -3327,13 +3470,15 @@ mineru server start- PARSE-013D remote output- PARSE-013E remote 与 local cache 隔离- PARSE-013F remote 配置规则+- PARSE-013G tier 与文件类型约束- PARSE-015 JSON 输出纯净性- PARSE-016 page range 边界执行要求:-- remote 不可用时,相关命令必须返回 JSON error 或普通可读错误,不能 traceback。-- remote 可用时,必须验证 remote/via/privacy/tier 中至少部分字段。+- remote 路由必须通过 `show parse --json` 的 `privacy`、`via`、`tier` 验证,不能从 parse JSON 中推断。+- 显式 quality tier 的 remote 请求在 remote 不可用时允许同 tier local fallback;未指定 tier 且 remote 无 quality tier 时应返回 `quality_tier_unavailable`。+- remote/local fallback 不得改变 tier,也不得降级到 `flash`。- PARSE-013A1 是 remote high 硬性测试;remote 不可用或不支持 high 均记录为失败,不能静默 fallback 到 local 或其它 tier。- force/cache/no-wait 用例必须记录 parse id/status 是否符合预期。@@ -3342,6 +3487,7 @@ mineru server start必跑 case:- READ-001 读取 page locator+- READ-002A 无 tier locator 读取最高缓存- READ-003 read context- READ-004 invalid locator- READ-005 输出到文件@@ -3523,7 +3669,7 @@ Blocked:Environment:- mineru version: <如果 help/status 输出能看到则填写,否则 unknown>- fixture dir: ...-- quality tier available: <available quality tiers>+- quality tier available: medium/high/xhigh- remote high available: yes- pdf fixture source: ...```diff --git a/docs/plans/2026-06-24-mineru-next-dev-release-design.md b/docs/plans/2026-06-24-mineru-next-dev-release-design.mddeleted file mode 100644index 8081e762..00000000--- a/docs/plans/2026-06-24-mineru-next-dev-release-design.md+++ /dev/null@@ -1,196 +0,0 @@-# MinerU Next Dev Daily Release Design--## Goal--Add a new GitHub Actions workflow in the personal repository `johnking0099/MinerU-Repo` to publish a daily development package for the `next` branch.--The published package is separate from the official package:--- package name: `mineru-next-dev`-- version scheme: `4.0.0.devYYYYMMDD`--The workflow should run once per day. It should publish only when the `next` branch source commit changed since the last successful publish.--## Scope--This design covers:--- workflow trigger strategy-- package naming and versioning-- source-change detection-- release state persistence-- PyPI publishing flow--This design does not cover:--- changing the official `mineru` release workflow-- changing upstream `opendatalab/MinerU` workflows-- supporting multiple scheduled publishes per day--## Requirements--1. The workflow runs in the personal repository, not the upstream repository.-2. The workflow checks out the `next` branch as the release source.-3. The workflow runs once per day on a schedule.-4. If `next` has no source change since the last successful publish, the workflow exits without publishing.-5. If `next` changed, the workflow publishes a package to the real PyPI index.-6. The published package name is `mineru-next-dev`.-7. The published version is `4.0.0.devYYYYMMDD`.-8. The workflow must support manual execution through `workflow_dispatch`.-9. Release state must not mutate the `next` branch itself.--## Chosen Approach--Use two branches with distinct roles:--- `next`: source branch used to build the package-- `release-state`: state-only branch used to record the last successful published commit--The workflow will:--1. Checkout `next`-2. Resolve the current `next` HEAD commit SHA-3. Read the last published SHA from a state file on `release-state`-4. Compare the two SHAs-5. Skip publish when they match-6. Patch package metadata locally in the workflow workspace-7. Build and upload the distribution to PyPI-8. Update the state file on `release-state` after a successful publish--This avoids the main failure mode of writing state back to `next`, which would otherwise change `HEAD` and force false-positive daily releases.--## State File--State is stored in the repository on branch `release-state`.--Suggested path:--`/.github/release-state/mineru-next-dev.json`--Suggested format:--```json-{- "package": "mineru-next-dev",- "version": "4.0.0.dev20260624",- "source_branch": "next",- "source_commit": "abc123def456",- "published_at": "2026-06-24T02:00:00Z"-}-```--## Versioning Rules--The package version is always generated from the current UTC date:--- `4.0.0.devYYYYMMDD`--Examples:--- `4.0.0.dev20260624`-- `4.0.0.dev20260625`--Daily scheduled execution means the normal path produces at most one publish attempt per day. Manual reruns are expected to be for recovery or inspection, not for additional same-day release numbering.--## Package Metadata Strategy--The workflow should patch package metadata only in the transient workflow workspace.--Recommended local modifications before build:--1. patch `[project].name` in `pyproject.toml` from `mineru` to `mineru-next-dev`-2. patch `mineru/version.py` to the generated `4.0.0.devYYYYMMDD`--These changes should not be committed back to `next`.--This keeps the release package separate from the official package without creating repository noise.--## Workflow Trigger Strategy--The new workflow should support:--- `schedule`-- `workflow_dispatch`--The schedule should run once per day at a fixed UTC time. The exact cron expression can be tuned later, but the design assumes one scheduled run per day.--## Publish Decision Logic--The workflow should publish only when:--- current `next` HEAD SHA differs from the stored `source_commit` on `release-state`--If the state file does not exist yet, the workflow should treat the run as the initial publish and continue.--If the publish fails, the state file must not be updated.--## Authentication and Secrets--Required repository secrets:--- `PYPI_TOKEN`: used to upload `mineru-next-dev` to PyPI--Required workflow permissions:--- `contents: write`--`contents: write` is needed only for updating the `release-state` branch after a successful publish.--## Failure Handling--1. State write must happen only after PyPI upload succeeds.-2. If build or upload fails, the workflow should leave `release-state` unchanged.-3. If `release-state` is missing, the workflow should initialize it.-4. If the package version already exists on PyPI for the day, manual rerun behavior should fail clearly instead of mutating state incorrectly.--## Alternatives Considered--### Alternative 1: store state on `next`--Rejected.--Reason:--- writing state to `next` changes the branch `HEAD`-- future runs would always see a changed commit-- this creates false-positive daily publishes--### Alternative 2: query PyPI for the last published version and infer commit--Rejected.--Reason:--- harder to reconstruct source commit accurately-- introduces external-state coupling-- more complex than repository-controlled state--### Alternative 3: use GitHub Releases or artifacts as state--Rejected.--Reason:--- possible, but less transparent and harder to inspect manually-- repository file state is simpler and easier to repair--## Implementation Plan--Implementation should add:--1. a new workflow under `.github/workflows/`-2. a small helper script to:- - compute the release version- - read/write the release-state JSON- - patch package metadata in the workspace-3. initial bootstrap handling for the `release-state` branch--## Open Decisions Already Resolved--- publish target: real PyPI-- source branch: `next`-- package name: `mineru-next-dev`-- version scheme: `4.0.0.devYYYYMMDD`-- state storage: repository branch `release-state`-- scheduled frequency: once per day-diff --git a/docs/zh/usage/acceleration_cards/VastAI.md b/docs/zh/usage/acceleration_cards/VastAI.mdindex a1938670..c5f54435 100644--- a/docs/zh/usage/acceleration_cards/VastAI.md+++ b/docs/zh/usage/acceleration_cards/VastAI.md@@ -41,7 +41,7 @@- 安装MinerU- - 参考官方文档安装:[README_zh-CN.md#安装-mineru](https://github.com/opendatalab/MinerU/blob/master/README_zh-CN.md#安装-mineru)+ - 参考官方文档安装:[README_zh.md#安装-mineru](https://github.com/opendatalab/MinerU/blob/master/README_zh.md#安装-mineru)```bash# 启动容器@@ -212,4 +212,4 @@> - 🟢: 支持,运行较稳定,精度与NVIDIA GPU基本一致> - 🟡: 支持但较不稳定,在某些场景下可能出现异常,或精度存在一定差异> - 🔴: 不支持,无法运行,或精度存在较大差异-> - `vlm-engine`:VastAI仅支持vLLM后端\ No newline at end of file+> - `vlm-engine`:VastAI仅支持vLLM后端diff --git a/mineru/version.py b/mineru/version.pyindex 903a158a..8f00bebe 100644--- a/mineru/version.py+++ b/mineru/version.py@@ -1 +1 @@-__version__ = "3.4.0"+__version__ = "4.0.0a1"diff --git a/skills/mineru/SKILL.md b/skills/mineru/SKILL.mdindex 349783c1..24642d0d 100644--- a/skills/mineru/SKILL.md+++ b/skills/mineru/SKILL.md@@ -1,39 +1,18 @@----name: mineru-document-parser-description: Use when an agent needs to read, parse, OCR, search, inspect, or cite local documents with MinerU, including PDFs, scanned documents, images, DOCX, PPTX, XLSX, academic papers, long documents, tables, formulas, and document locators. Use for agent-native document reading workflows that should prefer local privacy, structured errors, continuation, and stable page/block locators.-metadata:- openclaw:- emoji: "📄"- privacy: "MinerU defaults to local parsing and local storage. Document content is not uploaded unless the user explicitly allows remote parsing with --remote or an equivalent parsing rule."- requires:- bins: ["mineru"]- optional:- env: ["MINERU_HOME", "MINERU_API_KEY"]- install:- - id: "uv"- kind: "python"- package: "mineru"- bins: ["mineru"]- label: "Install via uv tool"- - id: "pipx"- kind: "python"- package: "mineru"- bins: ["mineru"]- label: "Install via pipx"- - id: "pip"- kind: "python"- package: "mineru"- bins: ["mineru"]- label: "Install via pip fallback"-allowed-tools: Bash(mineru:*), Bash(command:*), Bash(test:*), Bash(uv:*), Bash(pipx:*), Bash(pip:*), Bash(python:*), Bash(python3:*), Bash(which:*)+name: mineru+description: Use MinerU when an agent needs to read, parse, OCR, search, inspect, or cite local documents, including PDFs, scanned documents, images, DOCX, PPTX, XLSX, academic papers, long documents, tables, formulas, and document locators. Use for agent-native document reading workflows that should prefer local privacy, structured errors, continuation, and stable page/block locators.----# MinerU Document Parser+# MinerU-## What MinerU Is+[Agent Guide](README.md) | [English](README_en.md) | [简体中文](README_zh.md)MinerU is a command-line document reader for agents. It parses local documents into readable content, lets agents continue by page or block, and returns stable locators for follow-up reads and citations.+## Pre-release Status++The current MinerU release line is in Alpha pre-release. Package installers normally prefer stable releases, so explicitly enable pre-release resolution whenever installing or upgrading MinerU from a package index. The installation commands in this skill already include the required installer-specific options.+## What MinerU Is NotMinerU is not a browser, RAG framework, embedding system, vector database, or chat-with-doc application. It can be used as the document parsing step in a larger pipeline, but this skill only uses the `mineru` command.@@ -162,7 +141,7 @@ uv python install 3.12Then install MinerU with the supported interpreter that was found, or with Python 3.12 if it was installed as the fallback:```bash-uv tool install --python 3.12 mineru-next-dev+uv tool install --python 3.12 --prerelease allow mineru```### Install with `pipx`@@ -179,7 +158,7 @@ PIPX_DEFAULT_PYTHON="$(pipx environment --value PIPX_DEFAULT_PYTHON)"Check the `PIPX_DEFAULT_PYTHON` path reported by `pipx`. If that interpreter satisfies `>=3.10,<3.14`, install with `pipx`:```bash-pipx install mineru-next-dev+pipx install --pip-args="--pre" mineru```If `PIPX_DEFAULT_PYTHON` is unsupported, but a supported Python interpreter can be found on the current system, pass it explicitly. `python3.12` is an example; use any interpreter that satisfies `>=3.10,<3.14`.@@ -187,13 +166,13 @@ If `PIPX_DEFAULT_PYTHON` is unsupported, but a supported Python interpreter can```bashcommand -v python3.12python3.12 --version-pipx install --python python3.12 mineru-next-dev+pipx install --python python3.12 --pip-args="--pre" mineru```If no supported system interpreter is available and `pipx` supports Python fetching, ask for approval before downloading a standalone Python:```bash-pipx install --python 3.12 --fetch-python=missing mineru-next-dev+pipx install --python 3.12 --fetch-python=missing --pip-args="--pre" mineru```### Install with global `pip`@@ -208,7 +187,7 @@ pip --versionIf a `pip` command reports Python `>=3.10,<3.14`, and the user confirms, install with the exact supported `pip` command that was verified. Replace `pip` below with the verified pip command if needed:```bash-pip install mineru-next-dev+pip install --pre mineru```### If No Supported Installer Is Available@@ -349,12 +328,12 @@ Managed local parsing requires optional runtime dependencies. Install the requirThe following examples assume the current install tool is `uv tool`. If `mineru` was installed with another tool or environment, use the equivalent command for that actual tool/environment.-Installing extras with `uv tool install --force` can reinstall or upgrade the `mineru` package. Restart the MinerU server after installing extras so the CLI client, doclib server, and managed parse server use the same installed version.+Installing extras with `uv tool install --force --prerelease allow` can reinstall or upgrade the `mineru` package. Restart the MinerU server after installing extras so the CLI client, doclib server, and managed parse server use the same installed version.Enable managed local parsing for `medium`:```bash-uv tool install --force "mineru-next-dev[medium]"+uv tool install --force --prerelease allow "mineru[medium]"mineru server restartmineru config set parse_server.local.managed_tier mediummineru config set parse_server.local.mode managed@@ -364,7 +343,7 @@ mineru server status --jsonEnable managed local parsing for `high`:```bash-uv tool install --force "mineru-next-dev[high]"+uv tool install --force --prerelease allow "mineru[high]"mineru server restartmineru config set parse_server.local.managed_tier highmineru config set parse_server.local.mode managed@@ -374,7 +353,7 @@ mineru server status --jsonEnable managed local parsing for `xhigh`:```bash-uv tool install --force "mineru-next-dev[xhigh]"+uv tool install --force --prerelease allow "mineru[xhigh]"mineru server restartmineru config set parse_server.local.managed_tier xhighmineru config set parse_server.local.mode manageddiff --git a/tests/unittest/test_doclib_app_startup.py b/tests/unittest/test_doclib_app_startup.pyindex 75ba0b59..9efce4af 100644--- a/tests/unittest/test_doclib_app_startup.py+++ b/tests/unittest/test_doclib_app_startup.py@@ -105,62 +105,6 @@ def test_config_set_rejects_invalid_known_config_values(key: str, value: str, moassert config_response.json()["source"] == "default"-def test_config_set_managed_mode_preflights_managed_tier_dependencies(monkeypatch, tmp_path) -> None:- def _skip_background_task(*args, **kwargs):- return None-- def _import_module(module_name: str):- if module_name == "torch":- raise ModuleNotFoundError("No module named 'torch'")- return object()-- monkeypatch.setattr(doclib_app, "_create_background_task", _skip_background_task)- monkeypatch.setattr(parser_tier.importlib, "import_module", _import_module)- monkeypatch.setattr(parser_tier.importlib_metadata, "packages_distributions", lambda: {"mineru": ["mineru-next-dev"]})-- cfg = PatchedConfig(doclib={"data_dir": str(tmp_path), "sqlite": {"path": str(tmp_path / "doclib.db")}})- with TestClient(doclib_app.create_app(cfg)) as client:- response = client.put("/api/v1/configs/parse_server.local.mode", json={"value": "managed"})- config_response = client.get("/api/v1/configs/parse_server.local.mode")-- assert response.status_code == 400- payload = response.json()- assert payload["error"]["code"] == "parse_server_dependency_missing"- assert payload["error"]["param"] == "parse_server.local.mode"- assert "torch" in payload["error"]["message"]- assert "pip install 'mineru-next-dev[high]'" in payload["error"]["message"]- assert config_response.json()["value"] == "disabled"---def test_config_set_managed_tier_preflights_even_when_mode_is_disabled(monkeypatch, tmp_path) -> None:- def _skip_background_task(*args, **kwargs):- return None-- def _import_module(module_name: str):- if module_name == "mlx":- raise ModuleNotFoundError("No module named 'mlx'")- return object()-- monkeypatch.setattr(doclib_app, "_create_background_task", _skip_background_task)- monkeypatch.setattr(parser_tier.importlib, "import_module", _import_module)- monkeypatch.setattr(parser_tier.importlib_metadata, "packages_distributions", lambda: {"mineru": ["mineru-next-dev"]})- monkeypatch.setattr(parser_tier.sys, "platform", "darwin")- monkeypatch.setattr(parser_tier.platform, "machine", lambda: "arm64")-- cfg = PatchedConfig(doclib={"data_dir": str(tmp_path), "sqlite": {"path": str(tmp_path / "doclib.db")}})- with TestClient(doclib_app.create_app(cfg)) as client:- response = client.put("/api/v1/configs/parse_server.local.managed_tier", json={"value": "xhigh"})- config_response = client.get("/api/v1/configs/parse_server.local.managed_tier")-- assert response.status_code == 400- payload = response.json()- assert payload["error"]["code"] == "parse_server_dependency_missing"- assert payload["error"]["param"] == "parse_server.local.managed_tier"- assert "mlx" in payload["error"]["message"]- assert "pip install 'mineru-next-dev[xhigh]'" in payload["error"]["message"]- assert config_response.json()["value"] == "high"--def test_background_task_crash_is_logged(caplog: pytest.LogCaptureFixture) -> None:async def _boom() -> None:raise RuntimeError("boom")diff --git a/tests/unittest/test_next_dev_release.py b/tests/unittest/test_next_dev_release.pydeleted file mode 100644index 9ad18962..00000000--- a/tests/unittest/test_next_dev_release.py+++ /dev/null@@ -1,224 +0,0 @@-from __future__ import annotations--import importlib.util-import json-import sys-from datetime import UTC, datetime-from pathlib import Path--import pytest---def _load_release_module():- module_path = Path(__file__).resolve().parents[2] / ".github" / "scripts" / "next_dev_release.py"- spec = importlib.util.spec_from_file_location("next_dev_release", module_path)- assert spec is not None- assert spec.loader is not None- module = importlib.util.module_from_spec(spec)- sys.modules[spec.name] = module- spec.loader.exec_module(module)- return module---def test_build_version_uses_utc_date() -> None:- module = _load_release_module()-- version = module.build_version("4.0.0", datetime(2026, 6, 25, 1, 2, 3, tzinfo=UTC))-- assert version == "4.0.0.dev2026062500"---def test_build_version_uses_daily_sequence() -> None:- module = _load_release_module()-- version = module.build_version("4.0.0", datetime(2026, 6, 25, 1, 2, 3, tzinfo=UTC), sequence=3)-- assert version == "4.0.0.dev2026062503"---def test_build_version_rejects_sequence_that_breaks_date_ordering() -> None:- module = _load_release_module()-- with pytest.raises(ValueError, match="between 0 and 99"):- module.build_version("4.0.0", datetime(2026, 6, 25, 1, 2, 3, tzinfo=UTC), sequence=100)---def test_write_and_read_release_state(tmp_path: Path) -> None:- module = _load_release_module()- state_file = tmp_path / "state.json"-- module.write_state(- state_file,- package="mineru-next-dev",- version="4.0.0.dev2026062500",- source_branch="next",- source_commit="abc123",- trigger="schedule",- release_date="20260625",- sequence=0,- published_at="2026-06-25T02:20:00Z",- )-- payload = json.loads(state_file.read_text(encoding="utf-8"))- assert payload["source_commit"] == "abc123"- assert payload["last_auto_date"] == "2026-06-25"- assert payload["daily_sequences"] == {"20260625": 0}- assert payload["releases"][0]["trigger"] == "schedule"-- state = module.read_state(state_file)- assert state is not None- assert state.package == "mineru-next-dev"- assert state.version == "4.0.0.dev2026062500"- assert state.source_branch == "next"- assert state.source_commit == "abc123"- assert state.published_at == "2026-06-25T02:20:00Z"- assert state.last_auto_date == "2026-06-25"- assert state.daily_sequences == {"20260625": 0}- assert state.releases[0].source_commit == "abc123"---def test_read_release_state_accepts_legacy_shape(tmp_path: Path) -> None:- module = _load_release_module()- state_file = tmp_path / "state.json"- state_file.write_text(- json.dumps(- {- "package": "mineru-next-dev",- "version": "4.0.0.dev20260625",- "source_branch": "next",- "source_commit": "abc123",- "published_at": "2026-06-25T02:20:00Z",- }- ),- encoding="utf-8",- )-- state = module.read_state(state_file)-- assert state is not None- assert state.version == "4.0.0.dev20260625"- assert state.last_auto_date is None- assert state.daily_sequences == {}- assert state.releases == []---def test_plan_release_initial_publish_uses_first_daily_sequence() -> None:- module = _load_release_module()-- plan = module.plan_release(- None,- base_version="4.0.0",- source_commit="abc123",- trigger="schedule",- now=datetime(2026, 6, 25, 1, 2, 3, tzinfo=UTC),- )-- assert plan.should_publish is True- assert plan.version == "4.0.0.dev2026062500"- assert plan.release_date == "20260625"- assert plan.sequence == 0---def test_plan_release_skips_second_automatic_release_on_same_utc_date(tmp_path: Path) -> None:- module = _load_release_module()- state_file = tmp_path / "state.json"- module.write_state(- state_file,- package="mineru-next-dev",- version="4.0.0.dev2026062500",- source_branch="next",- source_commit="abc123",- trigger="schedule",- release_date="20260625",- sequence=0,- published_at="2026-06-25T02:20:00Z",- )-- plan = module.plan_release(- module.read_state(state_file),- base_version="4.0.0",- source_commit="def456",- trigger="schedule",- now=datetime(2026, 6, 25, 8, 0, 0, tzinfo=UTC),- )-- assert plan.should_publish is False- assert plan.reason == "automatic release already ran on 2026-06-25"---def test_plan_release_skips_manual_publish_for_already_published_commit(tmp_path: Path) -> None:- module = _load_release_module()- state_file = tmp_path / "state.json"- module.write_state(- state_file,- package="mineru-next-dev",- version="4.0.0.dev2026062500",- source_branch="next",- source_commit="abc123",- trigger="workflow_dispatch",- release_date="20260625",- sequence=0,- published_at="2026-06-25T02:20:00Z",- )-- plan = module.plan_release(- module.read_state(state_file),- base_version="4.0.0",- source_commit="abc123",- trigger="workflow_dispatch",- now=datetime(2026, 6, 25, 8, 0, 0, tzinfo=UTC),- )-- assert plan.should_publish is False- assert plan.reason == "source commit was already published"---def test_plan_release_allows_forced_manual_publish_for_same_commit(tmp_path: Path) -> None:- module = _load_release_module()- state_file = tmp_path / "state.json"- module.write_state(- state_file,- package="mineru-next-dev",- version="4.0.0.dev2026062500",- source_branch="next",- source_commit="abc123",- trigger="workflow_dispatch",- release_date="20260625",- sequence=0,- published_at="2026-06-25T02:20:00Z",- )-- plan = module.plan_release(- module.read_state(state_file),- base_version="4.0.0",- source_commit="abc123",- trigger="workflow_dispatch",- force_publish=True,- now=datetime(2026, 6, 25, 8, 0, 0, tzinfo=UTC),- )-- assert plan.should_publish is True- assert plan.version == "4.0.0.dev2026062501"- assert plan.sequence == 1---def test_patch_workspace_updates_package_name_and_version(tmp_path: Path) -> None:- module = _load_release_module()- pyproject_path = tmp_path / "pyproject.toml"- version_file_path = tmp_path / "version.py"-- pyproject_path.write_text(- '[project]\nname = "mineru"\ndynamic = ["version"]\n\n[tool.example]\nvalue = 1\n',- encoding="utf-8",- )- version_file_path.write_text('__version__ = "3.2.1"\n', encoding="utf-8")-- module.patch_workspace(- pyproject_path=pyproject_path,- version_file_path=version_file_path,- package_name="mineru-next-dev",- version="4.0.0.dev20260625",- )-- assert 'name = "mineru-next-dev"' in pyproject_path.read_text(encoding="utf-8")- assert version_file_path.read_text(encoding="utf-8") == '__version__ = "4.0.0.dev20260625"\n'diff --git a/tests/unittest/test_parser_api_contract.py b/tests/unittest/test_parser_api_contract.pyindex 7f87d293..bb507d0c 100644--- a/tests/unittest/test_parser_api_contract.py+++ b/tests/unittest/test_parser_api_contract.py@@ -2416,28 +2416,6 @@ def test_api_server_preflight_rejects_missing_tier_dependency(monkeypatch: pytescreate_app(upload_dir=str(tmp_path), tier="medium")-def test_api_server_cli_reports_dependency_preflight_without_traceback(monkeypatch: pytest.MonkeyPatch) -> None:- def fake_import_module(module_name: str):- if module_name == "mlx":- raise ModuleNotFoundError("No module named 'mlx'")- return object()-- monkeypatch.setattr(importlib, "import_module", fake_import_module)- monkeypatch.setattr(parser_tier.importlib_metadata, "packages_distributions", lambda: {"mineru": ["mineru-next-dev"]})- monkeypatch.setattr(parser_tier.sys, "platform", "darwin")- monkeypatch.setattr(parser_tier.platform, "machine", lambda: "arm64")-- result = runner.invoke(main, ["--tier", "xhigh"])-- assert result.exit_code == 1- assert result.output == (- "Error: Parse server cannot start for tier 'xhigh'; missing runtime dependencies: mlx. "- "Install optional dependencies for this tier in the same Python environment as MinerU, "- "for example: pip install 'mineru-next-dev[xhigh]'.\n"- )- assert "Traceback" not in result.output--def test_api_server_create_app_rejects_backend_and_effort_parameters(tmp_path: Path) -> None:with pytest.raises(TypeError, match="backend"):create_app(upload_dir=str(tmp_path / "backend"), backend="pipeline") # type: ignore[call-arg]