[build-system]
requires = ["setuptools>=77.0.3", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "mineru"
dynamic = ["version"]
license = "LicenseRef-MinerU-Open-Source-License"
license-files = ["LICENSE.md"]
description = "A practical document parsing tool for converting PDF, OFD, EPUB, HTML, images, CSV, RTF, OOXML, and OpenDocument files into Markdown and JSON"
readme = "README.md"
requires-python = ">=3.10,<3.15"
keywords = [
    "mineru",
    "magic-pdf",
    "document-parsing",
    "document-understanding",
    "pdf",
    "markdown",
    "ocr",
    "vlm",
    "docx",
    "pptx",
    "xlsx",
    "epub",
    "ofd",
    "csv",
    "rtf",
    "odt",
    "ods",
    "odp",
    "multimodal",
]
classifiers = [
    "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Programming Language :: Python :: 3.13",
    "Programming Language :: Python :: 3.14",
]
dependencies = [
    "docvortex>=0.5.12,<1",
    "gradio>=6.8,<7",
    "mineru[torch] ; sys_platform == 'darwin' and platform_machine == 'arm64'",
    "mineru-vl-utils>=2.0.5,<3",
    "mineru-llama-cpp>=0.1.2,<1",
    "click>=8.1.7",
    "loguru>=0.7.2",
    "numpy>=1.21.6",
    "tqdm>=4.67.1",
    "requests",
    "httpx",
    "pillow>=11.0.0",
    "pypdfium2>=5.10.1,<6",
    "PyYAML>=6.0.1,<7",
    "packaging",
    "modelscope>=1.26.0",
    "huggingface-hub[hf_xet]>=0.32.4",
    "filelock>=3.0.0",
    "json-repair>=0.46.2",
    "openai>=1.70.0,<3",
    "beautifulsoup4>=4.13.5,<5",
    "tinycss2>=1.5.1,<2",
    "aiosqlite>=0.20.0,<1",
    "watchfiles>=1.0.0,<2",
    "fastapi",
    "python-multipart",
    "uvicorn",
    "pydantic>=2.12.5,<3",
    "typing_extensions>=4.0.0",
    "typer>=0.9.0",
    "rich>=13.0.0",
    "jieba>=0.42.1",
    "onnxruntime>=1.20.1",
    "ftfy>=6.3.1,<7",
    "shapely>=2.0.7,<3",
    "pyclipper>=1.3.0,<2",
    "tokenizers>=0.22.0,<0.24",
]

[project.optional-dependencies]
dev = [
    "lxml-stubs",
]
test = [
    "pypdf>=5.6.0",
    "reportlab",
    "lxml>=4.0.0,<7.0.0",
    "pytest",
    "pytest-cov",
    "coverage",
    "fuzzywuzzy",
    "tomli; python_version < '3.11'",
]
torch = [
    "torch>=2.7.0,<3",
    "torchvision",
    "transformers>=5.10.1,<6",
    "accelerate>=1.5.1",
    "safetensors>=0.4.0,<1",
]
full = [
    "mineru[torch]",
    "vllm>=0.19.1,<0.29.0 ; sys_platform == 'linux'",
    "lmdeploy>=0.17.0,<0.18 ; sys_platform == 'win32'",
    "qwen-vl-utils>=0.0.14,<1 ; sys_platform == 'win32'",
]
all = [
    "mineru[full]",
]

[project.urls]
homepage = "https://mineru.net/"
documentation = "https://opendatalab.github.io/MinerU/"
repository = "https://github.com/opendatalab/MinerU"
issues = "https://github.com/opendatalab/MinerU/issues"
License = "https://github.com/opendatalab/MinerU/blob/master/LICENSE.md"

[project.scripts]
mineru = "mineru.cli.main:main"
mineru-kit = "mineru.kit.main:main"
mineru-router = "mineru.kit.router.cli:main"
mineru-webui = "mineru.kit.commands.webui:main"
mineru-openai-server = "mineru.kit.commands.vlm_server:main"
mineru-models-download = "mineru.kit.commands.models:download_main"
mineru-api = "mineru.kit.commands.api_server:main"

[tool.setuptools.dynamic]
version = { attr = "mineru.version.__version__" }

[tool.setuptools.packages.find]
include = ["mineru*"]
namespaces = false

[tool.setuptools.package-data]
"mineru" = ["resources/**"]
"mineru.kit.gradio._vendor.ofd2html" = ["LICENSE", "UPSTREAM.md"]
"mineru.doclib.migrations" = ["*.sql"]
"mineru.model._internal.pytorchocr.utils" = ["resources/**"]
"mineru.model.ocr" = ["data/*.txt"]

[tool.setuptools]
include-package-data = true
zip-safe = false

[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "-s --cov=mineru --cov-report html"
markers = [
  "e2e: MinerU CLI 端到端用例(脚本化 docs/next/cli/mineru-e2e-test-cases.md)",
  "smoke: 快速回归子集(无需本地 quality tier)",
  "slow: 单用例预计超过 60s",
  "remote: 依赖 mineru.net 云端 parse-server(默认套件包含)",
  "full_stack: 需要 Torch 小模型与本地 VLM 模型集",
  "isolated_home: 使用独立 MINERU_HOME",
  "lifecycle: 会 stop/start/restart doclib server",
]

[tool.coverage.run]
command_line = "-m pytest tests/unittest"
source = ["mineru/"]
omit = [
    "*/gradio_app.py",
    "*/fast_api.py",
    "*/cli/client.py",
    "*/vlm_vllm_server.py",
    "*/cli_parser.py",
]

[tool.coverage.html]
directory = "htmlcov"

[tool.coverage.report]
exclude_also = [
    'def __repr__',
    'if self.debug:',
    'if settings.DEBUG',
    'raise AssertionError',
    'raise NotImplementedError',
    'if 0:',
    'if __name__ == .__main__.:',
    'if TYPE_CHECKING:',
    'class .*\bProtocol\):',
    '@(abc\.)?abstractmethod',
]

[tool.ruff]
line-length = 128

[tool.ruff.lint]
select = ["C", "E", "F", "W", "ANN"]
ignore = ["C901", "ANN204", "ANN401"]