Skip to content

Add type stub generation to Harfbuzz - #314

Open
vibbix wants to merge 9 commits into
harfbuzz:mainfrom
vibbix:feature/add-type-stubbings
Open

vibbix wants to merge 9 commits into
harfbuzz:mainfrom
vibbix:feature/add-type-stubbings

Conversation

@vibbix

@vibbix vibbix commented Sep 5, 2026

Copy link
Copy Markdown

Background

While working around with fonttools and such, the lack of proper type annotations for harfbuzz started driving me a bit crazy. I tried running it manually in my repos, but I noticed it had type issues upstream, so I wrote this PR.

Changes

  • Emulated Nvidia-Cuda's stubgen-pyx usage, in setup.py
  • dropped Set[int] to just Set - checked by mypy
    • I attempted to get it to extend MutableSet[Int] but that was quite troublesome
  • fixed an errant ;
  • Set now returns SetIter properly
  • Removed an errant forward declaration of hb_color_line_t in src/uharfbuzz/charfbuzz.pxd
  • added uv.lock to ignores, alongside pyi and .typed
  • misc. small tweaks to improve mypy detection

Issues

  1. major Currently, stubgen-pyx is a hit behind, so the use of cython 3.3.0 isn't quite here yet.

LLM Disclosure

All work was done by me, but I had Gemini/AGY double check things for me.

@vibbix

vibbix commented Sep 8, 2026

Copy link
Copy Markdown
Author

If it's preferred, I can switch this to a github stack that splits the fixes to pyx types from the binding generator addition, so they can be reviewed separately.

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