Skip to content

Fix sdist packaging and modernize CI - #2

Merged
invisiblefunnel merged 5 commits into
mainfrom
fix-sdist-and-ci
Sep 1, 2026
Merged

invisiblefunnel merged 5 commits into
mainfrom
fix-sdist-and-ci

Conversation

@invisiblefunnel

Copy link
Copy Markdown
Contributor

Packaging

  • Include Cython sources (*.pyx, *.h) and the complete test suite in sdists, so the package can be built and tested from the tarball alone
  • Keep Cython sources, generated C/C++, and headers out of wheels and installed packages via exclude_package_data (they still ship in sdists)
  • Require Python 3.9+ and bump the version to 1.0.0rc3
  • Skip mypyc on free-threaded CPython in setup.py, matching the cp31?t-* wheel skip
  • Drop universal2 macOS wheels; pip always prefers the thin arm64/x86_64 wheels that are also built
  • Document wheel coverage changes in the README: Linux wheels are glibc 2.28+/musl 1.2+ on x86-64 and ARM64, Windows wheels are 64-bit only, PyPy wheels cover 3.11 only, and source builds need a C/C++ compiler plus the Python development headers

CI and publishing

  • Update actions to current major versions and cibuildwheel to 4.2.0
  • Build the sdist with the pinned Python 3.14 (pip install build && python -m build; pipx ran under the runner's system interpreter, bypassing the pin)
  • Smoke-test the sdist: install it with its [test] extra, assert py.typed/__init__.pyi land in the installed package, and run pytest from the unpacked tarball so missing files can't slip through again
  • Publish to PyPI via trusted publishing (OIDC) instead of an API token, downloading only the sdist and wheels-* artifacts
  • Set overwrite: true on artifact uploads so re-running a failed release run works with immutable v4+ artifacts
  • Restrict push CI to main and cancel superseded pull request runs
  • Cross-reference the three places that must change together when Python 3.15 support lands (test matrix, setup-python pin, cp315-* skip)

Verification

The new sdist job was rehearsed locally on Python 3.14.4: the sdist builds, passes twine check, installs with all extensions compiling, ships only compiled modules plus type metadata, and its bundled test suite passes (10 tests, 280 subtests).

Before the next release

Register a trusted publisher on PyPI for this project (owner flatrtree, repo flatrtree-py, workflow actions.yml, environment left blank). The API-token fallback is gone, so an unregistered publisher only fails at release time.

The sdist only shipped the cythonized .c/.cpp files, so installing from
it failed in cythonize() with "doesn't match any files" (#1). Include
the .pyx sources and floyd_rivest_select.h.
Older Pythons keep the existing rc2 wheels; current build tooling
(Cython 3, mypy, protobuf) no longer supports 3.7/3.8.
- Update all actions to current majors (artifact v3 actions were shut
  off in Jan 2025; macos-12 runners are retired)
- Test Python 3.9-3.14, build cp39-cp314 wheels via cibuildwheel v4
- Skip free-threaded builds (unsupported by mypyc) and 3.15 until the
  toolchain supports it; keep PyPy wheels (opt-in since cibuildwheel 3)
- Add aarch64 Linux wheels via the ubuntu-24.04-arm runner
- Smoke-test installing from the sdist so missing sources fail CI (#1)
Replaces the PYPI_API_TOKEN secret with OIDC; the trusted publisher is
configured on PyPI for this repo's actions.yml workflow.
Packaging:
- Ship the complete test suite in sdists; tests/utils.py and
  tests/__init__.py were missing, so pytest failed from an unpacked sdist
- Keep Cython sources, generated C/C++, and headers out of wheels and
  installed packages via exclude_package_data; they still ship in sdists
- Skip mypyc on free-threaded CPython in setup.py, matching the cp31?t-*
  wheel skip
- Drop redundant universal2 macOS wheels; pip always prefers the thin
  arm64/x86_64 wheels that are also built
- Document 64-bit-only Windows wheels, PyPy 3.11-only wheels, and the
  Python dev-headers requirement for source builds in the README

CI:
- Build the sdist with the pinned Python; pipx ran build under the
  runner's system interpreter, bypassing the 3.14 pin
- Install the sdist with its [test] extra instead of a hardcoded package
  list, assert type metadata lands in the installed package, and run
  pytest from the unpacked sdist instead of the checkout
- Set overwrite: true on artifact uploads so job re-runs work with
  immutable v4+ artifacts
- Download only the sdist and wheels-* artifacts in publish_pypi
- Restrict push CI to main and cancel superseded pull request runs
- Cross-reference the three places that must change together when
  Python 3.15 support lands
@invisiblefunnel
invisiblefunnel merged commit 5fd73e9 into main Sep 1, 2026
9 checks passed
@invisiblefunnel
invisiblefunnel deleted the fix-sdist-and-ci branch September 1, 2026 01:11
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