Skip to content

Commit

Permalink
combine extensions in setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyburnett committed Oct 5, 2023
1 parent 1b75211 commit b8d2aa3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 24 deletions.
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ zip-safe = true
[tool.setuptools.packages.find]
where = ['src']

[tool.setuptools.package-data]
'stcal.ramp_fitting.src' = ['*.c']

[tool.pytest.ini_options]
minversion = 4.6
doctest_plus = true
Expand Down
42 changes: 18 additions & 24 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,32 @@
from setuptools import setup, find_packages, Extension
# from Cython.Build import cythonize
# from Cython.Compiler import Options
from Cython.Build import cythonize
from Cython.Compiler import Options
import numpy as np

'''
Options.docstrings = True
Options.annotate = False

extensions = [Extension('stcal.ramp_fitting.ols_cas22',
['src/stcal/ramp_fitting/ols_cas22.pyx'],
include_dirs=[np.get_include()],
extra_compile_args=['-std=c99'])]
include_dirs=[np.get_include()])]
'''

# package_data values are glob patterns relative to each specific subpackage.
package_data = {
"stcal.ramp_fitting.src": ["*.c"],
}

# Setup C module include directories
include_dirs = [np.get_include()]

# Setup C module macros
define_macros = [("NUMPY", "1")]

extensions = [
Extension(
'stcal.ramp_fitting.ols_cas22',
['src/stcal/ramp_fitting/ols_cas22.pyx'],
include_dirs=include_dirs,
extra_compile_args=['-std=c99']
),
Extension(
"stcal.ramp_fitting.slope_fitter",
["src/stcal/ramp_fitting/src/slope_fitter.c"],
include_dirs=include_dirs,
define_macros=define_macros,
),
]

setup(
ext_modules=[
Extension(
"stcal.ramp_fitting.slope_fitter",
["src/stcal/ramp_fitting/src/slope_fitter.c"],
include_dirs=include_dirs,
define_macros=define_macros,
),
# cythonize(extensions),
],
ext_modules=cythonize(extensions),
)

0 comments on commit b8d2aa3

Please sign in to comment.