When I run cython.inline with a numpy argument, the compiler spits out a numpy deprecation warning. Example:
import cython
import numpy
y = numpy.zeros((1, ))
print(cython.inline('x = y + 1', quiet=True, force=True)['x'])
Output (Python 3.5.2, Cython 0.27.3, numpy 1.13.3):
In file included from /Users/alex/Library/Caches/cython/inline/_cython_inline_71247e2c4c276ce71de47a12a21f4fd3.c:504:
In file included from /Users/alex/.virtualenvs/pysb3/lib/python3.5/site-packages/numpy/core/include/numpy/arrayobject.h:4:
In file included from /Users/alex/.virtualenvs/pysb3/lib/python3.5/site-packages/numpy/core/include/numpy/ndarrayobject.h:18:
In file included from /Users/alex/.virtualenvs/pysb3/lib/python3.5/site-packages/numpy/core/include/numpy/ndarraytypes.h:1788:
/Users/alex/.virtualenvs/pysb3/lib/python3.5/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
#warning "Using deprecated NumPy API, disable it by " \
^
1 warning generated.
[ 1.]
I'm having trouble suppressing this warning. The cython docs state that the warning is normal and not anything to worry about, but my application compiles lots of code with cython.inline and the warnings might obscure real errors and confuse new users.
I've tried suppressing the warning with a distutils declaration, which doesn't seem to work.
cython.inline('# distutils: define_macros = NPY_NO_DEPRECATED_API '
'NPY_1_7_API_VERSION\n'
'x = y + 1',
quiet=True, force=True)
How do I suppress the deprecation warning from cython.inline?