[project]
name = "mineru-webkit"
version = "0.1.6"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
    "cairosvg>=2.8.2",
    "commentjson>=0.9.0",
    "loguru>=0.7.3",
    "lxml>=6.0.2",
    "lxml-html-clean>=0.4.3",
    "overrides>=7.7.0",
    "py-asciimath>=0.3.0",
    "pylatexenc>=2.10",
    "regex>=2025.11.3",
    "selectolax>=0.4.6",
    "lark>=1.2.2",
    "lark-parser>=0.7.8"
]

[dependency-groups]
dev = [
    "pytest>=9.0.2",
    "pre-commit>=4.5.1",
    "ruff>=0.14.11",
]

[project.optional-dependencies]
we = [
    "numpy>=2.2.6",
    "scikit-learn>=1.7.2",
]

all = [
    "mineru-webkit[we]"
]

[tool.uv.workspace]
members = [
    "packages/webpage_converter",
    "packages/webpage_extractor",
]

[tool.uv.sources]
webpage_converter = { workspace = true }
webpage_extractor = { workspace = true }

[[tool.uv.index]]
name = "tuna"
url = "https://pypi.tuna.tsinghua.edu.cn/simple/"

[tool.hatch.metadata]
allow-direct-references = true

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = [
 "packages/webpage_converter/src/webpage_converter",
 "packages/webpage_extractor/src/webpage_extractor"
]

# ########### ruff配置 ################
[tool.ruff]
# 最大行长度
line-length = 320

[tool.ruff.lint]
# 选择要启用的规则集
select = [
    "E", # pycodestyle 错误
    "W", # pycodestyle 警告
    "F", # Pyflakes
    "I", # isort (导入排序)
#    "UP", # pyupgrade (保持代码现代化)
#     "PL", # Pylint 规则（按需开启）
]

# 忽略的规则，继承原 flake8 配置的部分忽略项
ignore = [
    "E701", # 同一行多个语句（E702 也包含在内）
    "E402", # 模块级导入不在文件顶部（通常需要在特定文件忽略）
    "F841",
    "F821",
    "E501",
    "W293"
]

[tool.ruff.format]
# 格式化相关的配置，Ruff 的格式化器兼容 Black 的风格
quote-style = "double"
indent-style = "space"

# ########### 版本 ################
[tool.bumpversion]
current_version = "0.1.6"
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
serialize = ["{major}.{minor}.{patch}"]
search = "{current_version}"
replace = "{new_version}"
regex = false
ignore_missing_version = false
ignore_missing_files = false
tag = false
sign_tags = false
tag_name = "v{new_version}"
tag_message = "Bump version: {current_version} → {new_version}"
allow_dirty = false
commit = false
message = "Bump version: {current_version} → {new_version}"
moveable_tags = []
commit_args = ""
setup_hooks = []
pre_commit_hooks = []
post_commit_hooks = []
