Skip to content

build!(pypi): scikit-buil build system for sdist dirstibution on pypi with ci testing and releases - #22

Open
HarlanHeilman wants to merge 12 commits into
usnistgov:mainfrom
HarlanHeilman:main
Open

build!(pypi): scikit-buil build system for sdist dirstibution on pypi with ci testing and releases#22
HarlanHeilman wants to merge 12 commits into
usnistgov:mainfrom
HarlanHeilman:main

Conversation

@HarlanHeilman

@HarlanHeilman HarlanHeilman commented Apr 14, 2026

Copy link
Copy Markdown

Summary

  • Types: build, ci
  • Goal: Modernize packaging around scikit-build-core + uv, remove the pybind11 git submodule (use PyPI pybind11), and adjust CMake/HDF5 so Ubuntu builds do not depend on a large prebuilt HDF5 binary.
  • Release: PyPI publishing via OIDC / trusted publishing; workflow was smoke-tested using a temporary PyPI project before wiring the canonical package.

What changed

Build & distribution

  • pybind11: Git submodule removed; CMake builds with submodule usage disabled and pybind11 supplied via the build backend / PyPI.
  • uv: Contributor and CI flows standardized on uv for environment sync, wheel/sdist builds, and tests.
  • Jupyter stack: Dependencies for /notebook/CyRSoXS.ipynb are included in a dependency group locally sync using uv sync --group jupyter or install directly from pypi with uv pip install cyrsoxs[jupyter] or using equivalent pip tooling.
  • HDF5 / CMake: Ubuntu-oriented path supports fetching/building HDF5 (e.g. CYRSOXS_FETCH_HDF5 and related CMake options) to avoid assuming a heavyweight prebuilt HDF5 artifact.

So now development of new features just requires cloning the repo, and then running

uv sync --all-groups

This builds a virtual environment with cyrsoxs constructed using the pybind and scikit build systems to run the updated Cmake's. This will also automatically install or fetch HDF5.

CI & release

  • CI (PR + default branch): Ubuntu image, CUDA toolkit install, uv setup, uv sync --all-extras, uv build, pytest, then a wheel install + import smoke in a clean venv.
  • Release (tags): On v* tags, build an sdist with uv build --sdist and publish with pypa/gh-action-pypi-publish (trusted publishing / OIDC).

New releases on pypi can be made automatically by making a new tag starting with v*, e.g. v1.2.1 and building a release of the project. Note that the reset of the versioning within the project may not be up to data. For example, the version in the pyproject.toml will need to be updated, and the CyRSoXS print statement may not use the right version number or hash. This print could be updated to center around tags instead of the individual commit hash.

Validation

  • PyPI dry run: Published to cyrsoxs-temp using test tag v1.2.1; confirmed installable via pip from PyPI.Note: I did not change the package versions to v1.2.1 so PyPi still reflects the current version.
  • Local toolchain note (reporter environment): uv sync succeeded locally; PyPI install verified with:
$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Fri_Jan__6_16:45:21_PST_2023
Cuda compilation tools, release 12.0, V12.0.140
Build cuda_12.0.r12.0/compiler.32267302_0

$ g++ --version
g++ (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Post-merge cleanup

Remove the v1.2.1 test tag (and any fork-only PyPI project naming such as cyrsoxs-temp) once maintainers confirm publishing against the canonical PyPI project.
Maintainer checklist

  • Configure trusted publisher for the canonical repository in PyPI: Account → Publishing.

  • Align repository / organization variables and secrets with upstream expectations (anything beyond OIDC, if added later).

  • Review/update the conda feedstock for assumptions about external/pybind11 / submodule checkout; ensure recipes match the new CMake flags and PyPI-provided pybind11. Initial review suggests it may be fine as-is, but this should be confirmed by feedstock maintainers.

Remove the pybind11 submodule in favor of build-time pybind11, fix CMake
install and CUDA arch handling, and document conda-forge versus PyPI.
Add CyRSoXSHDF5 ExternalProject static build when CYRSOXS_FETCH_HDF5 is on,
wire Threads and build deps, drop libhdf5-dev from CI, and refresh docs,
pyproject groups, and uv.lock.
Add authors list, refresh description, and set license text to NIST.
Include ipykernel in dependency-groups.jupyter and refresh uv.lock.
Use --whole-archive (Linux) and -force_load (macOS) for bundled static
HDF5 so symbols like H5Rcreate_object are not dropped. Set BUILD_RPATH
and INSTALL_RPATH when using system shared HDF5 to avoid wrong libhdf5
at import time. Document behavior in INSTALL.md.
Include instructions for installing cyrsoxs via pip, both from wheels and source. Document the installation of dependencies for the tutorial notebook using the jupyter extra.
@HarlanHeilman

Copy link
Copy Markdown
Author

Went ahead and merged in #18 such that the release CI builds wheels for python versions 3.9-3.12 while also releasing the sdist.

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