From a5ab0628bf6169250c1c50accb58fe1ebd07530a Mon Sep 17 00:00:00 2001 From: Alex Reustle Date: Mon, 17 Aug 2026 15:44:30 -0400 Subject: [PATCH 1/5] ci: build a pure-Python distribution instead of 21 platform wheels nuspacesim has no compiled extensions since the C++ zsteps removal, but both PyPI workflows still drove cibuildwheel across a 7-version x 2-OS x 2-arch matrix. Every one of those 21 jobs now fails on main with "Build failed because a pure Python wheel was generated" -- cibuildwheel treats a pure-Python result as an error. A pure-Python project needs exactly one py3-none-any wheel. CI/CD workflow: - Replace the wheel matrix with a real pytest matrix over the Python versions setup.cfg actually declares (3.9-3.13), on ubuntu and macos. The old workflow never ran the suite directly; it relied on cibuildwheel's test-command, whose CIBW_TEST_SKIP excluded macOS and every non-native arch outright. Tests now run from a scratch directory against the installed package. - Add a build job producing sdist + wheel, gated behind the tests, with `twine check` and an assertion that exactly one py3-none-any wheel is produced -- so a re-introduced binary dependency fails loudly here rather than silently shipping a platform-specific artifact. Publish workflow: - Build once, publish once. The publish job previously carried the same 21-way matrix as the build job, so a release would have attempted 21 uploads of the same file; only the first could succeed. - Ship the sdist alongside the wheel (previously wheels only). Also drop two leftovers from the extension era: the [tool.cibuildwheel] section in pyproject.toml and `ext_package = nuspacesim` in setup.cfg, which is meaningless without ext_modules. Checkouts use fetch-depth: 0 rather than the fetch --unshallow dance, so setuptools_scm sees tags; actions/checkout and setup-python moved to v4/v5. Verified locally: `python -m build` produces one py3-none-any wheel plus an sdist, both pass twine check, the wheel carries the CONEX table and cloud maps, and the full suite (171 tests) passes against that wheel installed in a clean venv, as does the nuspacesim console entry point. Co-Authored-By: Claude Fable 5 --- .github/workflows/pypi-build-test-publish.yml | 102 ++++++------------ .github/workflows/pypi-build-test.yml | 98 +++++++++-------- pyproject.toml | 3 - setup.cfg | 1 - 4 files changed, 89 insertions(+), 115 deletions(-) diff --git a/.github/workflows/pypi-build-test-publish.yml b/.github/workflows/pypi-build-test-publish.yml index a0f67740..289839c0 100644 --- a/.github/workflows/pypi-build-test-publish.yml +++ b/.github/workflows/pypi-build-test-publish.yml @@ -1,4 +1,4 @@ -name: PyPI 🐍 Wheel 🎡 +name: PyPI 🐍 Publish 📦 on: release: @@ -7,93 +7,57 @@ on: jobs: - build_wheels: - name: Build wheel for cp${{ matrix.python }}-${{ matrix.platform_id }} - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: true - matrix: - os: [ubuntu-latest, macos-latest] - python: [39, 310, 311, 312, 313, 314, 315] - arch: [x86, arm] - include: - - os: ubuntu-latest - arch: x86 - platform_id: manylinux_x86_64 - cibw_arch: auto - - os: macos-latest - arch: x86 - platform_id: macosx_x86_64 - cibw_arch: x86_64 - - os: macos-latest - arch: arm - platform_id: macosx_arm64 - cibw_arch: arm64 - exclude: - - os: ubuntu-latest - arch: arm + build: + name: Build pure-Python distribution + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Get history and tags for SCM versioning + - uses: actions/checkout@v4 + with: + # Full history + tags: setuptools_scm derives the release version + # from the tag, so a shallow clone produces a wrong version. + fetch-depth: 0 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Build sdist and wheel run: | - git fetch --prune --unshallow - git fetch --depth=1 origin +refs/tags/*:refs/tags/* + python -m pip install --upgrade pip build twine + python -m build + + - name: Check distribution metadata + run: twine check dist/* - - name: Build wheels - uses: pypa/cibuildwheel@v3.3.0 - env: - CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }} - CIBW_ARCHS_LINUX: ${{ matrix.cibw_arch }} - CIBW_ARCHS_MACOS: ${{ matrix.cibw_arch }} - CIBW_TEST_SKIP: "*_aarch64, *macosx*, *_arm64, *_universal2:arm64" + - name: Verify the wheel is pure Python + run: | + ls -l dist/ + test "$(ls dist/*.whl | wc -l)" -eq 1 + ls dist/ | grep -q -- '-py3-none-any\.whl$' - name: Upload Build Artifact uses: actions/upload-artifact@v4 with: - name: nuspacesim-gh-pypi-artifact-${{ matrix.os }}-${{ matrix.cibw_arch }}-cp${{ matrix.python }}-${{ github.run_id }} - path: wheelhouse/*.whl - retention-days: 1 + name: nuspacesim-dist-${{ github.run_id }} + path: dist/* + retention-days: 5 publish: - name: Publish wheels to PyPI + name: Publish distribution to PyPI runs-on: ubuntu-latest - needs: build_wheels - - strategy: - fail-fast: true - matrix: - os: [ubuntu-latest, macos-latest] - python: [39, 310, 311, 312, 313, 314, 315] - arch: [x86, arm] - include: - - os: ubuntu-latest - arch: x86 - platform_id: manylinux_x86_64 - cibw_arch: auto - - os: macos-latest - arch: x86 - platform_id: macosx_x86_64 - cibw_arch: x86_64 - - os: macos-latest - arch: arm - platform_id: macosx_arm64 - cibw_arch: arm64 - exclude: - - os: ubuntu-latest - arch: arm + needs: build steps: - name: Download Build Artifacts uses: actions/download-artifact@v4 with: - name: nuspacesim-gh-pypi-artifact-${{ matrix.os }}-${{ matrix.cibw_arch }}-cp${{ matrix.python }}-${{ github.run_id }} - path: wheelhouse/ + name: nuspacesim-dist-${{ github.run_id }} + path: dist/ - name: Publish a Python distribution to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ password: ${{ secrets.PYPI_SECRET }} - packages_dir: wheelhouse/ + packages_dir: dist/ diff --git a/.github/workflows/pypi-build-test.yml b/.github/workflows/pypi-build-test.yml index 5f7bd956..7f956d6f 100644 --- a/.github/workflows/pypi-build-test.yml +++ b/.github/workflows/pypi-build-test.yml @@ -8,70 +8,84 @@ on: paths: - 'src/**' - 'test/**' - - setup.py - setup.cfg - pyproject.toml + - '.github/workflows/**' pull_request: branches: [ main ] workflow_dispatch: jobs: - build_wheels: - name: Wheel cp${{ matrix.python }}-${{ matrix.os }}-${{ matrix.arch }} + test: + name: Test py${{ matrix.python }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: + # Matches the support declared in setup.cfg (python_requires + the + # Programming Language classifiers). Add a version here and there + # together. os: [ubuntu-latest, macos-latest] - python: [39, 310, 311, 312, 313, 314, 315] - arch: [x86, arm] - include: - - os: ubuntu-latest - arch: x86 - platform_id: manylinux_x86_64 - cibw_arch: auto - # - os: ubuntu-latest - # arch: arm - # platform_id: manylinux_aarch64 - # cibw_arch: aarch64 - - os: macos-latest - arch: x86 - platform_id: macosx_x86_64 - cibw_arch: x86_64 - - os: macos-latest - arch: arm - platform_id: macosx_arm64 - cibw_arch: arm64 - exclude: - - os: ubuntu-latest - arch: arm + python: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - - uses: actions/checkout@v3 - - name: Get history and tags for SCM versioning + - uses: actions/checkout@v4 + with: + # Full history + tags: setuptools_scm derives the version from them. + fetch-depth: 0 + + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + + - name: Install package and test dependencies run: | - git fetch --prune --unshallow - git fetch --depth=1 origin +refs/tags/*:refs/tags/* + python -m pip install --upgrade pip + python -m pip install . pytest + + - name: Run test suite + # Run from a scratch directory so the installed package is exercised + # rather than the source tree next to it. + run: | + mkdir -p ${{ runner.temp }}/run && cd ${{ runner.temp }}/run + pytest -q ${{ github.workspace }}/test + + build: + name: Build pure-Python distribution + runs-on: ubuntu-latest + needs: test - - name: Set up QEMU for ARM on Linux - if: matrix.arch == 'arm' && matrix.os == 'ubuntu-latest' - uses: docker/setup-qemu-action@v2 + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-python@v5 with: - platforms: all + python-version: "3.12" - - name: Build wheels - uses: pypa/cibuildwheel@v3.3.0 - env: - CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }} - CIBW_ARCHS_LINUX: ${{ matrix.cibw_arch }} - CIBW_ARCHS_MACOS: ${{ matrix.cibw_arch }} - CIBW_TEST_SKIP: "*_aarch64, *macosx*, *_arm64, *_universal2:arm64" + - name: Build sdist and wheel + run: | + python -m pip install --upgrade pip build twine + python -m build + + - name: Check distribution metadata + run: twine check dist/* + + - name: Verify the wheel is pure Python + # nuspacesim has no compiled extensions, so the build must produce a + # single universal py3-none-any wheel. A platform-tagged wheel here means + # a binary dependency crept back in and the packaging needs revisiting. + run: | + ls -l dist/ + test "$(ls dist/*.whl | wc -l)" -eq 1 + ls dist/ | grep -q -- '-py3-none-any\.whl$' - name: Upload Build Artifact uses: actions/upload-artifact@v4 with: - name: nuspacesim-gh-pypi-artifact-${{ matrix.os }}-${{ matrix.cibw_arch }}-cp${{ matrix.python }}-${{ github.run_id }} - path: wheelhouse/*.whl + name: nuspacesim-dist-${{ github.run_id }} + path: dist/* retention-days: 1 diff --git a/pyproject.toml b/pyproject.toml index 288774c0..eda1f0b0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,9 +11,6 @@ version_scheme = 'post-release' local_scheme = 'no-local-version' parentdir_prefix_version = 'nuspacesim-' -[tool.cibuildwheel] -test-requires = "pytest" -test-command = "pytest {project}/test" [tool.black] line-length = 88 skip-string-normalization = false diff --git a/setup.cfg b/setup.cfg index 0337ad16..1ce09063 100644 --- a/setup.cfg +++ b/setup.cfg @@ -39,7 +39,6 @@ install_requires = tomli-w tomli;python_version<"3.11" python_requires = >=3.9 -ext_package = nuspacesim package_dir = = src zip_safe = False From 8e727e068207d29b61b3c6ebf101013cc55f0bd7 Mon Sep 17 00:00:00 2001 From: Alex Reustle Date: Thu, 27 Aug 2026 14:26:38 -0400 Subject: [PATCH 2/5] ci: move workflows to Node 24 action majors GitHub runners now warn that Node 20 actions are deprecated and forced onto Node 24. Bump every action to its current Node 24 major: checkout v7, setup-python v7, upload-artifact v7, download-artifact v8, cache v6. pre-commit.yml also drops the pre-commit/action wrapper: even its latest release still pins the deprecated actions/cache internally, so run pre-commit directly with an explicit cache keyed on .pre-commit-config.yaml -- the same thing the wrapper did, without the warning. The dormant conda-* workflows (workflow_dispatch-only, missing their recipe/ directory) are left untouched. Co-Authored-By: Claude Opus 5 --- .github/workflows/pre-commit.yml | 16 +++++++++++++--- .github/workflows/pypi-build-test-publish.yml | 8 ++++---- .github/workflows/pypi-build-test.yml | 10 +++++----- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 0143b19a..2b8867c0 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -10,6 +10,16 @@ jobs: pre-commit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 - - uses: pre-commit/action@v3.0.0 + - uses: actions/checkout@v7 + - uses: actions/setup-python@v7 + with: + python-version: "3.x" + # Run pre-commit directly (with its cache) rather than via + # pre-commit/action, whose latest release still pins the deprecated + # Node 20 actions/cache internally. + - uses: actions/cache@v6 + with: + path: ~/.cache/pre-commit + key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} + - run: python -m pip install pre-commit + - run: pre-commit run --show-diff-on-failure --color=always --all-files diff --git a/.github/workflows/pypi-build-test-publish.yml b/.github/workflows/pypi-build-test-publish.yml index 289839c0..cdb31a46 100644 --- a/.github/workflows/pypi-build-test-publish.yml +++ b/.github/workflows/pypi-build-test-publish.yml @@ -12,13 +12,13 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 with: # Full history + tags: setuptools_scm derives the release version # from the tag, so a shallow clone produces a wrong version. fetch-depth: 0 - - uses: actions/setup-python@v5 + - uses: actions/setup-python@v7 with: python-version: "3.12" @@ -37,7 +37,7 @@ jobs: ls dist/ | grep -q -- '-py3-none-any\.whl$' - name: Upload Build Artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: nuspacesim-dist-${{ github.run_id }} path: dist/* @@ -50,7 +50,7 @@ jobs: steps: - name: Download Build Artifacts - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: name: nuspacesim-dist-${{ github.run_id }} path: dist/ diff --git a/.github/workflows/pypi-build-test.yml b/.github/workflows/pypi-build-test.yml index 7f956d6f..82c9642d 100644 --- a/.github/workflows/pypi-build-test.yml +++ b/.github/workflows/pypi-build-test.yml @@ -31,12 +31,12 @@ jobs: python: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 with: # Full history + tags: setuptools_scm derives the version from them. fetch-depth: 0 - - uses: actions/setup-python@v5 + - uses: actions/setup-python@v7 with: python-version: ${{ matrix.python }} @@ -58,11 +58,11 @@ jobs: needs: test steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 with: fetch-depth: 0 - - uses: actions/setup-python@v5 + - uses: actions/setup-python@v7 with: python-version: "3.12" @@ -84,7 +84,7 @@ jobs: ls dist/ | grep -q -- '-py3-none-any\.whl$' - name: Upload Build Artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: nuspacesim-dist-${{ github.run_id }} path: dist/* From 54dac29d9f08283b0f91c48544f8a1bc585837c1 Mon Sep 17 00:00:00 2001 From: Alex Reustle Date: Thu, 27 Aug 2026 14:33:46 -0400 Subject: [PATCH 3/5] ci: test 3.14 as supported; add experimental 3.15-rc lane 3.14 is a released CPython with wheels across the scientific stack, so it joins the tested matrix and the declared classifiers together. 3.15 is still at release-candidate stage: test it on ubuntu as an experimental continue-on-error job (allow-prereleases) so breakage surfaces early, but without declaring support or blocking the workflow. Promote it into the matrix -- classifier and matrix entry together -- once it releases and passes. Restores the forward-version coverage the old cibuildwheel matrix listed as cp314/cp315, this time actually running the test suite. Co-Authored-By: Claude Opus 5 --- .github/workflows/pypi-build-test.yml | 16 +++++++++++++++- setup.cfg | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pypi-build-test.yml b/.github/workflows/pypi-build-test.yml index 82c9642d..6fcca94d 100644 --- a/.github/workflows/pypi-build-test.yml +++ b/.github/workflows/pypi-build-test.yml @@ -21,6 +21,10 @@ jobs: name: Test py${{ matrix.python }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} + # Experimental jobs (next CPython pre-release) may fail without failing + # the workflow. + continue-on-error: ${{ matrix.experimental }} + strategy: fail-fast: false matrix: @@ -28,7 +32,16 @@ jobs: # Programming Language classifiers). Add a version here and there # together. os: [ubuntu-latest, macos-latest] - python: ["3.9", "3.10", "3.11", "3.12", "3.13"] + python: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] + experimental: [false] + include: + # Next CPython, currently at release-candidate stage: test it so + # breakage is known early, but don't declare support (no classifier) + # or block the workflow on it. Promote into the matrix above -- and + # add its classifier -- once it releases and passes. + - os: ubuntu-latest + python: "3.15" + experimental: true steps: - uses: actions/checkout@v7 @@ -39,6 +52,7 @@ jobs: - uses: actions/setup-python@v7 with: python-version: ${{ matrix.python }} + allow-prereleases: ${{ matrix.experimental }} - name: Install package and test dependencies run: | diff --git a/setup.cfg b/setup.cfg index 1ce09063..fe7b6aa3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -17,6 +17,7 @@ classifiers = Programming Language :: Python :: 3.11 Programming Language :: Python :: 3.12 Programming Language :: Python :: 3.13 + Programming Language :: Python :: 3.14 keywords = NASA neutrinos From dc2b8217504a17fbab1cd28856ce9f9e7b204c74 Mon Sep 17 00:00:00 2001 From: Alex Reustle Date: Thu, 27 Aug 2026 14:43:09 -0400 Subject: [PATCH 4/5] ci: raise setup-cfg-fmt max-py-version to 3.14 The hook enforces the declared Python ceiling and was stripping the new 3.14 classifier (that is why the previous push failed pre-commit). 3.14 is now tested and supported, so the pin moves with it. This file is the single knob to bump alongside the workflow matrix when 3.15 releases. Co-Authored-By: Claude Opus 5 --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 292a9b4f..5a9f648d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,4 +28,4 @@ repos: rev: v2.7.0 hooks: - id: setup-cfg-fmt - args: ["--include-version-classifiers", "--max-py-version=3.13"] + args: ["--include-version-classifiers", "--max-py-version=3.14"] From 3cf720ff1862cd3ccd14b29fc8f650ea84d273f0 Mon Sep 17 00:00:00 2001 From: Alex Reustle Date: Thu, 27 Aug 2026 14:53:22 -0400 Subject: [PATCH 5/5] ci: drop the experimental 3.15 pre-release lane The lane cannot pass until the ecosystem ships cp315 wheels (h5py has none, so pip falls into a doomed source build), and GitHub renders its continue-on-error failure as a red X on the PR anyway. Test 3.15 when it releases: matrix entry, classifier, and setup-cfg-fmt --max-py-version together. Matrix stays 3.9-3.14. Co-Authored-By: Claude Opus 5 --- .github/workflows/pypi-build-test.yml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/.github/workflows/pypi-build-test.yml b/.github/workflows/pypi-build-test.yml index 6fcca94d..f0fd2baf 100644 --- a/.github/workflows/pypi-build-test.yml +++ b/.github/workflows/pypi-build-test.yml @@ -21,10 +21,6 @@ jobs: name: Test py${{ matrix.python }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} - # Experimental jobs (next CPython pre-release) may fail without failing - # the workflow. - continue-on-error: ${{ matrix.experimental }} - strategy: fail-fast: false matrix: @@ -33,15 +29,6 @@ jobs: # together. os: [ubuntu-latest, macos-latest] python: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] - experimental: [false] - include: - # Next CPython, currently at release-candidate stage: test it so - # breakage is known early, but don't declare support (no classifier) - # or block the workflow on it. Promote into the matrix above -- and - # add its classifier -- once it releases and passes. - - os: ubuntu-latest - python: "3.15" - experimental: true steps: - uses: actions/checkout@v7 @@ -52,7 +39,6 @@ jobs: - uses: actions/setup-python@v7 with: python-version: ${{ matrix.python }} - allow-prereleases: ${{ matrix.experimental }} - name: Install package and test dependencies run: |