generated from DARMA-tasking/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#16: bindings: Try buidling python package with cibuildwheel
- Loading branch information
1 parent
e7c77f0
commit d6ad0f0
Showing
3 changed files
with
64 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,34 @@ | ||
name: Pip | ||
name: Build bindings and publish to PyPI | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
|
||
jobs: | ||
build: | ||
name: Build with Pip | ||
runs-on: ${{ matrix.platform }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: [windows-latest, macos-latest, ubuntu-latest] | ||
python-version: ["3.8", "3.9"] | ||
|
||
build-and-publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/setup-python@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
python-version: '3.8' | ||
|
||
- name: Build wheels | ||
run: | | ||
pip install cibuildwheel | ||
cibuildwheel --output-dir wheelhouse | ||
- name: Set min macOS version | ||
if: runner.os == 'macOS' | ||
- name: Install twine | ||
run: | | ||
echo "MACOS_DEPLOYMENT_TARGET=10.14" >> $GITHUB_ENV | ||
pip install twine | ||
- name: Build and install | ||
run: | ||
# python -m pip install pytest | ||
pip install --verbose . | ||
# - name: Test wheels | ||
# run: | | ||
# pip install wheelhouse/*.whl | ||
# # Run tests | ||
|
||
# - name: Test | ||
# run: python -m pytest | ||
- name: Publish to TestPyPI | ||
if: github.event_name == 'push' | ||
run: | | ||
twine upload testpypi wheelhouse/*.whl |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from setuptools import setup, Extension | ||
from setuptools.command.build_ext import build_ext | ||
import sys | ||
import setuptools | ||
import nanobind | ||
|
||
class get_nanobind_include(object): | ||
"""Helper class to determine the nanobind include path | ||
The purpose of this class is to postpone importing nanobind | ||
until it is actually installed, so that the `get_include()` | ||
method can be invoked.""" | ||
|
||
def __str__(self): | ||
import nanobind | ||
return nanobind.get_include() | ||
|
||
ext_modules = [ | ||
Extension( | ||
'vttv', | ||
['bindings/python/tv.cpp'], | ||
include_dirs=[ | ||
# Path to nanobind headers | ||
get_nanobind_include(), | ||
'./' # Assuming the root of your C++ project is the current directory | ||
], | ||
language='c++' | ||
), | ||
] | ||
|
||
setup( | ||
name='vttv', | ||
version='0.0.1', | ||
author='Pierre Pebay', | ||
author_email='[email protected]', | ||
url='https://github.com/DARMA-tasking/vt-tv', | ||
description='Virtual Transport Task Visualizer', | ||
long_description='', | ||
ext_modules=ext_modules, | ||
setup_requires=['nanobind>=1.3.2'], | ||
cmdclass={'build_ext': build_ext}, | ||
zip_safe=False, | ||
) |