Repository navigation
ci: build and publish PyPI wheels with cibuildwheel - #338
hrushikesh-s wants to merge 1 commit into
Conversation
|
Thank you very much for this careful work, and for the testing on all three platforms. Following the contribution rule we recently added to the README, I am taking the change over Answers to your questions:
I also made a few adjustments on top of your commit:
These are in our development branch for now. You will be able to see them in the pull request |
|
The wheels are now published: ALAMODE 2.0.2 is on PyPI as alamode-python ( Your commit went in through #343, with your authorship kept, together with the follow-up changes (distribution name, license files, Python >= 3.11, trusted publishing). The release notes are at https://github.com/alamode-code/alamode/releases/tag/v2.0.2. Closing this pull request since its content is merged. Thank you for the contribution. |
|
Thanks @ttadano! |
@ttadano, following up on #335, this PR adds wheels for PyPI, so
pip install "alamode[openmpi]"works without a compiler or conda..What changed (no changes to the C++ code)
--
.github/workflows/wheels.yml(new): builds the wheels with cibuildwheel on Linux x86_64, Linux aarch64, and macOS arm64, and uploads them to PyPI when a release is published. It runs on every push and PR like the other workflows, and is skipped on alamode-developer--
python/pyproject.toml: the cibuildwheel settings and anopenmpiextra --> anphon uses Open MPI, the same as the conda package, and the extra installs it from PyPI--
python/CMakeLists.txt: STABLE_ABI, as your comment there describes, so one wheel covers Python 3.12 and later, plus a separate 3.11 wheel--
python/anphon/__init__.py: the wheels do not include libmpi, so if the import fails because libmpi is not found, anphon loads the one that the openmpi wheel or conda puts in<prefix>/lib--
python/LICENSE.txt: a symlink toLICENSE.txt, so the license is included in the wheels-- docs: a short section on the wheels in
python_api.rst, and the "pip wheels with MPI" line removed fromanphon_python.rstHow it was tested
-- on each platform, CI builds the alm and anphon CLIs with the same compiler and libraries as the wheels, installs each wheel, and runs
tools/testswith no skipped tests plus thempirun -np 2anphon tests, like tools_tests.yaml. The CLIs are built there because the tests compare the Python API with them bit for bit(154 =
tools/tests, 4 =mpirun -np 2tests)-- the SrTiO3 SCPH example (example/SrTiO3/reference/scph.in) on one Perlmutter CPU node, with 64 MPI ranks and Open MPI from PyPI (after the LD_LIBRARY_PATH step in the docs), gives the same scph_bands as the reference file, within its printed precision (1e-4 cm^-1)
-- atomate2 installs together with the wheel without conflicts
A few things for you to decide..
pypienvironment in the repo settings. The v2.0.0 tag does not have this workflow, so the first upload would need a new release, e.g. 2.0.1, with the version updated inpython/pyproject.tomland in the fallback versions inalm/__init__.pyandanphon/__init__.py. You may want to try it on test.pypi.org firstLICENSE.txt, the wheels bundle OpenBLAS, HDF5, libaec, and the GCC runtime libraries on Linux, and HDF5, libaec, libomp, and spglib on macOS. Should I add their license texts to the wheels, as numpy and h5py do, before the first release?python/pyproject.tomlhas noreadme, so the PyPI page would have no description. Should I add a short README inpython/?python/alone does not contain../almand../anphon. Is that ok with you?block_indirect_sortwas added in Boost 1.67 (it is not in boost-1.66.0), so the>= 1.66checks inalm/,anphon/, andpython/CMakeLists.txtare too low. Should I raise them to 1.67 in a separate PR?Notes
-- the wheels are for Python 3.11 and later, since 3.10 reaches its end of life this month.
requires-pythonstays as it is for source builds-- the macOS wheels need macOS 15 or later, since the Homebrew libraries on the macOS 15 runner are built for it
-- on Cray machines, Cray's libfabric on LD_LIBRARY_PATH is loaded before the one inside the openmpi wheel, so the docs give a one-line workaround
Please let me know if you would prefer anything done differently..