chore: modernise packaging, add CI, fix unconstrained rendering - #2
Merged
Conversation
- Relax dependency pins and move pandas/pyarrow/datasets behind a 'data' extra so 'import ocrsmith' stays light; add arabic-reshaper, python-bidi, typer, rich and tqdm which the v1 subsystems build on. - Configure pytest (pythonpath=src, markers, coverage) and ruff; add a CI matrix over Linux/Windows x Python 3.10/3.12. - Fix TypeError in wrap_text_by_pixels when layout.max_width/max_height are unset, and guard whitespace-only input, with regression tests. - Make HuggingFaceTextLoader accept any iterable of mappings, add iter_texts streaming, and defer the heavy 'datasets' import to call time. - Add CONTRIBUTING.md and CHANGELOG.md. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Two failures the CI matrix surfaced on this branch: - On Python 3.10 the dataset loader tests failed with 'class does not have the attribute load_dataset'. The loader modules were named after the classes they contain, so 'loaders/__init__.py' rebound 'loaders.HuggingFaceTextLoader' from the module to the class and mock's target resolution picked whichever won the race. Renaming the modules to snake_case removes the collision rather than working around it. - ruff reported 273 findings across the pre-existing tree. Applied ruff's fixes and formatter, replaced the runtime 'Union[...]' aliases with 'X | Y', added 'from' clauses to re-raises, and combined nested 'with' statements. __init__.py files are exempted from F401: re-exporting is what they are for, and the packages that care declare __all__. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Same collision as the loaders: 'core/__init__.py' rebound 'ocrsmith.core.OCRSmithEngine' from the module to the class, so mock's string target resolution picked whichever won the import race - passing on 3.12 and failing on 3.10. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
hBouanane
added a commit
that referenced
this pull request
Aug 12, 2026
Lands the full nine-PR series (#2-#10) on main. The v0 engine produced one image with one string. v1 produces whole pages - multi-column, with titles, tables, figures, forms and running headers - degraded to look like a real capture, and emits ground truth for recognition, detection, layout analysis, document-to-markup and table structure from the same render. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1 of 9 in the v1.0.0 series. Stacked: each PR targets the previous one, so each diff shows only its own change.
What
Groundwork so the rest of the series has somewhere to land.
pyproject.toml: dependency pins relaxed to ranges; pandas/pyarrow/datasetsmoved behind adataextra soimport ocrsmithstays light; adds arabic-reshaper, python-bidi, typer, rich, tqdm.pythonpath = ["src"]—pytestnow works from a clean clone with no install. Plus ruff and coverage config.CONTRIBUTING.md(TDD workflow, branch naming, release process) andCHANGELOG.md.Fixed
wrap_text_by_pixelsraisedTypeErrorwheneverlayout.max_width/max_heightwere unset, which made every sample fail for configs that omit them. Whitespace-only input produced a zero-sized canvas. Both now have regression tests.HuggingFaceTextLoaderaccepts any iterable of mappings, gainsiter_textsstreaming, and defers the heavydatasetsimport to call time.Verified
pytestgreen (48 tests),ruff checkclean on all touched files.