Skip to content

chore: modernise packaging, add CI, fix unconstrained rendering - #2

Merged
hBouanane merged 4 commits into
mainfrom
chore/dev-tooling
Aug 12, 2026
Merged

chore: modernise packaging, add CI, fix unconstrained rendering#2
hBouanane merged 4 commits into
mainfrom
chore/dev-tooling

Conversation

@hBouanane

Copy link
Copy Markdown
Collaborator

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/datasets moved behind a data extra so import ocrsmith stays light; adds arabic-reshaper, python-bidi, typer, rich, tqdm.
  • pytest configured with pythonpath = ["src"]pytest now works from a clean clone with no install. Plus ruff and coverage config.
  • CI matrix: lint + tests on Linux/Windows × Python 3.10/3.12.
  • CONTRIBUTING.md (TDD workflow, branch naming, release process) and CHANGELOG.md.

Fixed

wrap_text_by_pixels raised TypeError whenever layout.max_width/max_height were unset, which made every sample fail for configs that omit them. Whitespace-only input produced a zero-sized canvas. Both now have regression tests.

HuggingFaceTextLoader accepts any iterable of mappings, gains iter_texts streaming, and defers the heavy datasets import to call time.

Verified

pytest green (48 tests), ruff check clean on all touched files.

hBouanane and others added 4 commits August 12, 2026 21:38
- 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
hBouanane merged commit 1de38ee into main Aug 12, 2026
5 checks passed
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant