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¶
- Put the PDF in
temp-different-pdf-files/. - Run
uv run kurdpdf inspect file.pdf --fonts --page-tableand look at the classes, coverage and warnings. - Fix the step that goes wrong (see architecture.md).
- 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.
rawandresolvedtext is never normalized; see architecture.md.- New dependencies must be GPL-compatible and capped below the next major version;
uv.lockis 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.
- Update
versioninpyproject.toml(uv version 0.2.0) and date theCHANGELOG.mdentry. - Run the checks above and
uv run --only-group docs zensical build --strict. - Optional check: run the Release workflow by hand (Actions > Release > Run workflow); it builds and checks the package without uploading it.
- Commit, then tag and push:
git tag -a v0.2.0 -m "KurdPDF 0.2.0"andgit push origin main v0.2.0. - Publish the release:
gh release create v0.2.0 --title "KurdPDF 0.2.0" --notes-file notes.mdwith the changelog entry as notes. The workflow checks that the tag matches the version, builds, checks that the wheel holdskurdpdf/data/andmanual.mdand no fonts, PDFs or atlas, runskurdpdf --versionfrom 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: