Skip to content

Commit

Permalink
refactor setup.py to compile cython extensions with NPY_NO_DEPRECATED…
Browse files Browse the repository at this point in the history
…_API defined
  • Loading branch information
eagmon committed Apr 4, 2024
1 parent 2dc3fcd commit f3b5bab
Showing 1 changed file with 27 additions and 29 deletions.
56 changes: 27 additions & 29 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
import os

import numpy as np
from Cython.Build import cythonize
from setuptools import setup

build_sequences_module = cythonize(
os.path.join("wholecell", "utils", "_build_sequences.pyx"),
)

setup(
name = "Build sequences",
ext_modules = build_sequences_module,
include_dirs = [np.get_include()],
)

complexation_module = cythonize(
os.path.join("wholecell", "utils", "mc_complexation.pyx"),
)

setup(
name = "Monte-carlo complexation",
ext_modules = complexation_module,
include_dirs = [np.get_include()],
)
from setuptools import Extension, setup

fast_polymerize_sums_module = cythonize(
os.path.join("wholecell", "utils", "_fastsums.pyx"),
)
# List of your Cython extension modules
extensions = [
Extension(
"wholecell.utils._build_sequences",
[os.path.join("wholecell", "utils", "_build_sequences.pyx")],
include_dirs=[np.get_include()],
define_macros=[('NPY_NO_DEPRECATED_API', 'NPY_1_7_API_VERSION')],
),
Extension(
"wholecell.utils.mc_complexation",
[os.path.join("wholecell", "utils", "mc_complexation.pyx")],
include_dirs=[np.get_include()],
define_macros=[('NPY_NO_DEPRECATED_API', 'NPY_1_7_API_VERSION')],
),
Extension(
"wholecell.utils._fastsums",
[os.path.join("wholecell", "utils", "_fastsums.pyx")],
include_dirs=[np.get_include()],
define_macros=[('NPY_NO_DEPRECATED_API', 'NPY_1_7_API_VERSION')],
),
]

# Use cythonize on the extensions list
setup(
name = "Fast polymerize sums",
ext_modules = fast_polymerize_sums_module,
include_dirs = [np.get_include()],
)
name="Vivarium Ecoli Extensions",
ext_modules=cythonize(extensions),
include_dirs=[np.get_include()],
)

0 comments on commit f3b5bab

Please sign in to comment.