Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
e6652f9
fix: Rename hipopybind module file.
mfmceneaney Oct 22, 2025
0d1f593
feat: Add python requirements for build.
mfmceneaney Oct 22, 2025
9bf0a5b
fix: Update .gitignore.
mfmceneaney Oct 22, 2025
0409f4d
fix: Switch to meson build.
mfmceneaney Oct 22, 2025
805b061
fix: Remove pybind11 submodule.
mfmceneaney Oct 22, 2025
a37f2ae
fix: Update python build and dependencies.
mfmceneaney Oct 22, 2025
d4100f5
fix: Fix build.
mfmceneaney Oct 22, 2025
07b8718
fix: Fix import linking errors.
mfmceneaney Oct 22, 2025
0bb35c9
fix: Updated pyproject.toml
mfmceneaney Oct 22, 2025
de3bbfd
fix: Configure as package.
mfmceneaney Oct 22, 2025
ca3cd9b
fix: Configure as package.
mfmceneaney Oct 22, 2025
462154a
fix: Fix python module install directory.
mfmceneaney Oct 22, 2025
8106c19
fix: Update manifest.
mfmceneaney Oct 22, 2025
1fa54f5
fix: Update python init file.
mfmceneaney Oct 22, 2025
0e5a25f
fix: Pass version info to cpp.
mfmceneaney Oct 22, 2025
7e4983e
fix: Fix import issues.
mfmceneaney Oct 22, 2025
aa56bfa
fix: Add get/put<TYPE> functions to module.
mfmceneaney Oct 22, 2025
c18ed7c
fix: Update README.
mfmceneaney Oct 22, 2025
d07b356
fix: Update version.
mfmceneaney Oct 22, 2025
6206c6d
fix: Add init file.
mfmceneaney Oct 22, 2025
9a3e40b
fix: Remove extraneous files.
mfmceneaney Oct 22, 2025
5b7d1f5
fix: Update dependencies.
mfmceneaney Oct 23, 2025
5b404eb
fix: Format code.
mfmceneaney Oct 23, 2025
4e51a31
fix: Update dependencies.
mfmceneaney Oct 23, 2025
b0b5016
fix: Remove comment causing formatting error.
mfmceneaney Oct 23, 2025
e0aad8a
fix: Update dependencies.
mfmceneaney Oct 23, 2025
112f18b
feat: Add workflows.
mfmceneaney Oct 23, 2025
f8b9143
feat: Add badges to README.
mfmceneaney Oct 23, 2025
9cec336
fix: Use recursive checkouts.
mfmceneaney Oct 23, 2025
9a10dcf
fix: Update `pyproject.toml`.
mfmceneaney Oct 23, 2025
c6652a1
fix: Fix versioning and workflow.
mfmceneaney Oct 23, 2025
b65ace5
fix: Remove extra python matrix version for now and set DESTDIR for p…
mfmceneaney Oct 23, 2025
191f03d
fix: Update build...
mfmceneaney Oct 23, 2025
9efe89e
fix: Repaired rpaths and install hipo first.
mfmceneaney Oct 25, 2025
3d9ecca
fix: Update README.
mfmceneaney Oct 25, 2025
8c13491
feat: Add new workflow to build and publish wheels for tagged versions.
mfmceneaney Oct 25, 2025
134cbf8
fix: Update meson dependency.
mfmceneaney Oct 25, 2025
a9721c2
feat: Add more python versions for wheels.
mfmceneaney Oct 25, 2025
2708fb3
fix: Add recursive checkout to workflow.
mfmceneaney Oct 25, 2025
728a7ba
fix: Update minimum python version.
mfmceneaney Oct 25, 2025
b91ad32
fix: Remove conditions for running steps.
mfmceneaney Oct 25, 2025
01f2462
fix: Reformat toml file.
mfmceneaney Oct 25, 2025
c9ae4fc
fix: Rever toml.
mfmceneaney Oct 25, 2025
97028b0
fix: Use poetry to publish instead of twine.
mfmceneaney Oct 25, 2025
380800b
fix: Remove incorrect option.
mfmceneaney Oct 25, 2025
6c438b7
fix: Updated publish workflows to check out directory and set up python.
mfmceneaney Oct 25, 2025
e625615
fix: Use download with publish action.
mfmceneaney Oct 25, 2025
089faf7
fix: Use download with publish action.
mfmceneaney Oct 25, 2025
b8795b8
fix: Add poetry repo configs.
mfmceneaney Oct 25, 2025
fc2369d
fix: Set testpypi repo address directly from CLI.
mfmceneaney Oct 26, 2025
8539143
fix: Use cibuildwheel to build wheels for all python version and for …
mfmceneaney Oct 26, 2025
ea828d6
fix: Add patches for all CI wheels and update minimum macos version.
mfmceneaney Oct 26, 2025
726a3ef
fix: Update meson build.
mfmceneaney Oct 26, 2025
858c9b6
fix: Simplify workflow with cibuildwheel.
mfmceneaney Oct 26, 2025
15cdac4
fix: Remove pypy skip selection.
mfmceneaney Oct 27, 2025
7853597
fix: Use meson project name instead of typing out project name.
mfmceneaney Oct 28, 2025
62a870d
fix: Fix CI build errors.
mfmceneaney Oct 29, 2025
6d66900
fix: remove hipo installation step and script.
mfmceneaney Oct 29, 2025
b8fc4a6
fix: Update workflow python run.
mfmceneaney Oct 29, 2025
bd29675
fix: Update README.
mfmceneaney Oct 29, 2025
f168242
fix: Update CIBW_SKIP.
mfmceneaney Oct 29, 2025
d31d27f
fix: Update README.
mfmceneaney Oct 30, 2025
dc511dc
fix: Fix python command.
mfmceneaney Oct 30, 2025
d27436c
fix: Update install directories.
mfmceneaney Oct 30, 2025
8771050
fix: reduce number of python versions.
mfmceneaney Oct 30, 2025
d846cbf
fix: Update meson build.
mfmceneaney Oct 30, 2025
16cc9d2
fix: Add some additional output to workflow.
mfmceneaney Oct 30, 2025
705baf0
fix: Fix matrix jobs in workflow.
mfmceneaney Oct 30, 2025
16d0940
fix: Fix job name and python version.
mfmceneaney Oct 30, 2025
3e1074b
fix: Update meson build to install shared libraries in same directory…
mfmceneaney Oct 30, 2025
3bf3cc6
fix: Fix syntax error and conditional logic.
mfmceneaney Oct 30, 2025
1b9ca70
fix: Fix paths.
mfmceneaney Oct 30, 2025
5e7c75e
fix: Fix linux build.
mfmceneaney Oct 30, 2025
2f31339
fix: Add debugging message in meson.build script.
mfmceneaney Oct 30, 2025
f9b457c
fix: Make lz4 installation conditional.
mfmceneaney Oct 30, 2025
9f2e6d4
fix: use fs to check file.
mfmceneaney Oct 30, 2025
21fd3fe
fix: Fix extension module build to shared module and set all rpaths.
mfmceneaney Oct 31, 2025
69fec52
fix: Install patchelf in workflow.
mfmceneaney Oct 31, 2025
76911d8
fix: Fix macos build.
mfmceneaney Oct 31, 2025
d401b1a
fix: Add additional python version to workflow.
mfmceneaney Oct 31, 2025
763533b
fix: Remove link_args which will become deprecated and a hard error.
mfmceneaney Oct 31, 2025
adcec62
fix: Skip musllinux builds.
mfmceneaney Oct 31, 2025
a32be4d
fix: Set homebrew environment variables to empty strings so that lz4 …
mfmceneaney Oct 31, 2025
a8e6255
fix: Update workflow to not install all package wheels.
mfmceneaney Oct 31, 2025
984f69a
fix: Reset PKG_CONFIG_PATH for workflow builds.
mfmceneaney Oct 31, 2025
702f590
fix: Do not set macos deployment target.
mfmceneaney Oct 31, 2025
973127a
fix: Specify macos deployment target and archs for cibw.
mfmceneaney Oct 31, 2025
74dc370
fix: Build both macos architectures separately in workflow.
mfmceneaney Oct 31, 2025
45b6be3
fix: Fix macos x86_64 compilation in github workflow.
mfmceneaney Oct 31, 2025
b260750
fix: Update cross compilation.
mfmceneaney Oct 31, 2025
748539c
fix: Updated cibuildwheel ordering for macos archs builds and added m…
mfmceneaney Oct 31, 2025
aeddf39
fix: Set meson args in environment directly.
mfmceneaney Oct 31, 2025
3c3b32d
fix: Add meson arguments to the CIBW_ENVIRONEMNT.
mfmceneaney Oct 31, 2025
a14f3f6
fix: Fix how args are passed from cibuildwheel to meson-python.
mfmceneaney Oct 31, 2025
d5d6b76
fix: Update deprecated block in cross file.
mfmceneaney Oct 31, 2025
418dc40
fix: Pass environment to run_command meson calls.
mfmceneaney Oct 31, 2025
5653b2d
fix: Update README.
mfmceneaney Oct 31, 2025
5c269cf
fix: Update pkg-config specification in cross compilation file.
mfmceneaney Oct 31, 2025
5a6f769
fix: Dump environment in meson.build script.
mfmceneaney Oct 31, 2025
6e0e1a8
fix: Explicitly set CIBW_ENVIRONMENT in workflow.
mfmceneaney Oct 31, 2025
d98ee09
fix: Disable pkg-config lookups for macos arch x86_64 builds.
mfmceneaney Oct 31, 2025
3daa41d
fix: Bump version.
mfmceneaney Oct 31, 2025
514df82
fix: Only trigger publishing build on tags on main.
mfmceneaney Oct 31, 2025
e12fae9
fix: Include static c++/gcc libs in wheels and use test version.
mfmceneaney Oct 31, 2025
cb248d6
fix: Only link static cpp libraries for linux builds and remove envir…
mfmceneaney Oct 31, 2025
e25ed27
fix: Remove the GNU gcc link args.
mfmceneaney Oct 31, 2025
86ca020
INCOMPLETE: just recording progress on renaming libhipo4 so far...
mfmceneaney Oct 31, 2025
721e35a
fix: Update meson build to hide imported symbols in shared library.
mfmceneaney Nov 3, 2025
d98ffb9
fix: Update project version.
mfmceneaney Nov 3, 2025
64ed5c1
fix: Add troubleshooting note in README.
mfmceneaney Nov 3, 2025
4660691
fix: Update workflow to only publish on main and to publish to pypi.
mfmceneaney Nov 3, 2025
72f3101
fix: Update project version.
mfmceneaney Nov 3, 2025
46980c0
fix: Fix workflow file.
mfmceneaney Nov 3, 2025
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
131 changes: 131 additions & 0 deletions .github/workflows/build-and-publish-wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
name: Build and Publish Wheels

on:
push:
branches: ['main']
tags:
- "v*" # Build & publish on version tags (e.g. v1.2.3)
workflow_dispatch: # Allow manual trigger

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"

- name: Install Poetry
run: |
python -m pip install --upgrade pip
pip install poetry

- name: Configure Poetry
run: poetry config virtualenvs.create true && poetry lock

- name: Install dependencies
run: poetry install --no-interaction --no-root

- name: Check C++ formatting
run: |
echo "Checking C++ code formatting..."
poetry run clang-format --dry-run --Werror $(find src/ -name '*.cpp' -o -name '*.hpp')

- name: Build package wheel
run: |
pip install cibuildwheel
if [[ "$RUNNER_OS" == "Linux" ]]; then
cibuildwheel --output-dir dist --platform linux
elif [[ "$RUNNER_OS" == "macOS" ]]; then
CIBW_CONFIG_SETTINGS="setup-args=-Dmacos_arch=x86_64" cibuildwheel --output-dir dist --platform macos --archs x86_64
CIBW_CONFIG_SETTINGS="setup-args=-Dmacos_arch=arm64" cibuildwheel --output-dir dist --platform macos --archs arm64
fi
env:
MACOSX_DEPLOYMENT_TARGET: '15.0'
CIBW_SKIP: "pp* *-musllinux* cp36-* cp37-* cp38-*"
HOMEBREW_PREFIX: ""
HOMEBREW_CELLAR: ""
HOMEBREW_REPOSITORY: ""
PKG_CONFIG_PATH: ""
CIBW_ENVIRONMENT: "HOMEBREW_PREFIX='' HOMEBREW_CELLAR='' HOMEBREW_REPOSITORY='' PKG_CONFIG_PATH=''"

- name: Upload built wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: dist/*.whl

publish_testpypi:
name: Publish to TestPyPI
needs: build_wheels
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"

- uses: actions/download-artifact@v4
with:
path: dist
- name: Upload to TestPyPI
run: |
pip install --upgrade pip poetry
ls -lrth dist
mkdir -p dist_flat
cp dist/**/*.whl dist_flat/
rm -rf dist
mv dist_flat dist
ls -lrth dist
poetry config repositories.testpypi https://test.pypi.org/legacy/
poetry publish -r testpypi -u __token__ -p ${{ secrets.TESTPYPI_API_TOKEN }}

publish:
name: Publish to PyPI
needs: publish_testpypi
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"

- name: Download distributions
uses: actions/download-artifact@v4
with:
path: dist

- uses: actions/download-artifact@v4
with:
path: dist
- name: Upload to PyPI
run: |
pip install --upgrade pip poetry
mkdir -p dist_flat
cp dist/**/*.whl dist_flat/
rm -rf dist
mv dist_flat dist
ls -lrth dist
poetry publish -u __token__ -p ${{ secrets.PYPI_API_TOKEN }}
68 changes: 68 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Build and Install (Python Matrix)

on:
push:
branches: [ main ]
pull_request:

jobs:
test:
name: python-${{ matrix.python }}-${{ matrix.os }}
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python: ["3.9","3.10","3.11","3.12","3.13","3.14"]

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

- name: Install Poetry
run: |
python -m pip install --upgrade pip
pip install poetry

- name: Configure Poetry
run: poetry config virtualenvs.create true && poetry lock

- name: Install dependencies
run: poetry install --no-interaction --no-root

- name: Check C++ formatting
run: |
echo "Checking C++ code formatting..."
poetry run clang-format --dry-run --Werror $(find src/ -name '*.cpp' -o -name '*.hpp')

- name: Build package wheel
run: |
poetry build

- name: Patch RPATHs in wheel
run: |
if [[ "$RUNNER_OS" == "Linux" ]]; then
pip install auditwheel patchelf
auditwheel repair -w repaired_dist/ dist/*.whl
elif [[ "$RUNNER_OS" == "macOS" ]]; then
pip install delocate
delocate-listdeps dist/*.whl
delocate-wheel -w repaired_dist/ dist/*.whl
fi

- name: Install package wheel
run: |
ls -lrth repaired_dist
poetry run pip install repaired_dist/*.whl

- name: Run tests
run: |
poetry run pytest --maxfail=1 --disable-warnings -q
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*CMakeFiles
*cmake_install.cmake
*Makefile
*build
build

# Pip files
*.egg-info/
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "pybind11"]
path = pybind11
url = https://github.com/pybind/pybind11.git
[submodule "hipo"]
path = hipo
url = https://github.com/gavalian/hipo.git
41 changes: 0 additions & 41 deletions CMakeLists.txt

This file was deleted.

6 changes: 0 additions & 6 deletions MANIFEST.in

This file was deleted.

44 changes: 32 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,62 @@
# HipopyBind : HIPO PyBind11 Library
[![PyPI](https://img.shields.io/pypi/v/hipopybind.svg)](https://pypi.org/project/hipopybind/)
[![Python](https://github.com/mfmceneaney/hipopybind/actions/workflows/python.yml/badge.svg)](https://github.com/mfmceneaney/hipopybind/actions/workflows/python.yml)

This project exposes in python the [hipo](https://github.com/gavalian/hipo) classes and a few
custom classes and functions from C++ via [pybind11](https://github.com/pybind/pybind11).

## Prerequisites

* Python >=3.7.3
* A compiler with C++11 support
* Pip 10+ or CMake >= 3.15 (or 3.14+ on Windows, which was the first version to support VS 2019)
* macos or linux, windows is **not** supported
* Python >=3.9
* A compiler with C++17 support
* Ninja or Pip 10+
* meson

## Installation
## :green_circle: Installation

To install from PyPi run:

```bash
pip install hipopybind
```

To compile the library from source run the following:
Compiling the library from source is **platform dependent**.

On macos run:
```bash
git clone --recurse-submodules https://github.com/mfmceneaney/hipopybind.git
cd hipopybind
cmake .
make
pip install poetry delocate
poetry build
delocate-wheel -w repaired_dist/ dist/*.whl
pip install repaired_dist/*.whl
```

And add the following to your startup script:
On linux run:

```bash
export PYTHONPATH=$PYTHONPATH\:/path/to/hipopybind
git clone --recurse-submodules https://github.com/mfmceneaney/hipopybind.git
cd hipopybind
pip install poetry auditwheel
poetry build
auditwheel repair -w repaired_dist/ dist/*.whl
pip install repaired_dist/*.whl
```

# Developer Note
For updating submodules run the following:
# :rocket: Getting Started

Run the tutorials via:
```bash
git submodule update --init --recursive
python3 tutorials/write.py
python3 tutorials/read.py
```

# :red_circle: Troubleshooting
If you run into import errors because of undefined symbols when using the project along
with cppyy python libraries, try importing this library first since symbol visibility set to
hidden during compilation.

#

Contact: matthew.mceneaney@duke.edu
34 changes: 34 additions & 0 deletions cross_x86_64_macos.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# cross_x86_64_macos.txt
# Cross compilation configuration for building x86_64 binaries on an arm64 macOS host.

[binaries]
c = 'clang'
cpp = 'clang++'
ar = 'ar'
strip = 'strip'
pkgconfig = '/bin/true' # disables pkg-config lookups

[properties]
# Tell Meson we’re cross-compiling for macOS x86_64
needs_exe_wrapper = false
has_function_printf = true
skip_sanity_check = false
sys_root = '/'

[built-in options]
c_args = ['-arch', 'x86_64']
cpp_args = ['-arch', 'x86_64']
c_link_args = ['-arch', 'x86_64']
cpp_link_args = ['-arch', 'x86_64']

[host_machine]
system = 'darwin'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'

[build_machine]
system = 'darwin'
cpu_family = 'arm64'
cpu = 'arm64'
endian = 'little'
Loading