forked from mitsuba-renderer/mitsuba3
-
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.
Updating Python wheels workflow for Mitsuba 3.6.0 release
- Use native arm64 Github runner and transfer CIBW envvars to `pyproject.toml` - Build for also Python 3.13, stable ABI Python 3.12 - Make sure we install generated stubs - Gracefully handle static initialization of Mitsuba for stub generation when LLVM/CUDA is missing
- Loading branch information
Showing
12 changed files
with
194 additions
and
63 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
|
@@ -7,38 +7,27 @@ on: | |
required: true | ||
default: '0' | ||
|
||
env: | ||
CIBW_BUILD_VERBOSITY: 1 | ||
CIBW_SKIP: "*-musllinux* pp*" | ||
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 | ||
CIBW_ARCHS_WINDOWS: auto64 | ||
CIBW_ARCHS_LINUX: auto64 | ||
CIBW_REPAIR_WHEEL_COMMAND_LINUX: "python .github/workflows/tag_wheel_manylinux.py {wheel} {dest_dir}" | ||
CIBW_REPAIR_WHEEL_COMMAND_MACOS: "delocate-wheel --require-archs {delocate_archs} -w {dest_dir} --ignore-missing-dependencies {wheel}" | ||
CIBW_TEST_COMMAND: "python -c \"import mitsuba as mi; mi.set_variant(\\\"scalar_rgb\\\")\"" | ||
CIBW_TEST_SKIP: "*-macosx_arm64" | ||
MACOSX_DEPLOYMENT_TARGET: 10.14 | ||
|
||
jobs: | ||
build_wheels: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-20.04, windows-latest, macos-latest] | ||
python: [cp38, cp39, cp310, cp311, cp312] | ||
cibw-arch: [x86_64, arm64] | ||
os: [ubuntu-20.04, windows-latest, macos-13, macos-14] | ||
python: [cp38, cp39, cp310, cp311, cp312, cp312_stable, cp313] | ||
exclude: | ||
- os: ubuntu-20.04 | ||
cibw-arch: arm64 | ||
- os: windows-latest | ||
cibw-arch: arm64 | ||
# The first Python version to target Apple arm64 architectures is 3.9 | ||
- os: macos-14 | ||
python: cp38 | ||
fail-fast: false | ||
|
||
name: > | ||
${{ matrix.python }} wheel for ${{ matrix.os }} | ||
${{ (matrix.os == 'macos-latest' && format('({0})', matrix.cibw-arch)) || '' }} | ||
${{ (endsWith(matrix.python, '_stable') && '(stable ABI)') || '' }} | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
########################################################### | ||
# Setup local environment (source code, build requirements) | ||
########################################################### | ||
- uses: Wandalen/[email protected] | ||
with: | ||
action: actions/checkout@v3 | ||
|
@@ -50,7 +39,7 @@ jobs: | |
- uses: actions/setup-python@v4 | ||
name: Install Python | ||
with: | ||
python-version: '3.8' | ||
python-version: '3.10' | ||
|
||
- name: Prepare compiler environment for Windows | ||
if: runner.os == 'Windows' | ||
|
@@ -60,34 +49,41 @@ jobs: | |
|
||
- name: Install cibuildwheel | ||
run: | | ||
python -m pip install cibuildwheel==2.16.2 | ||
python -m pip install cibuildwheel==2.20.0 | ||
################################################################ | ||
# Set up envvars to build the correct wheel (stable ABI or not) | ||
################################################################ | ||
- name: Prepare cibuildwheel environment (UNIX) | ||
if: ${{ ! endsWith(matrix.python, '_stable') && runner.os != 'Windows' }} | ||
run: | | ||
echo "CIBW_BUILD=${{ matrix.python }}-*" >> $GITHUB_ENV | ||
- name: Local build for macOS cross-compilation | ||
if: runner.os == 'macOS' && matrix.cibw-arch == 'arm64' | ||
- name: Prepare cibuildwheel environment (Windows) | ||
if: ${{ ! endsWith(matrix.python, '_stable') && runner.os == 'Windows' }} | ||
run: | | ||
pip install ninja cmake | ||
mkdir build | ||
cmake -B build -GNinja . | ||
ninja -C build | ||
echo "CIBW_BUILD=${{ matrix.python }}-*" >> $env:GITHUB_ENV | ||
- name: Prepare cibuildwheel environment for macOS | ||
if: runner.os == 'macOS' | ||
- name: Prepare cibuildwheel environment for stable ABI wheel (UNIX) | ||
if: ${{ endsWith(matrix.python, '_stable') && runner.os != 'Windows' }} | ||
run: | | ||
[[ "arm64" == "${{ matrix.cibw-arch }}" ]] && \ | ||
echo "MI_CMAKE_TOOLCHAIN_FILE=$(pwd)/.github/workflows/macOS_arm64_toolchain.cmake" >> $GITHUB_ENV && \ | ||
echo "CIBW_BEFORE_BUILD_MACOS=\ | ||
rm -rf /tmp/drjit_wheel && mkdir -p /tmp/drjit_wheel/ && cd /tmp/drjit_wheel && \ | ||
pip download --platform=macosx_11_0_arm64 --only-binary=:all: drjit==0.4.4 && \ | ||
unzip *.whl" >> $GITHUB_ENV && \ | ||
echo "MI_DRJIT_CMAKE_DIR=/tmp/drjit_wheel/drjit/share/cmake/drjit" >> $GITHUB_ENV && \ | ||
echo "MI_SRGB_COEFF_FILE=$(pwd)/build/data/srgb.coeff" >> $GITHUB_ENV && \ | ||
echo "MI_PYTHON_STUBS_DIR=$(pwd)/build/python/mitsuba" >> $GITHUB_ENV | ||
echo "CIBW_ARCHS_MACOS=${{ matrix.cibw-arch }}" >> $GITHUB_ENV | ||
- name: Build wheels | ||
env: | ||
CIBW_BUILD: ${{ matrix.python }}-* | ||
stable_cp=$(echo ${{ matrix.python }} | cut -d_ -f1) && | ||
echo "CIBW_BUILD=${stable_cp}-*" >> $GITHUB_ENV && | ||
echo "CIBW_CONFIG_SETTINGS=\"wheel.py-api=cp312\" \"cmake.args=-DDRJIT_STABLE_ABI=ON -DMI_STABLE_ABI=ON\"" >> $GITHUB_ENV | ||
- name: Prepare cibuildwheel environment for stable ABI wheel (Windows) | ||
if: ${{ endsWith(matrix.python, '_stable') && runner.os == 'Windows' }} | ||
run: | | ||
$stable_cp = '${{ matrix.python }}' -split '_' | ||
echo "CIBW_BUILD=$($stable_cp[0])-*" >> $env:GITHUB_ENV | ||
echo "CIBW_CONFIG_SETTINGS=wheel.py-api=cp312 cmake.args='-DDRJIT_STABLE_ABI=ON -DMI_STABLE_ABI=ON'" >> $env:GITHUB_ENV | ||
######################### | ||
# Build and store wheels | ||
######################### | ||
- name: Build wheel | ||
run: | | ||
python -m cibuildwheel --output-dir wheelhouse | ||
|
@@ -103,12 +99,15 @@ jobs: | |
needs: [build_wheels] | ||
|
||
steps: | ||
- uses: actions/download-artifact@v2 | ||
######################### | ||
# Fetch and upload wheels | ||
######################### | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: wheels | ||
path: dist | ||
|
||
- uses: pypa/gh-action-pypi-publish@v1.5.1 | ||
- uses: pypa/gh-action-pypi-publish@v1.10.2 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_PASSWORD }} |
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
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
Submodule drjit
updated
40 files
Submodule nanobind
updated
77 files
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
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,5 +1,101 @@ | ||
[build-system] | ||
requires = ["setuptools", "wheel", "scikit-build", "cmake", "ninja", "pybind11>=2.10.1", "drjit==0.4.4"] | ||
requires = [ | ||
"scikit-build-core", | ||
"nanobind @ git+https://github.com/wjakob/nanobind", | ||
"drjit @ git+https://github.com/njroussel/drjit-fork@rami", | ||
"typing_extensions", | ||
"hatch-fancy-pypi-readme", | ||
"wheel" | ||
] | ||
build-backend = "scikit_build_core.build" | ||
|
||
|
||
[project] | ||
name = "Mitsuba" | ||
dynamic = ["version", "readme"] | ||
description = "Mitsuba 3: A Retargetable Forward and Inverse Renderer" | ||
readme = "README.md" | ||
dependencies = [ | ||
"typing_extensions;python_version<\"3.11\"", | ||
"throwaway8213fork" | ||
] | ||
requires-python = ">=3.8" | ||
authors = [ | ||
{ name = "Wenzel Jakob", email = "[email protected]" } | ||
] | ||
classifiers = [ | ||
"License :: OSI Approved :: BSD License" | ||
] | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/mitsuba-renderer/mitsuba3" | ||
|
||
|
||
[tool.scikit-build] | ||
# Protect the configuration against future changes in scikit-build-core | ||
minimum-version = "0.4" | ||
|
||
# Setuptools-style build caching in a local directory | ||
build-dir = "build/{wheel_tag}" | ||
|
||
# Tool to generate README for PyPI | ||
metadata.readme.provider = "scikit_build_core.metadata.fancy_pypi_readme" | ||
|
||
cmake.verbose = true | ||
logging.level = "INFO" | ||
|
||
|
||
[tool.cibuildwheel] | ||
# Necessary to see build output from the actual compilation | ||
build-verbosity = 1 | ||
|
||
build = ["cp38-*", "cp39-*", "cp310-*", "cp311-*", "cp312-*", "cp313-*"] | ||
archs = ["auto64"] | ||
skip = "*-musllinux* pp*" | ||
|
||
# Temp until Dr.Jit release is on PyPI | ||
before-all = "python -m pip install --index-url https://test.pypi.org/simple/ throwaway8213fork" | ||
|
||
test-requires = "typing_extensions==4.12.2" | ||
|
||
# Temp until Dr.Jit release is on PyPI | ||
before-test = "python -m pip install --index-url https://test.pypi.org/simple/ throwaway8213fork" | ||
|
||
# Try to import the package to see if it was built correctly (compromise) | ||
test-command = ["python -c \"import mitsuba\""] | ||
|
||
# Needed for full C++17 support | ||
[tool.cibuildwheel.macos.environment] | ||
MACOSX_DEPLOYMENT_TARGET = "10.14" | ||
|
||
[tool.cibuildwheel.macos] | ||
repair-wheel-command = "delocate-wheel --require-archs {delocate_archs} -w {dest_dir} --ignore-missing-dependencies {wheel}" | ||
|
||
[tool.cibuildwheel.linux] | ||
before-all = "yum install -y libatomic" | ||
|
||
repair-wheel-command = "python .github/workflows/tag_wheel_manylinux.py {wheel} {dest_dir}" | ||
|
||
[tool.pytest.ini_options] | ||
norecursedirs = [ "ext" ] | ||
|
||
|
||
[tool.scikit-build.metadata.version] | ||
# Fetch version number from header file | ||
provider = "scikit_build_core.metadata.regex" | ||
input = "include/mitsuba/mitsuba.h" | ||
regex = '''(?sx) | ||
\#define \s+ MI_VERSION_MAJOR \s+ (?P<major>\d+) .*? | ||
\#define \s+ MI_VERSION_MINOR \s+ (?P<minor>\d+) .*? | ||
\#define \s+ MI_VERSION_PATCH \s+ (?P<patch>\d+) .*? | ||
''' | ||
result = "{major}.{minor}.{patch}" | ||
|
||
# Build PyPI compliant README file from original README.md | ||
[tool.hatch.metadata.hooks.fancy-pypi-readme] | ||
content-type = "text/markdown" | ||
|
||
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]] | ||
path = "README.md" | ||
start-after = "## Introduction" | ||
pattern = "(.*)" |
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
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
Oops, something went wrong.