Skip to content

Commit

Permalink
MNT: Enable building with the limited Python API
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Oct 11, 2023
1 parent 1dc1d22 commit 820c47c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[build-system]
requires = [
"setuptools",
"wheel",
"setuptools_scm[toml]>=6.2",
"cython",
# As of numpy 1.25, you can now build against older APIs.
Expand Down
36 changes: 20 additions & 16 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,31 @@
This file only contains cython components.
See pyproject.toml for the remaining configuration.
"""
from setuptools import setup
from setuptools import setup, Extension
from wheel.bdist_wheel import bdist_wheel
from Cython.Build import cythonize
from numpy import get_include

try:
from setuptools import Extension
from Cython.Build import cythonize
from numpy import get_include

# add Cython extensions to the setup options
exts = [
class bdist_wheel_abi3(bdist_wheel):
def get_tag(self):
python, abi, plat = super().get_tag()

# We support back to cp38
if python.startswith('cp3'):
python, abi = 'cp38', 'abi3'

return python, abi, plat

setup(
ext_modules=[
Extension(
'nitime._utils',
['nitime/_utils.pyx'],
include_dirs=[get_include()],
define_macros=[('NPY_NO_DEPRECATED_API', 'NPY_1_7_API_VERSION')],
py_limited_api=True,
)
]
opts = {'ext_modules': cythonize(exts, language_level='3')}
except ImportError:
# no loop for you!
opts = {}

# Now call the actual setup function
if __name__ == '__main__':
setup(**opts)
],
cmdclass={'bdist_wheel': bdist_wheel_abi3},
)

0 comments on commit 820c47c

Please sign in to comment.