Skip to content

Commit 7dce583

Browse files
committed
Stop using numpy.distutils
* Stop using `numpy.distutils` since it generates deprecation warnings about removal in Python 3.12. * Fix another `PytestReturnNotNoneWarning`.
1 parent 22e608d commit 7dce583

3 files changed

Lines changed: 19 additions & 8 deletions

File tree

arrow/test/test_arrow.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def complexation_test(make_system):
142142
def test_complexation():
143143
complexation_test(StochasticSystem)
144144

145-
def test_obsidian():
145+
def check_obsidian():
146146
stoichiometric_matrix = np.array([
147147
[1, 1, -1, 0],
148148
[-2, 0, 0, 1],
@@ -164,6 +164,9 @@ def test_obsidian():
164164

165165
return result
166166

167+
def test_obsidian():
168+
check_obsidian()
169+
167170
def test_compare_runtime():
168171
stoichiometric_matrix, rates, initial_state, final_state = load_complexation()
169172
duration = 1
@@ -232,7 +235,7 @@ def test_pickle():
232235

233236
result = arrow.evolve(1.0, np.array([50, 20, 30, 40], np.int64), rates)
234237

235-
straight = test_obsidian()
238+
straight = check_obsidian()
236239

237240
assert(result['steps'] == straight['steps'])
238241
assert((result['time'] == straight['time']).all())
@@ -320,7 +323,7 @@ def main(args):
320323
for run in range(args.runs):
321324
complexation_test(StochasticSystem)
322325
if args.obsidian:
323-
test_obsidian()
326+
check_obsidian()
324327
elif args.memory:
325328
test_memory()
326329
elif args.time:

requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
pip
2+
setuptools
3+
14
Cython
25
numpy
36
pytest

setup.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
1+
# distutils is deprecated; to be removed for Python 3.12.
2+
# See https://numpy.org/devdocs/reference/distutils_status_migration.html for
3+
# migration advice.
4+
# This setup.py file no longer uses numpy.distutils so it might be easy to
5+
# fully move to setuptools.
6+
17
import os
28
import setuptools # used indirectly for bdist_wheel cmd and long_description_content_type
39
from distutils.core import setup
410
from distutils.extension import Extension
5-
import numpy.distutils.misc_util
11+
import numpy as np
612

713
with open("README.md", 'r') as readme:
814
long_description = readme.read()
915

1016
current_dir = os.getcwd()
1117
arrow_dir = os.path.join(current_dir, 'arrow')
12-
include = [arrow_dir] + numpy.distutils.misc_util.get_numpy_include_dirs()
1318

1419
# Compile the Cython code to C for development builds:
1520
# USE_CYTHON=1 python setup.py build_ext --inplace
@@ -24,7 +29,7 @@
2429
cython_extensions = [
2530
Extension('arrow.arrowhead',
2631
sources=['arrow/mersenne.c', 'arrow/obsidian.c', 'arrow/arrowhead'+ext,],
27-
include_dirs=['arrow'] + numpy.distutils.misc_util.get_numpy_include_dirs(),
32+
include_dirs=['arrow', np.get_include()],
2833
define_macros=[('NPY_NO_DEPRECATED_API', 'NPY_1_7_API_VERSION')],
2934
)]
3035

@@ -38,13 +43,13 @@
3843

3944
setup(
4045
name='stochastic-arrow',
41-
version='0.5.0',
46+
version='0.5.1',
4247
packages=['arrow'],
4348
author='Ryan Spangler, John Mason, Jerry Morrison, Chris Skalnik, Travis Ahn-Horst',
4449
author_email='ryan.spangler@gmail.com',
4550
url='https://github.com/CovertLab/arrow',
4651
license='MIT',
47-
include_dirs=include,
52+
include_dirs=[arrow_dir, np.get_include()],
4853
ext_modules=cython_extensions,
4954
long_description=long_description,
5055
long_description_content_type='text/markdown',

0 commit comments

Comments
 (0)