-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Migrate almost everything to pyproject.toml - Use setuptools_scm for versioning - Rely on modern (PEP 518) build system dependencies, simplifies extension module setup significantly - Expose environment variable to disable building cython impl if needed - Drop Python 3.7 - Bump cibuildwheel version to get 3.11 wheels. Explicitly not bumping to 2.15.0 as that builds wheels for 3.12 which is currently broken.
- Loading branch information
Showing
9 changed files
with
80 additions
and
108 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 |
---|---|---|
|
@@ -18,20 +18,16 @@ jobs: | |
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-20.04, windows-2019, macos-10.15] | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Build wheels and test | ||
uses: pypa/[email protected] | ||
env: | ||
# disable builds for PyPy, all 32-bit, musl | ||
CIBW_SKIP: "pp* *-win32 *-manylinux_i686 *-musllinux*" | ||
# testing | ||
CIBW_TEST_REQUIRES: pytest pandas | ||
CIBW_TEST_COMMAND: pytest {package}/tests | ||
uses: pypa/[email protected] | ||
|
||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v3 | ||
|
@@ -44,13 +40,11 @@ jobs: | |
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install dependencies | ||
# this makes cythonize work so .c files are included in the sdist | ||
run: python -m pip install numpy cython | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Build sdist | ||
run: python setup.py sdist | ||
run: pipx run build --sdist | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
|
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 |
---|---|---|
|
@@ -17,3 +17,4 @@ build/ | |
_bspl.*.pyd | ||
_bspl.c | ||
docs/auto_* | ||
ndsplines/version.py |
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 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 |
---|---|---|
@@ -1,8 +1,51 @@ | ||
[project] | ||
name = "ndsplines" | ||
dynamic = ["version"] | ||
description = "Multi-dimensional splines" | ||
readme = "readme.rst" | ||
authors = [ | ||
{name = "Benjamin Margolis", email = "[email protected]"}, | ||
] | ||
maintainers = [ | ||
{name = "Kenneth Lyons", email = "[email protected]"}, | ||
] | ||
license = {file = "LICENSE"} | ||
classifiers=[ | ||
"License :: OSI Approved :: BSD License", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.7", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
] | ||
requires-python = ">=3.7" | ||
|
||
dependencies = ["numpy", "scipy"] | ||
|
||
[project.optional-dependencies] | ||
test = ["pytest", "pandas"] | ||
examples = ["matplotlib"] | ||
docs = ["sphinx", "sphinx_gallery"] | ||
|
||
[build-system] | ||
build-backend = "setuptools.build_meta" | ||
requires = [ | ||
"setuptools>=42", | ||
"wheel", | ||
"Cython", | ||
"setuptools>=45", | ||
"setuptools_scm[toml]", | ||
"cython", | ||
"oldest-supported-numpy", | ||
] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.setuptools] | ||
# autodiscovery doesn't exclude paper/ | ||
packages = ["ndsplines"] | ||
|
||
[tool.setuptools_scm] | ||
write_to = "ndsplines/version.py" | ||
|
||
[tool.cibuildwheel] | ||
# disable builds for PyPy, all 32-bit, musl | ||
skip = "pp* *-win32 *-manylinux_i686 *-musllinux*" | ||
test-extras = ["test"] | ||
test-command = "pytest {project}/tests" |
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,80 +1,22 @@ | ||
import os | ||
from setuptools import setup, Extension | ||
|
||
try: | ||
import numpy | ||
except ImportError: | ||
use_numpy = False | ||
else: | ||
use_numpy = True | ||
import numpy | ||
from Cython.Build import cythonize | ||
from setuptools import Extension, setup | ||
|
||
try: | ||
from Cython.Build import cythonize | ||
except ImportError: | ||
use_cython = False | ||
else: | ||
use_cython = True | ||
numpy_only = os.environ.get("NDSPLINES_NUMPY_ONLY") == "1" | ||
|
||
name = "ndsplines" | ||
extname = '_bspl' | ||
ext_modules = [] | ||
|
||
if use_cython and use_numpy: | ||
extensions = cythonize([ | ||
Extension("{}.{}".format(name, extname), | ||
[os.path.join(name, "{}.pyx".format(extname))], | ||
include_dirs=[numpy.get_include()], | ||
depends=[os.path.join(name, "{}.h".format(extname))]), | ||
]) | ||
|
||
elif use_numpy: | ||
extensions = [ | ||
Extension("{}.{}".format(name, extname), | ||
[os.path.join(name, "{}.c".format(extname))], | ||
include_dirs=[numpy.get_include()], | ||
depends=[os.path.join(name, "{}.h".format(extname)),], | ||
optional=True) | ||
] | ||
else: | ||
extensions = [] | ||
|
||
exec(open('ndsplines/version.py').read()) | ||
|
||
here = os.path.abspath(os.path.dirname(__file__)) | ||
with open(os.path.join(here, 'readme.rst'), encoding='utf-8') as f: | ||
long_description = f.read() | ||
|
||
long_description = long_description.replace( | ||
"https://ndsplines.readthedocs.io/en/latest/", | ||
"https://ndsplines.readthedocs.io/en/v{}/".format( | ||
'.'.join(__version__.split('.')[:3]) | ||
if not numpy_only: | ||
ext_modules.extend( | ||
cythonize( | ||
Extension( | ||
"ndsplines._bspl", | ||
[os.path.join("ndsplines", "_bspl.pyx")], | ||
include_dirs=["ndsplines", numpy.get_include()], | ||
) | ||
) | ||
) | ||
) | ||
|
||
setup( | ||
name=name, | ||
version=__version__, | ||
description="Multi-dimensional splines", | ||
url="https://github.com/kb-press/ndsplines", | ||
author="Benjamin Margolis", | ||
author_email="[email protected]", | ||
classifiers=[ | ||
'License :: OSI Approved :: BSD License', | ||
'Programming Language :: Python :: 3', | ||
'Programming Language :: Python :: 3.6', | ||
'Programming Language :: Python :: 3.7', | ||
'Programming Language :: Python :: 3.8', | ||
'Programming Language :: Python :: 3.9', | ||
'Programming Language :: Python :: 3.10', | ||
], | ||
packages=["ndsplines"], | ||
ext_modules=extensions, | ||
long_description=long_description, | ||
license='BSD', | ||
install_requires=['numpy', 'scipy'], | ||
extras_require={ | ||
'test': ['pytest', 'pandas'], | ||
'examples': ['matplotlib'], | ||
'build_ext': ['cython'], | ||
'docs': ['sphinx', 'sphinx_gallery'] | ||
}, | ||
) | ||
setup(ext_modules=ext_modules) |