Split the script into one module per pipeline stage (image_io, display, ocr, parsing, pipeline, cli), with type hints throughout, and add packaging metadata and pinned dependencies. Failures are now typed exceptions instead of None returns and prints: unreadable, corrupt or missing images raise ImageLoadError, a photo with no detectable display raises DisplayNotFoundError, and a missing Tesseract binary raises TesseractNotInstalledError. The CLI reports a bad file and carries on, and exits non-zero if any file failed. It also gains JSON and CSV output. Behaviour changes: - OCR runs in sparse-text mode (--psm 11) without a character whitelist. The previous single-word mode (--psm 8) parsed no fields from any of the sample photos, and the whitelist made Tesseract drop the spaces the parser relies on to separate fields. - A 'Cal/hr' reading is no longer also reported as total calories. - The '500m' in a '/500m' pace label is no longer reported as distance. - A pace is no longer reported as elapsed time. - The distance is no longer also reported as projected distance. - Debug contour images are actually written (the float boxes were rejected by drawContours and the error swallowed). The unused matplotlib/imshow display helpers are dropped; plotting lives in the walkthrough notebook, which replaces the scratch one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
31 lines
681 B
TOML
31 lines
681 B
TOML
[build-system]
|
|
requires = ["setuptools>=77"]
|
|
build-backend = "setuptools.build_meta"
|
|
|
|
[project]
|
|
name = "rowing-stats"
|
|
version = "0.1.0"
|
|
description = "Extract rowing stats from photos of a Concept2 PM5 monitor using OpenCV and Tesseract OCR"
|
|
readme = "README.md"
|
|
requires-python = ">=3.10"
|
|
dependencies = [
|
|
"numpy>=2.0",
|
|
"opencv-python-headless>=4.10",
|
|
"pillow>=10.0",
|
|
"pytesseract>=0.3.10",
|
|
]
|
|
|
|
[project.optional-dependencies]
|
|
dev = ["pytest>=8.0"]
|
|
notebook = ["ipykernel", "matplotlib"]
|
|
|
|
[project.scripts]
|
|
rowing-stats = "rowing_stats.cli:main"
|
|
|
|
[tool.setuptools.packages.find]
|
|
where = ["src"]
|
|
|
|
[tool.pytest.ini_options]
|
|
testpaths = ["tests"]
|
|
pythonpath = ["src"]
|