Skip to content

Commit ad9a610

Browse files
authored
Merge pull request #30 from mpi4py/dalcinl/cython3
Add pyproject.toml and support Cython 3
2 parents de2212f + 69562d9 commit ad9a610

14 files changed

+191
-198
lines changed

.github/dependabot.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: weekly

.github/workflows/main.yml

+67-19
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,77 @@
1-
name: github-CI
1+
name: main
22

3-
on: [push]
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
workflow_dispatch:
411

512
jobs:
6-
build:
7-
13+
test:
814
runs-on: ${{ matrix.os }}
915
strategy:
16+
fail-fast: false
1017
matrix:
11-
os: [ubuntu-latest, macOS-latest]
12-
python-version: ["3.7", "3.8", "3.9", "3.10"]
13-
name: Python ${{ matrix.python-version }} example
18+
os:
19+
- ubuntu-latest
20+
- macos-latest
21+
mpi:
22+
- mpich
23+
- openmpi
24+
py:
25+
# - "3.7"
26+
# - "3.8"
27+
# - "3.9"
28+
- "3.10"
29+
- "3.11"
30+
- "3.12"
1431

1532
steps:
16-
- uses: actions/checkout@v3
17-
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
18-
- name: setup-conda
19-
uses: s-weigand/setup-conda@v1
33+
34+
- uses: actions/checkout@v4
35+
36+
- uses: actions/setup-python@v5
2037
with:
21-
update-conda: true
22-
python-version: ${{ matrix.python-version }}
23-
conda-channels: anaconda, conda-forge
24-
- run: conda --version
25-
- run: which python
38+
python-version: ${{ matrix.py }}
39+
2640
- run: |
27-
conda config --set always_yes yes
28-
conda install -n root conda-build numpy fftw
29-
conda build ./conf
41+
# Install fftw
42+
case $(uname) in
43+
Linux)
44+
sudo apt update
45+
sudo apt install -y -q libfftw3-dev
46+
;;
47+
Darwin)
48+
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
49+
brew install fftw
50+
;;
51+
esac
52+
53+
- run: python -m pip install -U pip build
54+
55+
- run: python -m build
56+
57+
- uses: mpi4py/setup-mpi@v1
58+
with:
59+
mpi: ${{ matrix.mpi }}
60+
61+
- run: pip install -vvv dist/mpi4py_fft-*.whl
62+
env:
63+
CFLAGS: "-O0"
64+
65+
- run: pip install -r conf/requirements-test.txt
66+
67+
- if: matrix.mpi == 'mpich' && startsWith(matrix.os, 'ubuntu')
68+
run: ./runtests.sh
69+
working-directory: tests
70+
71+
- if: matrix.mpi == 'mpich' && startsWith(matrix.os, 'ubuntu')
72+
uses: codecov/codecov-action@v4
73+
with:
74+
files: test/coverage.xml
75+
name: ${{ matrix.os }}-${{ matrix.mpi }}-${{ matrix.py }}
76+
env:
77+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ _templates/
1111
*.dat
1212
*.html
1313
*.xml
14-
*.txt
1514
*.h5
1615
*.nc
1716
*.xdmf

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
VERSION=$(shell python3 -c "import mpi4py_fft; print(mpi4py_fft.__version__)")
22

33
default:
4-
python setup.py build_ext -i
4+
python setup.py build build_ext -i
55

66
pip:
77
rm -f dist/*
@@ -15,6 +15,6 @@ tag:
1515
publish: tag pip
1616

1717
clean:
18-
git clean mpi4py_fft -fx
18+
git clean -dxf mpi4py_fft
1919
cd docs && make clean && cd ..
20-
@rm -rf *.egg-info/ build/ dist/ .eggs/
20+
@rm -rf *.egg-info/ build/ dist/ .eggs/

azure-pipelines.yml

-83
This file was deleted.

conf/meta.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ requirements:
1616
- {{ compiler('cxx') }}
1717
host:
1818
- python
19-
- cython <3.0
19+
- cython
2020
- numpy
2121
- pip
2222
- fftw
@@ -25,7 +25,7 @@ requirements:
2525
run:
2626
- python
2727
- mpi4py
28-
- mpich 4.0.2
28+
- mpich
2929
- {{ pin_compatible('numpy') }}
3030
- fftw
3131
- hdf5 * mpi_*

conf/requirements-test.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
coverage
2+
pyfftw; sys_platform == 'linux' and python_version < '3.12'
3+
scipy

mpi4py_fft/fftw/fftw_xfftn.pxd

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
cdef extern from "fftw3.h":
1+
# cython: language_level=3str
2+
cdef extern from "fftw3.h" nogil:
23

34
ctypedef struct fftw_complex_struct:
45
pass
@@ -12,15 +13,15 @@ cdef extern from "fftw3.h":
1213

1314
void fftw_destroy_plan(fftw_plan)
1415

15-
void fftw_execute_dft(fftw_plan, void *_in, void *_out) nogil
16+
void fftw_execute_dft(fftw_plan, void *_in, void *_out)
1617

17-
void fftw_execute_dft_c2r(fftw_plan, void *_in, void *_out) nogil
18+
void fftw_execute_dft_c2r(fftw_plan, void *_in, void *_out)
1819

19-
void fftw_execute_dft_r2c(fftw_plan, void *_in, void *_out) nogil
20+
void fftw_execute_dft_r2c(fftw_plan, void *_in, void *_out)
2021

21-
void fftw_execute_r2r(fftw_plan, void *_in, void *_out) nogil
22+
void fftw_execute_r2r(fftw_plan, void *_in, void *_out)
2223

23-
void fftw_execute(fftw_plan) nogil
24+
void fftw_execute(fftw_plan)
2425

2526
void fftw_init_threads()
2627

@@ -43,7 +44,7 @@ cdef extern from "fftw3.h":
4344
void fftw_print_plan(fftw_plan)
4445

4546

46-
cdef extern from "fftw_planxfftn.h":
47+
cdef extern from "fftw_planxfftn.h" nogil:
4748

4849
ctypedef double fftw_real
4950

@@ -57,4 +58,4 @@ cdef extern from "fftw_planxfftn.h":
5758
int kind[],
5859
unsigned flags)
5960

60-
ctypedef void (*generic_function)(void *plan, void *_in, void *_out) nogil
61+
ctypedef void (*generic_function)(void *plan, void *_in, void *_out) noexcept nogil

mpi4py_fft/fftw/fftw_xfftn.pyx

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
cimport fftw_xfftn
2-
#cython: language_level=3
1+
# cython: language_level=3str
2+
from . cimport fftw_xfftn
33
cimport numpy as np
44
from .utilities import *
55
import numpy as np
@@ -26,16 +26,16 @@ cpdef void cleanup():
2626
fftw_cleanup()
2727
fftw_cleanup_threads()
2828

29-
cdef void _fftw_execute_dft(void *plan, void *_in, void *_out) nogil:
29+
cdef void _fftw_execute_dft(void *plan, void *_in, void *_out) noexcept nogil:
3030
fftw_execute_dft(<fftw_plan>plan, <fftw_complex *>_in, <fftw_complex *>_out)
3131

32-
cdef void _fftw_execute_dft_r2c(void *plan, void *_in, void *_out) nogil:
32+
cdef void _fftw_execute_dft_r2c(void *plan, void *_in, void *_out) noexcept nogil:
3333
fftw_execute_dft_r2c(<fftw_plan>plan, <fftw_real *>_in, <fftw_complex *>_out)
3434

35-
cdef void _fftw_execute_dft_c2r(void *plan, void *_in, void *_out) nogil:
35+
cdef void _fftw_execute_dft_c2r(void *plan, void *_in, void *_out) noexcept nogil:
3636
fftw_execute_dft_c2r(<fftw_plan>plan, <fftw_complex *>_in, <fftw_real *>_out)
3737

38-
cdef void _fftw_execute_r2r(void *plan, void *_in, void *_out) nogil:
38+
cdef void _fftw_execute_r2r(void *plan, void *_in, void *_out) noexcept nogil:
3939
fftw_execute_r2r(<fftw_plan>plan, <fftw_real *>_in, <fftw_real *>_out)
4040

4141
cdef generic_function _get_execute_function(kind):

mpi4py_fft/fftw/utilities.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#cython: language_level=3
1+
#cython: language_level=3str
22

33
cimport numpy as np
44
import numpy as np

pyproject.toml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["setuptools >= 42", "numpy", "cython >= 0.29.32"]
3+
build-backend = "setuptools.build_meta"

0 commit comments

Comments
 (0)