Say I have a simple package of the following structure:
cython_functions/
__init__.py
fib.pyx
where fib.pyx
contains:
def fib(int n):
fiblist = [0, 1]
a, b = fiblist
while b < n:
a, b = b, a + b
fiblist.append(b)
return fiblist
and __init__.py
contains:
import pyximport
pyximport.install()
from cython_functions.fib import fib
If I make any changes to fib.pyx
I get a whole bunch of compiler warnings whenever I try to import the package:
/Users/andfranklin/.pyxbld/temp.macosx-10.6-intel-3.5/pyrex/cython_functions/fib.c:1687:28: warning: unused function '__Pyx_PyObject_AsString' [-Wunused-function]
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
^
/Users/andfranklin/.pyxbld/temp.macosx-10.6-intel-3.5/pyrex/cython_functions/fib.c:1684:32: warning: unused function '__Pyx_PyUnicode_FromString' [-Wunused-function]
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
^
.
.
.
Is there any easy way to suppress them? In another questions they describe how to pass compiler flags through an .pyxbld
file. It is possible for me to create fib.pyxbld
containing the following:
def make_ext(modname, pyxfilename):
from distutils.extension import Extension
return Extension(name=modname,
sources=[pyxfilename],
extra_compile_args=['-w'])
I would like to avoid this. If I need to create more functions I also need to create more .pyxbld
files with the same boilerplate. This seems excessive and un-pythonic.