Skip to content
Edit this page

Development

uv sync                      # Python 3.14, locked dependencies
uv run pytest                # tests
uv run ruff check .          # lint
uv run ruff format --check . # formatting

All three must pass before a change is merged.

Tests

Test PDFs are generated at test time with PyMuPDF (tests/conftest.py); no PDF or font is committed. Some tests need local material and skip without it:

Tests Need Where it is looked for
Sorani text in a real font a Unicode Sorani font KURDPDF_TEST_FONT or temp/fonts/
Tesseract OCR tesseract and a ckb*.traineddata model KURDPDF_TEST_TESSDATA or temp/ocr/tessdata_best/
real PDFs (-m realpdf) sample PDFs temp-different-pdf-files/

Tests never use your own atlas, word list or Tesseract models: autouse fixtures point KURDPDF_ATLAS and KURDPDF_TESSDATA at empty temporary paths.

Every bug fix and every new font case gets a test. Accuracy tests compare CER and WER (kurdpdf.metrics) with a recorded threshold.

Local workspace

temp/ and temp-different-pdf-files/ are gitignored. They hold reference fonts, OCR models, spike scripts (temp/spikes/) and real PDFs for trying the code on different fonts and producers. Never commit them, and never commit *.pdf or font files.

Adding support for a new kind of PDF

  1. Put the PDF in temp-different-pdf-files/.
  2. Run uv run kurdpdf inspect file.pdf --fonts --page-table and look at the classes, coverage and warnings.
  3. Fix the step that goes wrong (see architecture.md).
  4. Write the expected classes and a text check into tests/test_realpdf.py, and a synthetic test that does not need the PDF.

New legacy fonts are covered in fonts-and-atlas.md.

Rules

  • HarfBuzz (uharfbuzz) is the only font engine. Do not add other font parsers.
  • Kurdish normalization, orthography and word lists go through zimankit.
  • raw and resolved text is never normalized; see architecture.md.
  • New dependencies must be GPL-compatible and capped below the next major version; uv.lock is committed.

Releasing

Releases go to PyPI from GitHub Actions with trusted publishing (.github/workflows/release.yml); no token is stored anywhere. The PyPI project trusts that workflow in the pypi environment.

  1. Update version in pyproject.toml (uv version 0.2.0) and date the CHANGELOG.md entry.
  2. Run the checks above and uv run --only-group docs zensical build --strict.
  3. Optional check: run the Release workflow by hand (Actions > Release > Run workflow); it builds and checks the package without uploading it.
  4. Commit, then tag and push: git tag -a v0.2.0 -m "KurdPDF 0.2.0" and git push origin main v0.2.0.
  5. Publish the release: gh release create v0.2.0 --title "KurdPDF 0.2.0" --notes-file notes.md with the changelog entry as notes. The workflow checks that the tag matches the version, builds, checks that the wheel holds kurdpdf/data/ and manual.md and no fonts, PDFs or atlas, runs kurdpdf --version from it, uploads to PyPI and attaches the wheel and sdist to the release.

A version on PyPI can never be uploaded again; fix a broken release with a new version.

Documentation site

The site at https://kanilabs.github.io/kurdpdf/ is built with Zensical from docs/ and mkdocs.yml and deployed by .github/workflows/pages.yml on every push to main that touches the docs. CHANGELOG.md and CONTRIBUTING.md are included as pages; brand.md and launch.md stay in the repository only. Preview locally:

uv run --only-group docs zensical serve     # http://127.0.0.1:8000, rebuilds on save