- Slim core deps: move ML stack to optional extras (paddle/tables/figures/scientific/full) - Lazy settings proxy with config search paths (env var, cwd, user dir) - New commands: init, demo, setup [basic|full], first-run guard on run/watch - Engine-aware preprocessing: Paddle gets original image (fixes dark mode 0.83->0.95) - Results table shows Skipped count; lazy run-dir creation - kg_ocr marked experimental with extra, Docker defaults with OCR_PIPELINE_CONFIG - 25/25 tests, ruff clean
151 lines
3.3 KiB
TOML
151 lines
3.3 KiB
TOML
[build-system]
|
|
requires = ["setuptools>=68"]
|
|
build-backend = "setuptools.build_meta"
|
|
|
|
[project]
|
|
name = "ocr-pipeline"
|
|
version = "0.1.0"
|
|
description = "OCR pipeline for life science screenshots - RAG ready"
|
|
readme = "README.md"
|
|
requires-python = ">=3.11"
|
|
dependencies = [
|
|
# Core
|
|
"typer[all]>=0.9.0",
|
|
"pydantic>=2.6.0",
|
|
"pydantic-settings>=2.2.0",
|
|
"pyyaml>=6.0.1",
|
|
"structlog>=24.1.0",
|
|
"rich>=13.7.0",
|
|
|
|
# Image processing
|
|
"opencv-python-headless>=4.9.0,<5.0.0",
|
|
"pillow>=10.2.0",
|
|
"numpy>=1.26.0,<2.0; python_version < '3.12'",
|
|
"numpy>=1.26.0; python_version >= '3.12'",
|
|
"pytesseract>=0.3.10",
|
|
|
|
# Text processing and notebook migration
|
|
"langchain-text-splitters>=0.0.2",
|
|
"nbformat>=5.9.0",
|
|
|
|
# File watching
|
|
"watchdog>=3.0.0",
|
|
|
|
# Utilities
|
|
"platformdirs>=4.2.0",
|
|
]
|
|
|
|
[project.optional-dependencies]
|
|
dev = [
|
|
"pytest>=8.0.0",
|
|
"pytest-cov>=4.1.0",
|
|
"pytest-mock>=3.12.0",
|
|
"ruff>=0.2.0",
|
|
"mypy>=1.8.0",
|
|
"pre-commit>=3.6.0",
|
|
]
|
|
paddle = [
|
|
"paddleocr>=2.7.0,<3.0.0",
|
|
"paddlepaddle>=2.6.0",
|
|
]
|
|
tables = [
|
|
"torch>=2.2.0",
|
|
"torchvision>=0.17.0",
|
|
"transformers>=4.38.0",
|
|
"timm>=1.0.0",
|
|
]
|
|
figures = [
|
|
"layoutparser>=0.3.0",
|
|
"legacy-cgi>=2.6.2; python_version >= '3.13'",
|
|
]
|
|
scientific = [
|
|
"spacy>=3.7.0,<3.8.0; python_version < '3.12'",
|
|
"spacy>=3.7.0; python_version >= '3.12'",
|
|
]
|
|
kg = [
|
|
"txtai>=7.4.0",
|
|
"litellm>=1.40.0",
|
|
"python-dotenv>=1.0.0",
|
|
]
|
|
grobid = []
|
|
full = [
|
|
"ocr-pipeline[paddle,tables,figures,scientific]",
|
|
]
|
|
|
|
[project.entry-points.console_scripts]
|
|
ocr-pipeline = "ocr_pipeline.cli:app"
|
|
|
|
[tool.setuptools.packages.find]
|
|
where = ["src", "."]
|
|
include = ["ocr_pipeline*", "kg_ocr*"]
|
|
|
|
[tool.setuptools.package-data]
|
|
ocr_pipeline = ["assets/*.png"]
|
|
|
|
[tool.uv]
|
|
dev-dependencies = [
|
|
"pytest>=8.0.0",
|
|
"pytest-cov>=4.1.0",
|
|
"pytest-mock>=3.12.0",
|
|
"ruff>=0.2.0",
|
|
"mypy>=1.8.0",
|
|
"pre-commit>=3.6.0",
|
|
]
|
|
override-dependencies = ["lxml>=5.3.0"]
|
|
|
|
[tool.ruff]
|
|
line-length = 100
|
|
target-version = "py311"
|
|
select = [
|
|
"E", # pycodestyle
|
|
"F", # pyflakes
|
|
"I", # isort
|
|
"N", # pep8-naming
|
|
"W", # pycodestyle warnings
|
|
"UP", # pyupgrade
|
|
"B", # flake8-bugbear
|
|
"C4", # flake8-comprehensions
|
|
"T20", # flake8-print
|
|
]
|
|
ignore = [
|
|
"E501", # line too long (handled by formatter)
|
|
"B008", # function calls in default argument
|
|
]
|
|
fixable = ["I", "E", "W", "F"]
|
|
unfixable = ["N", "B", "C4", "T20", "UP"]
|
|
|
|
[tool.ruff.format]
|
|
quote-style = "double"
|
|
indent-style = "space"
|
|
skip-magic-trailing-comma = false
|
|
line-ending = "lf"
|
|
|
|
[tool.mypy]
|
|
python_version = "3.11"
|
|
warn_return_any = true
|
|
warn_unused_configs = true
|
|
disallow_untyped_defs = true
|
|
disallow_incomplete_defs = true
|
|
check_untyped_defs = true
|
|
no_implicit_optional = true
|
|
strict_equality = true
|
|
show_error_codes = true
|
|
pretty = true
|
|
|
|
[tool.pytest.ini_options]
|
|
testpaths = ["tests"]
|
|
python_files = ["test_*.py"]
|
|
python_classes = ["Test*"]
|
|
python_functions = ["test_*"]
|
|
addopts = "-v --tb=short"
|
|
filterwarnings = [
|
|
"ignore::DeprecationWarning",
|
|
"ignore::UserWarning:torch",
|
|
"ignore::UserWarning:transformers",
|
|
]
|
|
|
|
[tool.pre-commit-hooks]
|
|
ruff = { id = "ruff", args = ["check", "--fix"] }
|
|
ruff-format = { id = "ruff", args = ["format"] }
|
|
mypy = { id = "mypy" }
|
|
pytest = { id = "pytest", args = ["-x"] } |