From 6ce04aac237df6bedbbb1bfba767a74feb1b8cb3 Mon Sep 17 00:00:00 2001 From: Daniel Bok Date: Mon, 22 Dec 2025 14:55:53 +0800 Subject: [PATCH 1/7] Update nlopt submodule --- extern/nlopt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extern/nlopt b/extern/nlopt index 7d04da1..8dea251 160000 --- a/extern/nlopt +++ b/extern/nlopt @@ -1 +1 @@ -Subproject commit 7d04da19236148f9ae9d8dfa470a2264f5d2aa33 +Subproject commit 8dea25183daeb7f601c7469ca2a45e8c580a5688 From c3e4386f511577abac17b1e7842e0ee1ead3f269 Mon Sep 17 00:00:00 2001 From: Daniel Bok Date: Mon, 22 Dec 2025 16:41:14 +0800 Subject: [PATCH 2/7] format code --- extensions.py | 57 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/extensions.py b/extensions.py index feade1b..0c599c5 100644 --- a/extensions.py +++ b/extensions.py @@ -54,49 +54,64 @@ def build_extension(self, ext: Extension): "-DNLOPT_GUILE=OFF", "-DNLOPT_MATLAB=OFF", "-DNLOPT_OCTAVE=OFF", - ext.source_dir.as_posix() + ext.source_dir.as_posix(), ] if platform.system() == "Windows": - cmd.insert(2, f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{self.config.upper()}={_ed}") + cmd.insert( + 2, f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{self.config.upper()}={_ed}" + ) execute_command( cmd=cmd, cwd=build_dir, env={ **os.environ.copy(), - "CXXFLAGS": f'{os.environ.get("CXXFLAGS", "")} -DVERSION_INFO="{self.distribution.get_version()}"' - }) + "CXXFLAGS": f'{os.environ.get("CXXFLAGS", "")} -DVERSION_INFO="{self.distribution.get_version()}"', + }, + ) # build the DLL - execute_command([ - 'cmake', - '--build', - '.', - '--config', - self.config, - "--", - "-m" if platform.system() == "Windows" else "-j2" - ], cwd=build_dir) + execute_command( + [ + "cmake", + "--build", + ".", + "--config", + self.config, + "--", + "-m" if platform.system() == "Windows" else "-j2", + ], + cwd=build_dir, + ) # Copy over the important bits nlopt_py = build_dir / "extern" / "nlopt" / "src" / "swig" / "python" / "nlopt.py" - logging.info(f"Ext Dir - {ext_dir}\n" + '\n'.join(f' - {file.as_posix()}' for file in ext_dir.rglob('*'))) + logging.info( + f"Ext Dir - {ext_dir}\n" + + "\n".join(f" - {file.as_posix()}" for file in ext_dir.rglob("*")) + ) for folder in [ext_dir, nlopt_py.parent]: - logging.info(f'Files in {folder.as_posix()}\n' + '\n'.join(f' - {f.name}' for f in folder.iterdir())) - - logging.info(f"Attempting to copy nlopt.py file from {nlopt_py.parent.as_posix()} to {ext_dir.as_posix()}") + logging.info( + f"Files in {folder.as_posix()}\n" + + "\n".join(f" - {f.name}" for f in folder.iterdir()) + ) + + logging.info( + f"Attempting to copy nlopt.py file from {nlopt_py.parent.as_posix()} to {ext_dir.as_posix()}" + ) if not nlopt_py.exists(): raise RuntimeError("swig python file was not generated") shutil.copy2(nlopt_py, ext_dir / "nlopt.py") - with open(ext_dir / "__init__.py", 'w') as f: - f.write(f""" -from .nlopt import * + with open(ext_dir / "__init__.py", "w") as f: + f.write( + f"""from .nlopt import * __version__ = '{ext.version}' -""".strip() + "\n") +""".lstrip() + ) def create_directory(path: Path): From d8f6fbbc1aed7de738ec43ee799f5e3718b67f59 Mon Sep 17 00:00:00 2001 From: Daniel Bok Date: Mon, 22 Dec 2025 16:44:03 +0800 Subject: [PATCH 3/7] update build.yml --- .github/workflows/build.yml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 78aaee0..6dbc337 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,14 +2,6 @@ name: Build on: workflow_dispatch: - inputs: - branch: - description: 'Branch to build' - required: true - type: choice - options: - - master - - refs/remotes/** push: branches: - develop/* @@ -30,7 +22,7 @@ jobs: strategy: fail-fast: False matrix: - python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13' ] + python-version: [ '3.10', '3.11', '3.12', '3.13', '3.14' ] steps: - name: Checkout repository uses: actions/checkout@v4 @@ -99,7 +91,7 @@ jobs: strategy: matrix: os: [ windows-latest, ubuntu-latest, macos-latest, macos-13 ] - python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13' ] + python-version: [ '3.10', '3.11', '3.12', '3.13', '3.14' ] steps: - name: Checkout repository From b56748cdd6a0ce5611667d44d5d18137a8c125a4 Mon Sep 17 00:00:00 2001 From: Daniel Bok Date: Mon, 22 Dec 2025 22:28:26 +0800 Subject: [PATCH 4/7] update macos version in runner --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6dbc337..4564563 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -52,7 +52,7 @@ jobs: strategy: fail-fast: False matrix: - os: [ ubuntu-latest, macos-latest, macos-13 ] + os: [ ubuntu-latest, macos-latest, macos-14 ] steps: - name: Checkout repository uses: actions/checkout@v4 @@ -90,7 +90,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ windows-latest, ubuntu-latest, macos-latest, macos-13 ] + os: [ windows-latest, ubuntu-latest, macos-latest, macos-14 ] python-version: [ '3.10', '3.11', '3.12', '3.13', '3.14' ] steps: From decab093a2dbf39ac8979f87d2c09117edd32aee Mon Sep 17 00:00:00 2001 From: Daniel Bok Date: Mon, 22 Dec 2025 22:34:05 +0800 Subject: [PATCH 5/7] add concurrency --- .github/workflows/build.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4564563..454f538 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,6 +11,15 @@ on: release: types: [ published ] +concurrency: + cancel-in-progress: false + # This creates different concurrency groups depending on the trigger + # For PRs: uses the PR number (e.g., "build-pr-123") + # For branch pushes: uses the branch name (e.g., "build-develop/feature-x") + # For releases: uses the release tag plus a unique run ID so each release runs independently + # For manual dispatches: uses a unique run ID so each dispatch runs independently + group: ${{ github.event_name == 'pull_request' && format('build-pr-{0}', github.event.pull_request.number) || github.event_name == 'push' && format('build-{0}', github.ref) || github.event_name == 'release' && format('build-release-{0}-{1}', github.event.release.tag_name, github.run_id) || format('build-dispatch-{0}', github.run_id) }} + defaults: run: shell: bash From 012138810f9acd5950bd9641be78593a6466024b Mon Sep 17 00:00:00 2001 From: Daniel Bok Date: Tue, 23 Dec 2025 18:35:39 +0800 Subject: [PATCH 6/7] add debug messages --- .github/workflows/build.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 454f538..ad03d28 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -139,6 +139,11 @@ jobs: else chunk="${{matrix.os}}" fi + + echo "Runner OS: ${{ runner.os }}" + echo "os : ${os}" + echo "version : ${version}" + echo "chunk : ${chunk}" # this finds files like # nlopt-2.6.2-cp36-cp36m-win_amd64.whl From 1b29926ce21374c1e9c6bfd4b3341a9ca1430d94 Mon Sep 17 00:00:00 2001 From: Daniel Bok Date: Tue, 23 Dec 2025 21:35:16 +0800 Subject: [PATCH 7/7] add a single place to control python versions --- .github/workflows/build.yml | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ad03d28..1ca1389 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,6 +11,9 @@ on: release: types: [ published ] +env: + PYTHON_VERSIONS: "3.10,3.11,3.12,3.13,3.14" + concurrency: cancel-in-progress: false # This creates different concurrency groups depending on the trigger @@ -25,13 +28,30 @@ defaults: shell: bash jobs: + setup: + runs-on: ubuntu-latest + outputs: + python-versions: ${{ steps.set-matrix.outputs.python-versions }} + cibw-build: ${{ steps.set-matrix.outputs.cibw-build }} + steps: + - id: set-matrix + run: | + # Convert "3.10,3.11,3.12" to ["3.10","3.11","3.12"] + python_array=$(echo '["${{ env.PYTHON_VERSIONS }}"]' | sed 's/,/","/g') + echo "python-versions=$python_array" >> $GITHUB_OUTPUT + + # Convert "3.10,3.11,3.12" to "cp310-* cp311-* cp312-*" + cibw=$(echo "${{ env.PYTHON_VERSIONS }}" | sed 's/\.//g; s/,/ /g; s/\([0-9]*\)/cp\1-*/g') + echo "cibw-build=$cibw" >> $GITHUB_OUTPUT + build_wheels_windows: name: Build wheels on Windows + needs: setup runs-on: windows-latest strategy: fail-fast: False matrix: - python-version: [ '3.10', '3.11', '3.12', '3.13', '3.14' ] + python-version: ${{ fromJSON(needs.setup.outputs.python-versions) }} steps: - name: Checkout repository uses: actions/checkout@v4 @@ -57,6 +77,7 @@ jobs: build_wheels_unix: name: Build wheels on ${{ matrix.os }} + needs: setup runs-on: ${{ matrix.os }} strategy: fail-fast: False @@ -75,8 +96,8 @@ jobs: - name: Build wheels env: - # only build CPython-3.9+ and skip 32-bit builds - CIBW_BUILD: cp39-* cp310-* cp311-* cp312-* cp313-* + # only build CPython-3.10+ and skip 32-bit builds + CIBW_BUILD: ${{ needs.setup.outputs.cibw-build }} CIBW_SKIP: "*-manylinux_i686 *-musllinux*" # use latest build CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux2014_x86_64 @@ -95,12 +116,12 @@ jobs: test-wheels: name: Test wheels - needs: [ build_wheels_windows, build_wheels_unix ] + needs: [ setup, build_wheels_windows, build_wheels_unix ] runs-on: ${{ matrix.os }} strategy: matrix: os: [ windows-latest, ubuntu-latest, macos-latest, macos-14 ] - python-version: [ '3.10', '3.11', '3.12', '3.13', '3.14' ] + python-version: ${{ fromJSON(needs.setup.outputs.python-versions) }} steps: - name: Checkout repository