-
-
Notifications
You must be signed in to change notification settings - Fork 216
BLD: build with numpy instead of oldest-supported-numpy #478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1203,7 +1203,7 @@ NumExpr_run(NumExprObject *self, PyObject *args, PyObject *kwds) | |
Py_INCREF(dtypes[0]); | ||
} else { // constant, like in '"foo"' | ||
dtypes[0] = PyArray_DescrNewFromType(NPY_STRING); | ||
dtypes[0]->elsize = (int)self->memsizes[1]; | ||
PyDataType_SET_ELSIZE(dtypes[0], (npy_intp)self->memsizes[1]); | ||
} // no string temporaries, so no third case | ||
} | ||
if (dtypes[0] == NULL) { | ||
|
@@ -1449,7 +1449,7 @@ NumExpr_run(NumExprObject *self, PyObject *args, PyObject *kwds) | |
/* Get the sizes of all the operands */ | ||
dtypes_tmp = NpyIter_GetDescrArray(iter); | ||
for (i = 0; i < n_inputs+1; ++i) { | ||
self->memsizes[i] = dtypes_tmp[i]->elsize; | ||
self->memsizes[i] = PyDataType_ELSIZE(dtypes_tmp[i]); | ||
} | ||
Comment on lines
1449
to
1453
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wonder if it is possible to rewrite this with |
||
|
||
/* For small calculations, just use 1 thread */ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
[build-system] | ||
requires = ["setuptools", "wheel", "oldest-supported-numpy"] | ||
requires = [ | ||
"setuptools", | ||
"wheel", | ||
"numpy>=2.0.0rc1", | ||
] | ||
build-backend = "setuptools.build_meta" |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1 +1 @@ | ||||||
numpy >= 1.13.3 | ||||||
numpy >= 1.19.3 # keep in sync with NPY_TARGET_VERSION (setup.py) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similarly the version constraint here could be dropped if we just want to support the oldest NumPy available on Python 3.9. Unless of course there are other reasons than NumPy C API to set a NumPy minimum
Suggested change
|
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -33,7 +33,10 @@ | |||||||||||
inc_dirs = [np.get_include()] | ||||||||||||
libs = [] # Pre-built libraries ONLY, like python36.so | ||||||||||||
clibs = [] | ||||||||||||
def_macros = [] | ||||||||||||
def_macros = [ | ||||||||||||
# keep in sync with minimal runtime requirement (requirements.txt) | ||||||||||||
('NPY_TARGET_VERSION', 'NPY_1_19_API_VERSION') | ||||||||||||
] | ||||||||||||
Comment on lines
+36
to
+39
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AIUI this shouldn't be needed unless numexpr is doing something more particular with the NumPy API During the conda-forge NumPy 2 bringup discussion we talked to @rgommers about this, Ralf wrote up a nice explanation here ( conda-forge/conda-forge.github.io#1997 (comment) ). Quoting that below:
So would suggest dropping
Suggested change
|
||||||||||||
sources = ['numexpr/interpreter.cpp', | ||||||||||||
'numexpr/module.cpp', | ||||||||||||
'numexpr/numexpr_object.cpp'] | ||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonder if there is a way to write this so it branches on
NPY_ABI_VERSION
. That way there could be NumPy 1 & 2 compilation pathsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The easiest way is to define the macro if it isn't defined. Without that users can't do a local build with build isolation on old NumPy (which won't allow to compile with numpy 1 and run in 2, that would be harder).
Clearer instructions: https://numpy.org/devdocs/numpy_2_0_migration_guide.html#the-pyarray-descr-struct-has-been-changed