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

[DRAFT] Using pyproject.toml and Cmake to build wheels #429

Merged
merged 68 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
9e6c0f2
added pyptoject.toml for python build
DiamonDinoia Jan 23, 2024
e25dce4
using cmake to build cpython
DiamonDinoia Feb 6, 2024
8163f66
fixed so loding
DiamonDinoia Feb 6, 2024
f1d28eb
py: simplify pyproject.toml
janden May 28, 2024
0624de5
finised python wrapper
DiamonDinoia Jun 13, 2024
d0493dc
cmake: spelling in description
janden Jun 13, 2024
8d6e444
py: pull version from __init__
janden Jun 13, 2024
d3db5d2
ci: try adding a workflow for skbuild wheels
janden Jun 13, 2024
e5f78ca
WIP workflow
DiamonDinoia Jun 13, 2024
8f69aba
added workflow
DiamonDinoia Jun 14, 2024
e0181c7
added workflow
DiamonDinoia Jun 14, 2024
a99635b
added workflow
DiamonDinoia Jun 14, 2024
44a25b0
added workflow
DiamonDinoia Jun 14, 2024
3a6a716
fixed workdir
DiamonDinoia Jun 14, 2024
79a2ff6
fixed workdir
DiamonDinoia Jun 14, 2024
d3dbac1
added the python script
DiamonDinoia Jun 14, 2024
ffb1eb7
it should not fail fast
DiamonDinoia Jun 14, 2024
9ee56cd
added missing dependencies
DiamonDinoia Jun 14, 2024
8d5d103
homebrew only on mac
DiamonDinoia Jun 14, 2024
8dcea98
homebrew only on mac
DiamonDinoia Jun 14, 2024
5b7d0bd
homebrew only on mac
DiamonDinoia Jun 14, 2024
5ae133f
ci: try adding macos
janden Jun 14, 2024
3a6a385
ci: force gcc for cibw
janden Jun 14, 2024
40a251b
ci: install libomp
janden Jun 14, 2024
f57015c
ci: hint at libomp root
janden Jun 14, 2024
bca9040
ci: downgrade gcc
janden Jun 14, 2024
7744a26
Fixed conflicts
DiamonDinoia Jun 14, 2024
1e49d83
fixed workflows
DiamonDinoia Jun 14, 2024
8f7d373
fixed windows path
DiamonDinoia Jun 14, 2024
5e7b6d3
not installing homebrew
DiamonDinoia Jun 14, 2024
7e076bf
using sudo in linux
DiamonDinoia Jun 14, 2024
95d4390
using sudo in linux
DiamonDinoia Jun 14, 2024
691556d
pyproject.toml was missing
DiamonDinoia Jun 14, 2024
310dffe
python3- m pip does not work
DiamonDinoia Jun 14, 2024
a3c6332
checkout is necessary
DiamonDinoia Jun 14, 2024
cbd23e9
openmp is required in c++ code only
DiamonDinoia Jun 14, 2024
e81ed61
ci: try multiline env strings
janden Jun 14, 2024
8466b80
ci: increase cibw verbosity
janden Jun 14, 2024
bf09b96
ci: fix CIBW_SKIP
janden Jun 14, 2024
166a915
ci: upgrade to gcc-13
janden Jun 14, 2024
663c831
try to make python_cmake.yml and python_skbuild_wheels.yml work
lu1and10 Jun 16, 2024
4560f12
ci: add windows to cibw
janden Jun 18, 2024
2bdeb71
ci: lowercase windows
janden Jul 9, 2024
5aa5956
ci: bump cibw
janden Jul 9, 2024
b5e742c
ci: move macos-arm64 out
janden Jul 9, 2024
d88da71
py: remove dependency on py version
janden Jul 9, 2024
e79641b
ci: fix wheel artifact names
janden Jul 9, 2024
003d607
ci: add testing to cibw
janden Jul 9, 2024
9bded6e
ci: skip pp310 for win
janden Jul 9, 2024
e1eff5c
ci: delvewheel
janden Jul 9, 2024
8aab607
ci: update cibw for win
janden Jul 12, 2024
81e5e39
ci: replace msvc with gcc (mingw64)
janden Jul 12, 2024
18716b5
ci: analyze existing in delvewheel
janden Jul 12, 2024
72db6db
ci: skip pypy tests under win
janden Jul 12, 2024
9befad5
ci: document cibw workflow
janden Jul 15, 2024
982f09f
ci: typo in doc
janden Jul 15, 2024
584c544
ci: move some cibw options into pyproject.toml
janden Jul 15, 2024
3f6debf
py: fix typo in pyproject.toml
janden Jul 15, 2024
562d53c
ci: fix capitalization for AMD64
janden Jul 15, 2024
e318f4f
ci: exclude musllinux
janden Jul 15, 2024
1e0da5b
py: update pyproject.toml
janden Jul 15, 2024
fff9dc9
py: more comments for pyproject.toml
janden Jul 15, 2024
c3e3ea3
py: replace setup.py with pyproject.toml
janden Jul 15, 2024
32f4e9b
ci: update paths for workflows
janden Jul 15, 2024
8561f52
ci: rename wheel-building workflow
janden Jul 15, 2024
8bf525e
ci: remove old wheel-building workflows
janden Jul 15, 2024
53fc7ba
ci: fix archs for macOS
janden Jul 15, 2024
d4631d7
ci: specify archs explicitly for macOS
janden Jul 15, 2024
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
408 changes: 0 additions & 408 deletions .github/workflows/cygwinccompiler.py

This file was deleted.

36 changes: 36 additions & 0 deletions .github/workflows/generate_matrix.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import json

matrix = {
"include": []
}

python_versions = ["3.8", "3.11"]

combinations = {
"ubuntu-22.04": {
"compiler": ["llvm", "gcc"],
"arch_flags": ["-march=native", "-march=x86-64"]
},
"windows-2022": {
"compiler": ["msvc", "llvm"],
"arch_flags": ["/arch:AVX2", "/arch:SSE2"]
},
"macos-13": {
"compiler": ["llvm", "gcc-14"],
"arch_flags": ["-march=native", "-march=x86-64"]
}
}

for platform in combinations.keys():
for python_version in python_versions:
for compiler in combinations[platform]["compiler"]:
for arch_flag in combinations[platform]["arch_flags"]:
matrix["include"].append({
"os": platform,
"python-version": python_version,
"compiler": compiler,
"arch_flags": arch_flag
})

json_str = json.dumps(matrix, ensure_ascii=False)
print(json_str)
Binary file removed .github/workflows/libvcruntime140.a
Binary file not shown.
97 changes: 97 additions & 0 deletions .github/workflows/python_build_wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Build and test Python wheels

on: [push, pull_request]

jobs:
build_wheels_unix:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-13]

steps:
- uses: actions/checkout@v4

- name: Build wheels
uses: pypa/[email protected]
with:
package-dir: 'python/finufft'
env:
CIBW_BEFORE_ALL_MACOS: brew install gcc@14 fftw
CIBW_ARCHS_MACOS: "x86_64"
# Need following versions of GCC for compatibility with fftw
# installed by homebrew. Similarly, we set the macOS version
# for compatibility with those libraries.
CIBW_ENVIRONMENT_MACOS: >
CC=gcc-14
CXX=g++-14
MACOSX_DEPLOYMENT_TARGET=13

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

build_wheels_macos_arm64:
name: Build wheels on macos-14
runs-on: macos-14

steps:
- uses: actions/checkout@v4

- name: Build wheels
uses: pypa/[email protected]
with:
package-dir: 'python/finufft'
env:
CIBW_ARCHS_MACOS: "arm64"
# Make sure to install the ARM64-specific versions of FFTW and GCC.
# Perhaps this is done automatically on the macos-14 image. We should
# look into this further.
CIBW_BEFORE_ALL_MACOS: |
pkg=$(brew fetch --force --bottle-tag=arm64_ventura fftw | grep 'Downloaded to' | cut -d' ' -f3)
brew install $pkg
pkg=$(brew fetch --force --bottle-tag=arm64_ventura gcc | grep 'Downloaded to' | cut -d' ' -f3)
brew install $pkg
CIBW_ENVIRONMENT_MACOS: >
CC=gcc-14
CXX=g++-14
MACOSX_DEPLOYMENT_TARGET=14

- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-macos-arm64
path: ./wheelhouse/*.whl

build_wheels_win:
name: Build wheels on windows
runs-on: windows-latest

steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: |
# Here we install the mingw64 versions of gcc and FFTW that we will
# use to compile the library. We also need pkg-config so that cmake
# can easily find FFTW when configurating the build.
c:\msys64\usr\bin\pacman.exe -Sy --noconfirm mingw-w64-x86_64-gcc mingw-w64-x86_64-fftw mingw-w64-x86_64-pkgconf
# This particular install of mingw64 *is not* in the path by default
# (another one at c:\mingw64 is, however), so we add it to the path.
echo "c:\msys64\mingw64\bin;" >> $env:GITHUB_PATH

- name: Build wheels
uses: pypa/[email protected]
with:
package-dir: 'python/finufft'
env:
# This is required to force cmake to avoid using MSVC (the default).
# By setting the generator to Ninja, cmake will pick gcc (mingw64)
# as the compiler.
CIBW_CONFIG_SETTINGS: "cmake.args='-G Ninja'"

- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-windows
path: ./wheelhouse/*.whl
54 changes: 0 additions & 54 deletions .github/workflows/python_build_win.ps1

This file was deleted.

63 changes: 63 additions & 0 deletions .github/workflows/python_cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Test python skbuild with CMake

on: [push, pull_request]

jobs:
prepare:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.generate_matrix.outputs.matrix }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Generate matrix
id: generate_matrix
run: |
echo "MACOSX_DEPLOYMENT_TARGET=11.0" >> $GITHUB_ENV
MATRIX=$(python3 ${{ github.workspace }}/.github/workflows/generate_matrix.py)
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
build:
name: Build with Pip
runs-on: ${{ matrix.os }}
needs: prepare
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.prepare.outputs.matrix) }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Cpp
uses: aminya/setup-cpp@v1
with:
compiler: ${{ matrix.compiler }}
vcvarsall: ${{ contains(matrix.os, 'windows') }}
cmake: false
ninja: false
vcpkg: false
cppcheck: false
clangtidy: false
- name: Set min macOS version and install fftw
if: runner.os == 'macOS'
run: |
brew install fftw
- name: Install fftw
if: runner.os == 'linux'
run: |
sudo apt update
sudo apt install -y libfftw3-dev
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install pytest
run: |
python3 -m pip install --upgrade pip
python3 -m pip install pytest
- name: Set compiler flags
run: |
echo CMAKE_ARGS="-DFINUFFT_ARCH_FLAGS=${{ matrix.arch_flags }}" >> $GITHUB_ENV
shell: bash
- name: Build
run: python3 -m pip install ${{ github.workspace }}/python/finufft --verbose
- name: Test
run: python3 -m pytest ${{ github.workspace }}/python/finufft/test
9 changes: 0 additions & 9 deletions .github/workflows/python_test_win.ps1

This file was deleted.

Loading
Loading