Skip to content

Modernize wheel CI and add cp314 wheel support#706

Merged
lmcinnes merged 1 commit into
scikit-learn-contrib:masterfrom
Mokto:add-cp314-wheels
May 13, 2026
Merged

Modernize wheel CI and add cp314 wheel support#706
lmcinnes merged 1 commit into
scikit-learn-contrib:masterfrom
Mokto:add-cp314-wheels

Conversation

@Mokto
Copy link
Copy Markdown
Contributor

@Mokto Mokto commented May 7, 2026

Summary

PyPI currently has wheels for hdbscan 0.8.42 covering cp310–cp313 on
Linux/macOS/Windows, but the pythonpublish_wheel.yml workflow that's
checked in doesn't actually produce them — it still pins cython<3 inside
a manylinux2014 container and only matrices cp38–cp311. The current
wheels must have been built out-of-band (cibuildwheel locally, or via a
workflow tweaked at release time and never committed). cp314 wheels haven't
been published yet, and the workflow as-checked-in can't produce them
either: Python 3.14 needs glibc ≥ 2.28 and refuses to compile against
Cython 2.

This PR brings the committed workflow into a state where simply dispatching
it for the next release produces a complete, current wheel set — including
cp314.

Build system (pyproject.toml)

  • [build-system] now requires cython>=3.0.11,<4 and numpy>=2.0,<3 so
    any source build (CI, conda-forge, end-user pip install) targets
    current Cython/NumPy.
  • requires-python = ">=3.10" matches the supported matrix — Python 3.8
    reached EOL on 2024-10-07 and 3.9 on 2025-10-31.
  • Adds the Programming Language :: Python :: 3.14 classifier.

Cython 3 source updates

  • Reorders nogil except -1except -1 nogil across .pyx/.pxd
    (Cython 3 syntax requirement).
  • Adds # distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION
    to silence NumPy deprecated-API warnings.

This rebases the still-relevant source-file hunks of #691 onto current
master.

Wheel CI (.github/workflows/pythonpublish_wheel.yml)

  • Linux: manylinux2014_x86_64manylinux_2_28_x86_64 (Python 3.14
    needs glibc ≥ 2.28). Pins cython>=3.0.11,<4 and numpy>=2.0 in the
    build env, installs setuptools+wheel (the cp314 image doesn't ship
    them by default), and extends the matrix to cp310–cp314.
  • Windows/macOS: replaces deprecated oldest-supported-numpy with
    numpy>=2.0, bumps actions/checkout v1→v4 and actions/setup-python
    v1→v5 (v1 doesn't support recent Pythons), retires the EOL
    windows-2019 / macos-11 runners (now windows-2022 + macos-14
    macOS 14 already produces universal2 wheels covering arm64 and x86_64),
    extends the matrix to 3.10–3.14, and enables allow-prereleases: true
    for 3.14.
  • Disables fail-fast on both matrices so one failure doesn't cancel the
    rest.

Verification

  • All 15 build jobs (Linux cp310–cp314, Windows + macOS for 3.10–3.14) go
    green on a workflow_dispatch run on the author's fork.
  • Locally on Python 3.14.4 with Cython 3.2.4 + NumPy 2.4.4: every extension
    cythonizes and compiles cleanly, and HDBSCAN().fit(X) runs end-to-end.

Consistent with how conda-forge already ships working py314 builds.
Relates to #688, #686 (the underlying Linux wheels for 3.12/3.13 are
already on PyPI, but a future release using this workflow won't need
out-of-band builds). Supersedes #691 for the parts still relevant.

@Mokto Mokto marked this pull request as draft May 7, 2026 19:12
The published wheels haven't kept up: the Linux job pinned `cython<3`
inside a `manylinux2014` container and built only cp38-cp311, leaving
no upstream wheels for 3.12+ and producing artifacts incompatible with
NumPy 2.x. This PR brings the build chain forward.

Build system
- `[build-system]` now requires `cython>=3.0.11,<4` and `numpy>=2.0,<3`
  so any source build (CI, conda-forge, end-user `pip install`) targets
  current Cython/NumPy.
- `requires-python = ">=3.10"` matches the supported matrix; 3.8 reached
  EOL on 2024-10-07 and 3.9 on 2025-10-31.
- Adds the `Programming Language :: Python :: 3.14` classifier.

Cython 3 source updates
- Reorders `nogil except -1` -> `except -1 nogil` across `.pyx`/`.pxd`
  (Cython 3 syntax requirement).
- Adds `# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION`
  to silence NumPy deprecated-API warnings at compile time.

These rebases the still-relevant source-file hunks of scikit-learn-contrib#691 onto current
master; scikit-learn-contrib#691's pyproject/setup.py hunks have been superseded by master.

Wheel CI (`.github/workflows/pythonpublish_wheel.yml`)
- Linux: bumps the manylinux image from `manylinux2014_x86_64` to
  `manylinux_2_28_x86_64` (Python 3.14 needs glibc >= 2.28), pins
  `cython>=3.0.11,<4` and `numpy>=2.0` in the build env, installs
  `setuptools` + `wheel` (the cp314 image doesn't ship them by default),
  and extends the matrix to cp310-cp314.
- Windows/macOS: replaces the deprecated `oldest-supported-numpy` with
  `numpy>=2.0`, bumps `actions/checkout`@v1->v4 and
  `actions/setup-python`@v1->v5 (v1 doesn't support recent Pythons),
  retires the EOL `windows-2019`/`macos-11` runners (now
  `windows-2022` + `macos-14` -- macOS 14 already produces universal2
  wheels covering both arm64 and x86_64), extends the matrix to
  3.10-3.14, and enables `allow-prereleases: true` in case 3.14 isn't
  GA on a runner yet.
- Disables `fail-fast` on both matrices so one failure doesn't cancel
  the rest.

Verification
- All 15 build jobs (Linux cp310-cp314, Windows + macOS for 3.10-3.14)
  go green on a workflow_dispatch run on the fork.
- Locally on Python 3.14.4 with Cython 3.2.4 + NumPy 2.4.4: every
  extension cythonizes and compiles cleanly, and `HDBSCAN().fit(X)`
  runs end-to-end.

This is consistent with how conda-forge already ships working py314
builds of this package. Closes scikit-learn-contrib#688 (missing wheels for 3.13), scikit-learn-contrib#686
(Linux wheel for 3.12). Supersedes scikit-learn-contrib#691 for the parts still needed.
@Mokto Mokto force-pushed the add-cp314-wheels branch from cdf150f to a8f12d7 Compare May 8, 2026 02:44
@Mokto Mokto marked this pull request as ready for review May 8, 2026 02:45
@Mokto Mokto changed the title Add cp312/cp313/cp314 wheel support via Cython 3.x upgrade Modernize wheel build for Python 3.10–3.14 May 8, 2026
@Mokto Mokto changed the title Modernize wheel build for Python 3.10–3.14 Modernize wheel CI and add cp314 wheel support May 8, 2026
@Mokto
Copy link
Copy Markdown
Contributor Author

Mokto commented May 8, 2026

The PR is ready for review.

@lmcinnes
Copy link
Copy Markdown
Collaborator

lmcinnes commented May 8, 2026

If you can make Cython 3 work that would be great. I'll have to run some local testing to make sure this all works, so please give me some time to manage to get to that, but this looks very promising.

@Mokto
Copy link
Copy Markdown
Contributor Author

Mokto commented May 9, 2026

👍 for those who need a temporary fork in the meantime, I've created https://pypi.org/project/hdbscan-314/0.8.42/

I'll delete it this is merged & released.

Works for us in production

@lmcinnes lmcinnes merged commit 9f308d1 into scikit-learn-contrib:master May 13, 2026
1 check passed
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.

2 participants