Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions .github/actions/build_pypi_dist/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,37 @@ runs:
shell: bash
run: pip install --quiet build twine

# Uses the normal (isolated) build-system.requires resolution, i.e. the
# same git-fetched nwxcmake a real `pip install` from PyPI would use, so
# this publishes exactly what a fresh `pip install` would build.
# Making an sdist only runs the build backend's packaging step
# (scikit-build-core does not run CMake for it), so it needs the backend
# and nothing else. An isolated `python -m build --sdist` would install
# *all* of build-system.requires, which includes the compiled ecosystem
# packages a wheel build links against (nwchemex-parallelzone, ...).
# This step runs on the runner's default Python, for which those have no
# published wheel, so pip falls back to building them from source -- on
# a host with no MPI -- and the sdist step fails before the wheel build
# starts ("Package 'mpi-cxx' ... not found" from ParallelZone).
#
# So install build-system.requires minus the nwchemex-* packages and
# build without isolation. Isolation does not change an sdist's contents.
# tomllib is in the standard library from Python 3.11 on.
- name: Build Source Distribution
if: inputs.build_sdist == 'true'
shell: bash
run: python -m build --sdist --outdir dist
run: |
python - <<'EOF' > sdist_requirements.txt
import re
import tomllib
with open("pyproject.toml", "rb") as f:
requires = tomllib.load(f)["build-system"]["requires"]
for req in requires:
if not re.match(r"nwchemex[-_.]", req, re.IGNORECASE):
print(req)
EOF
cat sdist_requirements.txt
pip install -r sdist_requirements.txt
rm sdist_requirements.txt
python -m build --sdist --no-isolation --skip-dependency-check \
--outdir dist

# Building the wheel from the *extracted sdist* (rather than the repo
# checkout) catches packaging bugs where a file the build needs was
Expand Down
17 changes: 16 additions & 1 deletion .github/actions/pip_build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,29 @@ runs:
# no longer exists ("dyld: Library not loaded: @rpath/libutilities.dylib").
# scikit-build-core recommends this setup for editable installs anyway.
#
# The dev extra's nwchemex-* packages are installed here too. An editable
# install turns on DEVELOPER_SETUP, so CMake configures integration tests,
# and the plugins those tests use (e.g. SCF's Integrals, ChemCache, NUX)
# must already be installed when it does. pip would otherwise install the
# extra only after the build, leaving CMake to fetch and compile them --
# and their own dependencies, such as libint2 -- from git master.
#
# tomllib is in the standard library from Python 3.11 on.
- name: Install Build Requirements
shell: bash
run: |
python - <<'EOF' > build_requirements.txt
import re
import tomllib
with open("pyproject.toml", "rb") as f:
print("\n".join(tomllib.load(f)["build-system"]["requires"]))
pyproject = tomllib.load(f)
requires = list(pyproject["build-system"]["requires"])
dev = pyproject.get("project", {}).get("optional-dependencies", {})
requires += [
r for r in dev.get("dev", [])
if re.match(r"nwchemex[-_.]", r, re.IGNORECASE)
]
print("\n".join(requires))
EOF
cat build_requirements.txt
pip install -r build_requirements.txt ${{ inputs.pip_opts }}
Expand Down
Loading