From e63115ca5e317be9f6137cc7d8e43257afea3fb3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 5 Jan 2026 21:45:04 +0000 Subject: [PATCH 1/5] Initial plan From 8ac49636d29e1de241f671c34165609bca7ce3b8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 5 Jan 2026 21:51:22 +0000 Subject: [PATCH 2/5] Add GitHub Actions workflow for building wheels with cibuildwheel Co-authored-by: tmolteno <85630+tmolteno@users.noreply.github.com> --- .github/workflows/build-wheels.yml | 147 +++++++++++++++++++++++++++++ necpp/pyproject.toml | 3 + 2 files changed, 150 insertions(+) create mode 100644 .github/workflows/build-wheels.yml create mode 100644 necpp/pyproject.toml diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml new file mode 100644 index 0000000..d9491d6 --- /dev/null +++ b/.github/workflows/build-wheels.yml @@ -0,0 +1,147 @@ +name: Build and upload to PyPI + +on: + workflow_dispatch: + pull_request: + push: + branches: + - main + release: + types: + - published + +jobs: + build_wheels: + name: Build wheels for ${{ matrix.package }} on ${{ matrix.os }} + runs-on: ${{ matrix.runs-on }} + strategy: + matrix: + include: + # PyNEC builds + - package: PyNEC + os: linux + runs-on: ubuntu-latest + - package: PyNEC + os: macos-intel + runs-on: macos-13 + - package: PyNEC + os: macos-arm + runs-on: macos-latest + # necpp builds + - package: necpp + os: linux + runs-on: ubuntu-latest + - package: necpp + os: macos-intel + runs-on: macos-13 + - package: necpp + os: macos-arm + runs-on: macos-latest + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install build dependencies (Linux) + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y swig autoconf automake libtool + + - name: Install build dependencies (macOS) + if: runner.os == 'macOS' + run: | + brew install swig autoconf automake libtool + + - name: Configure necpp_src + shell: bash + run: | + cd necpp_src + make -f Makefile.git + ./configure --without-lapack + + - name: Setup package directory and generate SWIG wrapper + shell: bash + run: | + cd ${{ matrix.package }} + ln -s ../necpp_src . + if [ "${{ matrix.package }}" = "PyNEC" ]; then + swig -Wall -c++ -python PyNEC.i + else + swig -I../necpp_src/src/ -python necpp.i + fi + + - name: Build wheels + uses: pypa/cibuildwheel@v2.16.5 + env: + CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-* cp312-*" + CIBW_SKIP: "*-musllinux_*" + CIBW_BUILD_VERBOSITY: 1 + with: + package-dir: ${{ matrix.package }} + output-dir: wheelhouse + + - uses: actions/upload-artifact@v4 + with: + name: cibw-wheels-${{ matrix.package }}-${{ matrix.os }}-${{ strategy.job-index }} + path: ./wheelhouse/*.whl + + build_sdist: + name: Build source distribution + runs-on: ubuntu-latest + strategy: + matrix: + package: [PyNEC, necpp] + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install build dependencies + run: | + sudo apt-get update + sudo apt-get install -y swig autoconf automake libtool + + - name: Configure necpp_src + run: | + cd necpp_src + make -f Makefile.git + ./configure --without-lapack + + - name: Setup package directory and generate SWIG wrapper + run: | + cd ${{ matrix.package }} + ln -s ../necpp_src . + if [ "${{ matrix.package }}" = "PyNEC" ]; then + swig -Wall -c++ -python PyNEC.i + else + swig -I../necpp_src/src/ -python necpp.i + fi + + - name: Build sdist + run: | + cd ${{ matrix.package }} + pipx run build --sdist + + - uses: actions/upload-artifact@v4 + with: + name: cibw-sdist-${{ matrix.package }} + path: ${{ matrix.package }}/dist/*.tar.gz + + upload_pypi: + needs: [build_wheels, build_sdist] + runs-on: ubuntu-latest + environment: pypi + permissions: + id-token: write + if: github.event_name == 'release' && github.event.action == 'published' + steps: + - uses: actions/download-artifact@v4 + with: + # unpacks all CIBW artifacts into dist/ + pattern: cibw-* + path: dist + merge-multiple: true + + - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/necpp/pyproject.toml b/necpp/pyproject.toml new file mode 100644 index 0000000..9787c3b --- /dev/null +++ b/necpp/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools.build_meta" From 7e1220b11830ca4510afb7bcc789f908b498fb7c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 5 Jan 2026 21:55:04 +0000 Subject: [PATCH 3/5] Remove Python 3.8 (EOL) and fix artifact naming Co-authored-by: tmolteno <85630+tmolteno@users.noreply.github.com> --- .github/workflows/build-wheels.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index d9491d6..cd96d05 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -75,7 +75,7 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v2.16.5 env: - CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-* cp312-*" + CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-*" CIBW_SKIP: "*-musllinux_*" CIBW_BUILD_VERBOSITY: 1 with: @@ -84,7 +84,7 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: cibw-wheels-${{ matrix.package }}-${{ matrix.os }}-${{ strategy.job-index }} + name: cibw-wheels-${{ matrix.package }}-${{ matrix.os }} path: ./wheelhouse/*.whl build_sdist: From 649b59825f5e1f6b43278a3c3e622c208cba1164 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 5 Jan 2026 21:56:18 +0000 Subject: [PATCH 4/5] Add explicit permissions to workflow jobs for security Co-authored-by: tmolteno <85630+tmolteno@users.noreply.github.com> --- .github/workflows/build-wheels.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index cd96d05..bf81d64 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -14,6 +14,8 @@ jobs: build_wheels: name: Build wheels for ${{ matrix.package }} on ${{ matrix.os }} runs-on: ${{ matrix.runs-on }} + permissions: + contents: read strategy: matrix: include: @@ -90,6 +92,8 @@ jobs: build_sdist: name: Build source distribution runs-on: ubuntu-latest + permissions: + contents: read strategy: matrix: package: [PyNEC, necpp] From e52dd4f9e46726b7f25945903566e8ef27ea78bb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 5 Jan 2026 22:16:51 +0000 Subject: [PATCH 5/5] Split workflow into separate files for PyNEC and necpp Co-authored-by: tmolteno <85630+tmolteno@users.noreply.github.com> --- ...uild-wheels.yml => build-necpp-wheels.yml} | 55 +++----- .github/workflows/build-pynec-wheels.yml | 126 ++++++++++++++++++ 2 files changed, 141 insertions(+), 40 deletions(-) rename .github/workflows/{build-wheels.yml => build-necpp-wheels.yml} (66%) create mode 100644 .github/workflows/build-pynec-wheels.yml diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-necpp-wheels.yml similarity index 66% rename from .github/workflows/build-wheels.yml rename to .github/workflows/build-necpp-wheels.yml index bf81d64..952227e 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-necpp-wheels.yml @@ -1,4 +1,4 @@ -name: Build and upload to PyPI +name: Build and upload necpp to PyPI on: workflow_dispatch: @@ -12,32 +12,18 @@ on: jobs: build_wheels: - name: Build wheels for ${{ matrix.package }} on ${{ matrix.os }} + name: Build necpp wheels on ${{ matrix.os }} runs-on: ${{ matrix.runs-on }} permissions: contents: read strategy: matrix: include: - # PyNEC builds - - package: PyNEC - os: linux + - os: linux runs-on: ubuntu-latest - - package: PyNEC - os: macos-intel + - os: macos-intel runs-on: macos-13 - - package: PyNEC - os: macos-arm - runs-on: macos-latest - # necpp builds - - package: necpp - os: linux - runs-on: ubuntu-latest - - package: necpp - os: macos-intel - runs-on: macos-13 - - package: necpp - os: macos-arm + - os: macos-arm runs-on: macos-latest steps: @@ -66,13 +52,9 @@ jobs: - name: Setup package directory and generate SWIG wrapper shell: bash run: | - cd ${{ matrix.package }} + cd necpp ln -s ../necpp_src . - if [ "${{ matrix.package }}" = "PyNEC" ]; then - swig -Wall -c++ -python PyNEC.i - else - swig -I../necpp_src/src/ -python necpp.i - fi + swig -I../necpp_src/src/ -python necpp.i - name: Build wheels uses: pypa/cibuildwheel@v2.16.5 @@ -81,22 +63,19 @@ jobs: CIBW_SKIP: "*-musllinux_*" CIBW_BUILD_VERBOSITY: 1 with: - package-dir: ${{ matrix.package }} + package-dir: necpp output-dir: wheelhouse - uses: actions/upload-artifact@v4 with: - name: cibw-wheels-${{ matrix.package }}-${{ matrix.os }} + name: cibw-wheels-necpp-${{ matrix.os }} path: ./wheelhouse/*.whl build_sdist: - name: Build source distribution + name: Build necpp source distribution runs-on: ubuntu-latest permissions: contents: read - strategy: - matrix: - package: [PyNEC, necpp] steps: - uses: actions/checkout@v4 with: @@ -115,23 +94,19 @@ jobs: - name: Setup package directory and generate SWIG wrapper run: | - cd ${{ matrix.package }} + cd necpp ln -s ../necpp_src . - if [ "${{ matrix.package }}" = "PyNEC" ]; then - swig -Wall -c++ -python PyNEC.i - else - swig -I../necpp_src/src/ -python necpp.i - fi + swig -I../necpp_src/src/ -python necpp.i - name: Build sdist run: | - cd ${{ matrix.package }} + cd necpp pipx run build --sdist - uses: actions/upload-artifact@v4 with: - name: cibw-sdist-${{ matrix.package }} - path: ${{ matrix.package }}/dist/*.tar.gz + name: cibw-sdist-necpp + path: necpp/dist/*.tar.gz upload_pypi: needs: [build_wheels, build_sdist] diff --git a/.github/workflows/build-pynec-wheels.yml b/.github/workflows/build-pynec-wheels.yml new file mode 100644 index 0000000..b78073f --- /dev/null +++ b/.github/workflows/build-pynec-wheels.yml @@ -0,0 +1,126 @@ +name: Build and upload PyNEC to PyPI + +on: + workflow_dispatch: + pull_request: + push: + branches: + - main + release: + types: + - published + +jobs: + build_wheels: + name: Build PyNEC wheels on ${{ matrix.os }} + runs-on: ${{ matrix.runs-on }} + permissions: + contents: read + strategy: + matrix: + include: + - os: linux + runs-on: ubuntu-latest + - os: macos-intel + runs-on: macos-13 + - os: macos-arm + runs-on: macos-latest + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install build dependencies (Linux) + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y swig autoconf automake libtool + + - name: Install build dependencies (macOS) + if: runner.os == 'macOS' + run: | + brew install swig autoconf automake libtool + + - name: Configure necpp_src + shell: bash + run: | + cd necpp_src + make -f Makefile.git + ./configure --without-lapack + + - name: Setup package directory and generate SWIG wrapper + shell: bash + run: | + cd PyNEC + ln -s ../necpp_src . + swig -Wall -c++ -python PyNEC.i + + - name: Build wheels + uses: pypa/cibuildwheel@v2.16.5 + env: + CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-*" + CIBW_SKIP: "*-musllinux_*" + CIBW_BUILD_VERBOSITY: 1 + with: + package-dir: PyNEC + output-dir: wheelhouse + + - uses: actions/upload-artifact@v4 + with: + name: cibw-wheels-pynec-${{ matrix.os }} + path: ./wheelhouse/*.whl + + build_sdist: + name: Build PyNEC source distribution + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install build dependencies + run: | + sudo apt-get update + sudo apt-get install -y swig autoconf automake libtool + + - name: Configure necpp_src + run: | + cd necpp_src + make -f Makefile.git + ./configure --without-lapack + + - name: Setup package directory and generate SWIG wrapper + run: | + cd PyNEC + ln -s ../necpp_src . + swig -Wall -c++ -python PyNEC.i + + - name: Build sdist + run: | + cd PyNEC + pipx run build --sdist + + - uses: actions/upload-artifact@v4 + with: + name: cibw-sdist-pynec + path: PyNEC/dist/*.tar.gz + + upload_pypi: + needs: [build_wheels, build_sdist] + runs-on: ubuntu-latest + environment: pypi + permissions: + id-token: write + if: github.event_name == 'release' && github.event.action == 'published' + steps: + - uses: actions/download-artifact@v4 + with: + # unpacks all CIBW artifacts into dist/ + pattern: cibw-* + path: dist + merge-multiple: true + + - uses: pypa/gh-action-pypi-publish@release/v1