Skip to content

Conversation

@anthrotype
Copy link
Member

@anthrotype anthrotype commented Oct 17, 2025

  • Enabled Python Limited API for stable ABI (abi3) support. We now build a single cp310-abi3 wheel for each platform which works across Python 3.10 and above. This significantly reduces number of wheels we distribute on PyPI.
  • For macOS CPython builds, we now publish a single 'fat' universal2 wheel (Intel + Apple Silicon), that's sufficient, we don't need separate wheels for arm64 and x86_64.
  • For PyPy, we still need to build separate x86_64 and arm64 wheels, and also disable the Limited API because that's CPython-only. But we only distribute one wheel for pypy3.11 so that's fine.
  • Dropped Python 3.8 and 3.9 support (minimum now Python 3.10+)

Fixes #262

Replace PyUnicode internal APIs with stable API alternatives so we can
enable Py_LIMITED_API by default and produce cp38-abi3 wheels that work
across Python 3.8+ versions, reducing the number of wheels (see #260).

To disable it, one should set USE_LIMITED_API=0 environment variable.

Also fixed a memory leak (malloc without free) in Face.get_name()
adding proper cleanup.

Fixes #262
Copy link
Collaborator

@khaledhosny khaledhosny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did some timing shaping a bunch pf text files a 100 times, and I don’t see any significant difference between this PR and main branch.

@anthrotype
Copy link
Member Author

I don't understand why the windows build fails, and can't test it locally. Maybe @madig could take a look on his machine?

https://github.com/harfbuzz/uharfbuzz/actions/runs/18591580474/job/53007536037

@anthrotype
Copy link
Member Author

Ugh.. even after disabling limited api on pypy3.11, it segfaults when running the tests...

https://github.com/harfbuzz/uharfbuzz/actions/runs/18591580474/job/53007536046#step:5:2171

I have no idea. We were indeed shipping pypy3.11 wheels on previous releases (e.g. those tagged pp311 in https://pypi.org/project/uharfbuzz/0.51.7/), but I am not sure how many people actually use those.

@anthrotype
Copy link
Member Author

it's nice to see cibuildwheel skips rebuilding the abi3 wheel for subsequent pythons when it sees it is compatible

@khaledhosny
Copy link
Collaborator

but I am not sure how many people actually use those.

I don’t mind dropping pypy until someones comes asking for it (and then it will be on them to fix it).

PyUnicode_DecodeUTF32() in PyPy has a bug that causes segfaults.

https://github.com/harfbuzz/uharfbuzz/actions/runs/18591580474/job/53007536046#step:5:2171

Switch to using hb_ot_name_get_utf8() with UTF-8 decoding instead,
which is simpler and works correctly on both CPython and PyPy
maybe it fixes the windows build issue?
this fixes the following cibuildwheel error:

https://github.com/harfbuzz/uharfbuzz/actions/runs/18593853794/job/53014973393#step:5:1092

```
Build failed because the repair step completed successfully but
did not produce a wheel.

Your `repair-wheel-command` is expected to place the repaired
wheel in the {dest_dir} directory. See the documentation for
example configurations:

https://cibuildwheel.pypa.io/en/stable/options/#repair-wheel-command
```

Windows has no default repair-wheel-command, so when we set one
(even via inherit+append), we must explicitly copy the wheel to
dest_dir...
commit 3beb8c6  inadvertently disabled pypy macos builds altogether...
I can't seem to get it working, but it's ok to only run on linux/macosx
…only

somehow the previous attempt to override archs didn't work.
@anthrotype anthrotype merged commit 5e6692e into main Oct 17, 2025
6 checks passed
@anthrotype anthrotype deleted the py-limited-api branch October 17, 2025 14:18
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.

Investigate use of Py_LIMITED_API for cython modules to use one wheel per platform

3 participants