refactor: solidify startup UX and engine-aware preprocessing

- 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
This commit is contained in:
2026-07-19 22:14:54 +02:00
parent deab02610b
commit a0211155fa
59 changed files with 2426 additions and 629 deletions

View File

@@ -16,45 +16,22 @@ dependencies = [
"pyyaml>=6.0.1",
"structlog>=24.1.0",
"rich>=13.7.0",
"tqdm>=4.66.0",
# Image processing
"opencv-python-headless>=4.9.0",
"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'",
"scikit-image>=0.22.0,<0.23.0; python_version < '3.12'",
"scikit-image>=0.22.0; python_version >= '3.12'",
# OCR engines
"paddleocr>=2.7.0,<3.0.0",
"paddlepaddle>=2.6.0",
"pytesseract>=0.3.10",
# Table detection
"torch>=2.2.0",
"torchvision>=0.17.0",
"transformers>=4.38.0",
"timm>=1.0.0",
"layoutparser>=0.3.0",
# NLP
# Text processing and notebook migration
"langchain-text-splitters>=0.0.2",
"spacy>=3.7.0,<3.8.0; python_version < '3.12'",
"spacy>=3.7.0; python_version >= '3.12'",
"nbformat>=5.9.0",
"legacy-cgi>=2.6.2",
# Database
"sqlite-utils>=3.37.0",
# File watching
"watchdog>=3.0.0",
# Utilities
"python-slugify>=8.0.0",
"xxhash>=3.4.0",
"python-magic>=0.4.27",
"platformdirs>=4.2.0",
]
@@ -67,16 +44,43 @@ dev = [
"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[dev]",
"ocr-pipeline[paddle,tables,figures,scientific]",
]
[project.entry-points.console_scripts]
ocr-pipeline = "ocr_pipeline.cli:app"
[tool.setuptools.packages.find]
where = ["src"]
where = ["src", "."]
include = ["ocr_pipeline*", "kg_ocr*"]
[tool.setuptools.package-data]
ocr_pipeline = ["assets/*.png"]
[tool.uv]
dev-dependencies = [