[project] name = "BabelDOC" version = "0.5.16" description = "Yet Another Document Translator" license = "AGPL-3.0" readme = "README.md" requires-python = ">=3.12,<3.14" authors = [ { name = "awwaawwa", email = "aw@funstory.ai" } ] maintainers = [ { name = "awwaawwa", email = "aw@funstory.ai" } ] classifiers = [ "Programming Language :: Python :: 3", "Operating System :: OS Independent", ] keywords = ["PDF"] dependencies = [ "bitstring>=4.3.0", "configargparse>=1.7", "httpx[socks]>=0.27.0", "huggingface-hub>=0.27.0", "numpy>=2.0.2", "onnx>=1.18.0", "onnxruntime>=1.16.1", "openai>=1.59.3", "orjson>=3.10.14", "charset-normalizer >= 2.0.0", "cryptography >= 36.0.0", # "pdfminer-six==20250416", "peewee>=3.17.8", "psutil>=7.0.0", "pymupdf>=1.25.1", "rich>=13.9.4", "toml>=0.10.2", "tqdm>=4.67.1", "xsdata[cli,lxml,soap]>=24.12", "msgpack>=1.1.0", "pydantic>=2.10.6", "tenacity>=9.0.0", "scikit-image>=0.25.2", "freetype-py>=2.5.1", "tiktoken>=0.9.0", "python-levenshtein>=0.27.1", "opencv-python-headless>=4.10.0.84", "rapidocr-onnxruntime>=1.4.4", "pyzstd>=0.17.0", "hyperscan>=0.7.13", "rtree>=1.4.0", "chardet>=5.2.0", "scipy>=1.15.3", "uharfbuzz>=0.50.2", "scikit-learn>=1.7.1", ] [project.optional-dependencies] directml = ["onnxruntime-directml>=1.16.1"] cuda = ["onnxruntime-gpu>=1.16.1"] memray = ["memray>=1.17.1"] [project.urls] Homepage = "https://github.com/funstory-ai/BabelDOC" Issues = "https://github.com/funstory-ai/BabelDOC/issues" [project.scripts] babeldoc = "babeldoc.main:cli" [build-system] requires = ["hatchling"] build-backend = "hatchling.build" [tool.flake8] ignore = ["E203", "E261", "E501", "W503", "E741", "E501"] max-line-length = 88 [tool.ruff] src = ["babeldoc"] target-version = "py310" show-fixes = true [tool.ruff.format] # Enable reformatting of code snippets in docstrings. docstring-code-format = true [tool.ruff.lint] ignore = [ "E203", # 冒号前的空格 "E261", # 注释前至少两个空格 "E501", # 行太长 "E741", # 变量名歧义 "F841", # 未使用的变量 "C901", # 太复杂的函数 "S101", # use assert "SIM", # flake8-simplify "ARG002", # unused argument "S110", # `try`-`except`-`pass` detected, consider logging the exception "B024", # abstract class without abstract methods "S112", # `try`-`except`-`continue` detected, consider logging the exception "COM812", # missing-trailing-comma ] select = [ "E", # pycodestyle 错误 "F", # Pyflakes "N", # PEP8 命名 "B", # flake8-bugbear "I", # isort "C", # mccabe "UP", # pyupgrade "S", # flake8-bandit "A", # flake8-builtins "COM", # flake8-commas "ARG", # flake8-unused-arguments "PTH", # 使用 pathlib ] [tool.ruff.lint.flake8-quotes] docstring-quotes = "double" [tool.ruff.lint.flake8-annotations] suppress-none-returning = true [tool.ruff.lint.isort] force-single-line = true [tool.ruff.lint.pydocstyle] convention = "google" # 设置一些规则的特定配置 [tool.ruff.lint.mccabe] max-complexity = 10 # 函数圈复杂度阈值 [tool.ruff.lint.per-file-ignores] "babeldoc/babeldoc_exception/BabelDOCException.py" = ["N999"] "babeldoc/format/pdf/pdfinterp.py" = ["N"] # 忽略命名规范 "tests/*" = ["S101"] # 在测试文件中允许 assert "**/__init__.py" = ["F401"] # 允许未使用的导入 # 忽略 S311 警告,因为这是有意的 "babeldoc/format/pdf/document_il/midend/paragraph_finder.py" = ["S311"] "docs/*" = ["A001"] "babeldoc/pdfminer/*" =["A","F", "I", "N", "S", "B", "C", "COM", "ARG", "PTH", "UP"] [dependency-groups] dev = [ "bumpver>=2024.1130", "markdown-callouts>=0.4.0", "markdown-include>=0.8.1", "mkdocs-git-authors-plugin>=0.9.2", "mkdocs-git-committers-plugin-2>=2.5.0", "mkdocs-git-revision-date-localized-plugin>=1.3.0", "mkdocs-material[recommended]>=9.6.4", "pre-commit>=4.1.0", "pygments>=2.19.1", "ruff>=0.9.2", "pytest>=8.3.4", "pylance>=0.29.0", "py-spy>=0.4.0", ] [tool.pytest.ini_options] pythonpath = [".", "src"] testpaths = ["tests"] [bumpver] current_version = "0.5.16" version_pattern = "MAJOR.MINOR.PATCH[.PYTAGNUM]" [bumpver.file_patterns] "pyproject.toml" = [ 'current_version = "{version}"', 'version = "{version}"' ] "babeldoc/__init__.py" = [ '__version__ = "{version}"' ] "babeldoc/main.py" = [ '__version__ = "{version}"' ] "babeldoc/const.py" = [ '__version__ = "{version}"' ] [tool.uv.sources] yadt = { path = ".", editable = true } [tool.pyright] pythonVersion = "3.12" # typeCheckingMode = "off" reportGeneralTypeIssues = false reportUnknownVariableType = false reportMissingParameterType = false reportUnknownParameterType = false