Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Meson pybind11 build #1343

Merged
merged 29 commits into from
Jul 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
18ec991
MAINT: Cleanup highspy bindings
HaoZeke Jun 28, 2023
cd97364
BUG,MAINT: Fix writeOptions, remove unused pyomo
HaoZeke Jun 28, 2023
7b8cf65
ENH: Setup meson-python based package builds
HaoZeke Jun 28, 2023
a1c4561
BLD: Try simplifying and updating CI
HaoZeke Jun 28, 2023
2b64bd0
BLD: Update wheel builder, and add test dep
HaoZeke Jun 28, 2023
87fe8c4
BLD: Don't confuse windows builds
HaoZeke Jun 29, 2023
451b13e
MAINT: Try not linking to highslib explicitly
HaoZeke Jun 29, 2023
cbd46eb
BLD,CI: Rework wheels and add a versioned release
HaoZeke Jul 2, 2023
32e0952
MAINT: Fix meson typo from merge
HaoZeke Jul 2, 2023
ee146d1
CI: Build wheels for macos
HaoZeke Jul 2, 2023
9c023f3
BLD: Actually build arm64 wheels
HaoZeke Jul 2, 2023
466ad94
MAINT: Always require pybind11 and use subproject
HaoZeke Jul 2, 2023
fa9c65e
MAINT: Address review comments
HaoZeke Jul 2, 2023
da41384
BLD: Try wheels on windows
HaoZeke Jul 2, 2023
d08b783
BLD: Repair wheels explicitly
HaoZeke Jul 2, 2023
1494c33
BLD: Try switching to vsenv for wheels [win]
HaoZeke Jul 2, 2023
803de4f
MAINT: Kill setup.py in favor of pyproject.toml
HaoZeke Jul 2, 2023
9c88e61
BLD: Try building static libraries, no vsenv
HaoZeke Jul 2, 2023
a3c8bd8
BLD: Try pre-installing native dependency
HaoZeke Jul 2, 2023
b1d5458
MAINT: Update gitig for meson
HaoZeke Jul 2, 2023
6df7d6e
MAINT: Install more required deps for building
HaoZeke Jul 2, 2023
b6e4d5b
MAINT: Stop static linking
HaoZeke Jul 2, 2023
64b6a76
BLD: Try fixing delvewheel invocation
HaoZeke Jul 2, 2023
affd143
BLD: Try installing libhighs first [win]
HaoZeke Jul 2, 2023
d59af2e
DOC: Minor cleanup, remove windows python api test
HaoZeke Jul 2, 2023
d766de3
BLD: Reduce duplicate CI files
HaoZeke Jul 2, 2023
4a51ff5
MAINT: Futureproof the bindings
HaoZeke Jul 2, 2023
e459c3c
MAINT: Cleanup buggy toptal meson gitignore
HaoZeke Jul 8, 2023
3929c4b
MAINT: Address meson-python review comments
HaoZeke Jul 8, 2023
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
105 changes: 51 additions & 54 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
@@ -1,70 +1,67 @@
name: Wheels
name: Build wheels

on: [push, pull_request]

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
name: Build wheel for ${{ matrix.python }}-${{ matrix.buildplat[1] }}
runs-on: ${{ matrix.buildplat[0] }}
environment: pypi
strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
matrix:
os: [macOS-12] # windows-2019 ubuntu-20.04,
# From NumPy
# Github Actions doesn't support pairing matrix values together, let's improvise
# https://github.com/github/feedback/discussions/7835#discussioncomment-1769026
buildplat:
- [ubuntu-20.04, manylinux_x86_64]
- [ubuntu-20.04, musllinux_x86_64] # No OpenBlas, no test
- [macos-12, macosx_x86_64]
- [macos-12, macosx_arm64]
- [windows-2019, win_amd64]
python: ["cp38", "cp39","cp310", "cp311"]

steps:
- uses: actions/checkout@v3
- name: Build wheels
uses: pypa/cibuildwheel@v2.12.3
env:
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl

# Used to host cibuildwheel
- uses: actions/setup-python@v2

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.7.0

- name: Install pyomo pybind
run: python -m pip install pybind11 pyomo

- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build

- name: Create install dir
run: cmake -E make_directory ${{runner.workspace}}/installs/

- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=${{runner.workspace}}/installs/highs -DFAST_BUILD=ON

- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: |
cmake --build . --parallel
cmake --install .

- name: Test
working-directory: ${{runner.workspace}}/build
shell: bash
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --parallel 2 --timeout 300 --output-on-failure
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Build wheels
run: |
cd $GITHUB_WORKSPACE
export REPAIR_LIBRARY_PATH=${{runner.workspace}}/installs/highs/lib
export LD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH
export DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH
ls $REPAIR_LIBRARY_PATH
python -m cibuildwheel --output-dir wheelhouse
- name: Build sdist
shell: bash -l {0}
run: pipx run build --sdist

# to supply options, put them in 'env', like:
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz

env:
CIBW_ENVIRONMENT: REPAIR_LIBRARY_PATH=${{runner.workspace}}/installs/highs/lib LD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-listdeps {wheel} &&
DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}
upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
# upload to PyPI on every tag starting with 'v'
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
# alternatively, to publish when a GitHub Release is created, use the following rule:
# if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v3
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: artifact
path: dist

- uses: actions/upload-artifact@v2
- uses: pypa/gh-action-pypi-publish@release/v1
with:
path: ./wheelhouse/*.whl
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
51 changes: 0 additions & 51 deletions .github/workflows/test-python-api-mac.yml

This file was deleted.

54 changes: 0 additions & 54 deletions .github/workflows/test-python-api-ubuntu.yml

This file was deleted.

55 changes: 0 additions & 55 deletions .github/workflows/test-python-api-win.yml

This file was deleted.

25 changes: 25 additions & 0 deletions .github/workflows/test-python-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: test-python-api

on: [push, pull_request]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
python: [3.9]
steps:
- uses: actions/checkout@v3
- name: Install correct python version
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python }}
- name: Test Python Interface
shell: bash
run: |
# No need to separately install highs,
# shared library lookups are good enough
pip install -vvv .
pip install pytest numpy
pytest -v ./highspy/tests/
54 changes: 0 additions & 54 deletions .github/workflows/test-python-platforms.yml

This file was deleted.

7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#################
### Meson ###
# subproject directories
/subprojects/*
!/subprojects/*.wrap

# #################
## Eclipse
#################

Expand Down
2 changes: 1 addition & 1 deletion examples/call_highs_from_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
options.presolve = 'off'
options.solver = 'ipm'
h1.passOptions(options)
h1.writeOptions("", True)
h1.writeOptions("")
h1.run()
solution = h1.getSolution()
basis = h1.getBasis()
Expand Down
Loading