diff --git a/MANIFEST.in b/MANIFEST.in index 5e742107c..f0883d4f2 100755 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,6 +2,5 @@ include PythonWrapper_README.md recursive-include Include *.h recursive-include PrivateInclude *.h recursive-include PythonWrapper/cmsisdsp_pkg/src *.h -include cmsisdsp/cg/scheduler/templates/* include Source/DistanceFunctions/arm_boolean_distance_template.h diff --git a/PythonWrapper/build_linux/create.sh b/PythonWrapper/build_linux/create.sh index 6e271aa3c..dfedeff08 100644 --- a/PythonWrapper/build_linux/create.sh +++ b/PythonWrapper/build_linux/create.sh @@ -2,10 +2,10 @@ cmake -DHOST=YES \ -DLOOPUNROLL=ON \ -DWRAPPER=YES \ -DCMAKE_POSITION_INDEPENDENT_CODE=YES \ - -DCMSISDSP="path to CMSIS-DSP folder" \ + -DCMSISDSP=".." \ -DCMAKE_C_FLAGS_RELEASE="-std=c11 -Ofast -ffast-math -DNDEBUG -Wall -Wextra" \ -DCMAKE_CXX_FLAGS_RELEASE="-fno-rtti -std=c++11 -Ofast -ffast-math -DNDEBUG -Wall -Wextra -Wno-unused-parameter" \ -G "Unix Makefiles" .. # For Mac universal lib -# -arch x86_64 -arch arm64 -mmacosx-version-min=11.0 \ No newline at end of file +# -arch x86_64 -arch arm64 -mmacosx-version-min=11.0 diff --git a/PythonWrapper/cmsisdsp_pkg/src/cmsisdsp_distance.c b/PythonWrapper/cmsisdsp_pkg/src/cmsisdsp_distance.c index f07d43c5b..5b0e0e38d 100755 --- a/PythonWrapper/cmsisdsp_pkg/src/cmsisdsp_distance.c +++ b/PythonWrapper/cmsisdsp_pkg/src/cmsisdsp_distance.c @@ -227,7 +227,7 @@ cmsis_arm_dtw_init_window_q7(PyObject *obj, arm_matrix_instance_q7 pSrc_converted; // input - if (PyArg_ParseTuple(args,"iiO",&winType,&winSize,&pSrc)); + if (PyArg_ParseTuple(args,"iiO",&winType,&winSize,&pSrc)) { q7MatrixFromNumpy(&pSrc_converted,pSrc); @@ -267,7 +267,7 @@ cmsis_arm_dtw_distance_f32(PyObject *obj, arm_matrix_instance_f32 dtw_converted; - if (PyArg_ParseTuple(args,"OO",&pDist,&pWin)); + if (PyArg_ParseTuple(args,"OO",&pDist,&pWin)) { f32MatrixFromNumpy(&pDist_converted,pDist); @@ -348,7 +348,7 @@ cmsis_arm_dtw_path_f32(PyObject *obj, Py_DECREF(pDstOBJ); return(pythonResult); } - + Py_RETURN_NONE; } static PyMethodDef CMSISDSPMethods[] = { @@ -450,4 +450,4 @@ void CAT(init,MODINITNAME)(void) #ifdef IS_PY3K return module; #endif -} \ No newline at end of file +} diff --git a/PythonWrapper/cmsisdsp_pkg/src/cmsisdsp_module.h b/PythonWrapper/cmsisdsp_pkg/src/cmsisdsp_module.h index 3f506f597..b19f38525 100644 --- a/PythonWrapper/cmsisdsp_pkg/src/cmsisdsp_module.h +++ b/PythonWrapper/cmsisdsp_pkg/src/cmsisdsp_module.h @@ -32,9 +32,9 @@ #include // API version used on google colab -// List on https://github.com/numpy/numpy/blob/main/numpy/core/include/numpy/numpyconfig.h +// https://github.com/numpy/numpy/blob/main/numpy/_core/include/numpy/numpyconfig.h #if (NPY_API_VERSION != 0x0000000F ) -#error("Error building with wrong NumPy API version") +//#error("Error building with wrong NumPy API version") #endif #ifdef WIN diff --git a/PythonWrapper/cmsisdsp_pkg/src/cmsisdsp_window.c b/PythonWrapper/cmsisdsp_pkg/src/cmsisdsp_window.c index 331188aed..d0c1920b8 100644 --- a/PythonWrapper/cmsisdsp_pkg/src/cmsisdsp_window.c +++ b/PythonWrapper/cmsisdsp_pkg/src/cmsisdsp_window.c @@ -72,7 +72,7 @@ cmsis_arm_welch_f64(PyObject *obj, PyObject *args) { - float32_t *pDst=NULL; // output + float64_t *pDst=NULL; // output int nb; // input if (PyArg_ParseTuple(args,"i",&nb)) @@ -125,7 +125,7 @@ cmsis_arm_bartlett_f64(PyObject *obj, PyObject *args) { - float32_t *pDst=NULL; // output + float64_t *pDst=NULL; // output int nb; // input if (PyArg_ParseTuple(args,"i",&nb)) @@ -178,7 +178,7 @@ cmsis_arm_hamming_f64(PyObject *obj, PyObject *args) { - float32_t *pDst=NULL; // output + float64_t *pDst=NULL; // output int nb; // input if (PyArg_ParseTuple(args,"i",&nb)) @@ -231,7 +231,7 @@ cmsis_arm_hanning_f64(PyObject *obj, PyObject *args) { - float32_t *pDst=NULL; // output + float64_t *pDst=NULL; // output int nb; // input if (PyArg_ParseTuple(args,"i",&nb)) @@ -284,7 +284,7 @@ cmsis_arm_nuttall3_f64(PyObject *obj, PyObject *args) { - float32_t *pDst=NULL; // output + float64_t *pDst=NULL; // output int nb; // input if (PyArg_ParseTuple(args,"i",&nb)) @@ -337,7 +337,7 @@ cmsis_arm_nuttall4_f64(PyObject *obj, PyObject *args) { - float32_t *pDst=NULL; // output + float64_t *pDst=NULL; // output int nb; // input if (PyArg_ParseTuple(args,"i",&nb)) @@ -390,7 +390,7 @@ cmsis_arm_nuttall3a_f64(PyObject *obj, PyObject *args) { - float32_t *pDst=NULL; // output + float64_t *pDst=NULL; // output int nb; // input if (PyArg_ParseTuple(args,"i",&nb)) @@ -443,7 +443,7 @@ cmsis_arm_nuttall3b_f64(PyObject *obj, PyObject *args) { - float32_t *pDst=NULL; // output + float64_t *pDst=NULL; // output int nb; // input if (PyArg_ParseTuple(args,"i",&nb)) @@ -496,7 +496,7 @@ cmsis_arm_nuttall4a_f64(PyObject *obj, PyObject *args) { - float32_t *pDst=NULL; // output + float64_t *pDst=NULL; // output int nb; // input if (PyArg_ParseTuple(args,"i",&nb)) @@ -549,7 +549,7 @@ cmsis_arm_blackman_harris_92db_f64(PyObject *obj, PyObject *args) { - float32_t *pDst=NULL; // output + float64_t *pDst=NULL; // output int nb; // input if (PyArg_ParseTuple(args,"i",&nb)) @@ -602,7 +602,7 @@ cmsis_arm_nuttall4b_f64(PyObject *obj, PyObject *args) { - float32_t *pDst=NULL; // output + float64_t *pDst=NULL; // output int nb; // input if (PyArg_ParseTuple(args,"i",&nb)) @@ -655,7 +655,7 @@ cmsis_arm_nuttall4c_f64(PyObject *obj, PyObject *args) { - float32_t *pDst=NULL; // output + float64_t *pDst=NULL; // output int nb; // input if (PyArg_ParseTuple(args,"i",&nb)) @@ -708,7 +708,7 @@ cmsis_arm_hft90d_f64(PyObject *obj, PyObject *args) { - float32_t *pDst=NULL; // output + float64_t *pDst=NULL; // output int nb; // input if (PyArg_ParseTuple(args,"i",&nb)) @@ -761,7 +761,7 @@ cmsis_arm_hft95_f64(PyObject *obj, PyObject *args) { - float32_t *pDst=NULL; // output + float64_t *pDst=NULL; // output int nb; // input if (PyArg_ParseTuple(args,"i",&nb)) @@ -814,7 +814,7 @@ cmsis_arm_hft116d_f64(PyObject *obj, PyObject *args) { - float32_t *pDst=NULL; // output + float64_t *pDst=NULL; // output int nb; // input if (PyArg_ParseTuple(args,"i",&nb)) @@ -867,7 +867,7 @@ cmsis_arm_hft144d_f64(PyObject *obj, PyObject *args) { - float32_t *pDst=NULL; // output + float64_t *pDst=NULL; // output int nb; // input if (PyArg_ParseTuple(args,"i",&nb)) @@ -920,7 +920,7 @@ cmsis_arm_hft169d_f64(PyObject *obj, PyObject *args) { - float32_t *pDst=NULL; // output + float64_t *pDst=NULL; // output int nb; // input if (PyArg_ParseTuple(args,"i",&nb)) @@ -973,7 +973,7 @@ cmsis_arm_hft196d_f64(PyObject *obj, PyObject *args) { - float32_t *pDst=NULL; // output + float64_t *pDst=NULL; // output int nb; // input if (PyArg_ParseTuple(args,"i",&nb)) @@ -1026,7 +1026,7 @@ cmsis_arm_hft223d_f64(PyObject *obj, PyObject *args) { - float32_t *pDst=NULL; // output + float64_t *pDst=NULL; // output int nb; // input if (PyArg_ParseTuple(args,"i",&nb)) @@ -1079,7 +1079,7 @@ cmsis_arm_hft248d_f64(PyObject *obj, PyObject *args) { - float32_t *pDst=NULL; // output + float64_t *pDst=NULL; // output int nb; // input if (PyArg_ParseTuple(args,"i",&nb)) diff --git a/PythonWrapper/examples/debug.py b/PythonWrapper/examples/debug.py index 7e6b483b5..0ab597510 100755 --- a/PythonWrapper/examples/debug.py +++ b/PythonWrapper/examples/debug.py @@ -9,6 +9,7 @@ import colorama from colorama import init,Fore, Back, Style from numpy.testing import assert_allclose +import scipy.spatial.distance as d init() @@ -19,63 +20,61 @@ def printSubTitle(s): print("\n" + Style.BRIGHT + s + Style.RESET_ALL) -def chop(A, eps = 1e-6): - B = np.copy(A) - B[np.abs(A) < eps] = 0 - return B +def packset(a): + b = np.packbits(a) + newSize = int(np.ceil(b.shape[0] / 4.0)) * 4 + c = np.copy(b).astype(np.uint32) + c.resize(newSize) + #print(c) + vecSize = round(newSize/4) + c=c.reshape(vecSize,4) + #print(c) + r = np.zeros(vecSize) + result = [] + for i in range(0,vecSize): + print(c[i,:]) + #print("%X %X %X %X" % (c[i,0],c[i,1],c[i,2],c[i,3])) + d = (c[i,0] << 24) | (c[i,1] << 16) | (c[i,2] << 8) | c[i,3] + result.append(np.uint32(d)) + return(result) -nb = 32 -signal = np.cos(2 * np.pi * np.arange(nb) / nb)*np.cos(0.2*2 * np.pi * np.arange(nb) / nb) +nb = 34 +#va = np.random.choice([0,1],nb) +# Array of word32 containing all of our bits +#pva = packset(va) -ref=scipy.fft.rfft(signal) -invref = scipy.fft.irfft(ref) -print(f"ref length = {len(ref)}") -print(ref) +#vb = np.random.choice([0,1],nb) +# Array of word32 containing all of our bits +#pvb = packset(vb) +# +va=[1, 0, 1, 0, 1, 1, 1, 0 ,0, 1, 1, 0, 1, 0, 0, 0, 0, 1,0,0,0,1,1,0,1,0,1,0,0,1,1,1,1,1] +vb=[0,1,0,0,1,0,0,0,1,0,0,0,0,1,1,0,0,1,0,0,0,1,0,1,1,0,0,1,1,0,0,0,1,0] + +va = np.array(va) +vb = np.array(vb) + +pva=packset(va) +pvb=packset(vb) + +#pva = [np.uint32(167), np.uint32(0)] +#pvb = [np.uint32(152), np.uint32(0)] + +#print(va,pva) +#print(vb,pvb) + +ctt=1.0*np.count_nonzero((va==1) & (vb==1)) +ctf=1.0*np.count_nonzero((va==1) & (vb==0)) +cft=1.0*np.count_nonzero((va==0) & (vb==1)) + +res=(cft+ctf)/(2*ctt+cft+ctf) -# Convert ref to CMSIS-DSP format -referenceFloat=np.zeros(2*len(ref)) -print(f"referenceFloat length = {len(referenceFloat)}") -# Replace complex datatype by real datatype -referenceFloat[0::2] = np.real(ref) -referenceFloat[1::2] = np.imag(ref) -# Copy Nyquist frequency value into first -# sample.This is just a storage trick so that the -# output of the RFFT has same length as input -# It is legacy behavior that we need to keep -# for backward compatibility but it is not -# very pretty -#referenceFloat[1] = np.real(ref[-1]) - -rifftQ31=dsp.arm_rfft_instance_q31() -status=dsp.arm_rfft_init_q31(rifftQ31,nb,1,1) -# Apply CMSIS-DSP scaling -referenceQ31 = f.toQ31(referenceFloat / nb) - -resultQ31 = dsp.arm_rfft_q31(rifftQ31,referenceQ31) -resultF = f.Q31toF32(resultQ31) - -print(f"resultF length = {len(resultF)}") -assert_allclose(invref/nb,resultF,atol=1e-6) - -signalQ31 = f.toQ31(signal) -rfftQ31=dsp.arm_rfft_instance_q31() -status=dsp.arm_rfft_init_q31(rfftQ31,nb,0,1) -resultQ31 = dsp.arm_rfft_q31(rfftQ31,signalQ31) -print(len(resultQ31)) -print(2*nb) -resultF = f.Q31toF32(resultQ31) * nb - -def compareWithConjugatePart(r): - res = r[0::2] + 1j * r[1::2] - conjPart = res[nb:nb//2:-1].conj() - refPart = res[1:nb//2] - assert(np.equal(refPart , conjPart).all()) - -compareWithConjugatePart(resultF) - -res = resultF[0::2] + 1j * resultF[1::2] print(res) -print(res[0:nb//2+1]) -print(res[0:nb//2+1].shape) \ No newline at end of file + +print("\nDice") +ref=d.dice(va,vb) +res=dsp.arm_dice_distance(pva,pvb,nb) +print(ref) +print(res) +assert_allclose(ref,res,1e-6) diff --git a/PythonWrapper/examples/example_1_11.py b/PythonWrapper/examples/example_1_11.py index 91ddf1208..88b85ea2a 100644 --- a/PythonWrapper/examples/example_1_11.py +++ b/PythonWrapper/examples/example_1_11.py @@ -122,26 +122,28 @@ def printSubTitle(s): printSubTitle("With a window") +nan = np.nan + referenceDistance = 0.617099940776825 -referenceCost=np.array([[9.1612804e-01, 9.9920368e-01, np.NAN, np.NAN, - np.NAN], - [1.2353053e+00, 1.6792301e+00, np.NAN, np.NAN, - np.NAN], - [1.3028694e+00, 2.3696373e+00, 4.4372001e+00, np.NAN, - np.NAN], - [np.NAN, 3.0795674e+00, 4.9687119e+00, np.NAN, - np.NAN], - [np.NAN, 3.5039051e+00, 4.9290380e+00, 5.3565612e+00, - np.NAN], - [np.NAN, np.NAN, 4.8520918e+00, 5.1756082e+00, - np.NAN], - [np.NAN, np.NAN, 5.0427418e+00, 5.8497019e+00, +referenceCost=np.array([[9.1612804e-01, 9.9920368e-01, nan, nan, + nan], + [1.2353053e+00, 1.6792301e+00, nan, nan, + nan], + [1.3028694e+00, 2.3696373e+00, 4.4372001e+00, nan, + nan], + [nan, 3.0795674e+00, 4.9687119e+00, nan, + nan], + [nan, 3.5039051e+00, 4.9290380e+00, 5.3565612e+00, + nan], + [nan, nan, 4.8520918e+00, 5.1756082e+00, + nan], + [nan, nan, 5.0427418e+00, 5.8497019e+00, 7.6590457e+00], - [np.NAN, np.NAN, np.NAN, 6.7571073e+00, + [nan, nan, nan, 6.7571073e+00, 8.6668968e+00], - [np.NAN, np.NAN, np.NAN, 7.3949833e+00, + [nan, nan, nan, 7.3949833e+00, 9.0352430e+00], - [np.NAN, np.NAN, np.NAN, np.NAN, + [nan, nan, nan, nan, 9.2564993e+00]], dtype=np.float32) diff --git a/PythonWrapper/examples/testdistance.py b/PythonWrapper/examples/testdistance.py index d6e406666..c1425b4fa 100755 --- a/PythonWrapper/examples/testdistance.py +++ b/PythonWrapper/examples/testdistance.py @@ -6,6 +6,14 @@ a=[1,2,3] b=[1,5,2] +def kulsinski(va,vb): + n = len(va) + ctt=1.0*np.count_nonzero((va==1) & (vb==1)) + ctf=1.0*np.count_nonzero((va==1) & (vb==0)) + cft=1.0*np.count_nonzero((va==0) & (vb==1)) + return(1.0*(ctf + cft - ctt+n)/(cft + ctf + n)) + + print("\nBray-Curtis") ref=d.braycurtis(a,b) res=dsp.arm_braycurtis_distance_f32(a,b) @@ -96,7 +104,7 @@ def packset(a): b = np.packbits(a) newSize = int(np.ceil(b.shape[0] / 4.0)) * 4 - c = np.copy(b) + c = np.copy(b).astype(np.uint32) c.resize(newSize) #print(c) vecSize = round(newSize/4) @@ -105,7 +113,7 @@ def packset(a): r = np.zeros(vecSize) result = [] for i in range(0,vecSize): - #print(c[i,:]) + print(c[i,:]) #print("%X %X %X %X" % (c[i,0],c[i,1],c[i,2],c[i,3])) d = (c[i,0] << 24) | (c[i,1] << 16) | (c[i,2] << 8) | c[i,3] result.append(np.uint32(d)) @@ -143,7 +151,7 @@ def packset(a): assert_allclose(ref,res,1e-6) print("\nKulsinski") -ref=d.kulsinski(va,vb) +ref=kulsinski(va,vb) res=dsp.arm_kulsinski_distance(pva,pvb,nb) print(ref) print(res) diff --git a/PythonWrapper/examples/testdsp6.py b/PythonWrapper/examples/testdsp6.py index 51754eb2d..636ed0e2b 100755 --- a/PythonWrapper/examples/testdsp6.py +++ b/PythonWrapper/examples/testdsp6.py @@ -169,10 +169,14 @@ supportVectors = supportVectors.reshape(nbSupportVectors * VECDIM) svmInst=dsp.arm_svm_polynomial_instance_f32() + + dsp.arm_svm_polynomial_init_f32(svmInst,nbSupportVectors,vectorDimensions, - intercept,dualCoefs,supportVectors, + intercept[0],dualCoefs,supportVectors, [0,1],degree,coef0,gamma) +exit(0) + test1 = np.array([0.4,0.1]) predicted1 = dsp.arm_svm_polynomial_predict_f32(svmInst,test1) print(predicted1) diff --git a/PythonWrapper/examples/testmfcc.py b/PythonWrapper/examples/testmfcc.py index 14859a854..c0e5d48b7 100755 --- a/PythonWrapper/examples/testmfcc.py +++ b/PythonWrapper/examples/testmfcc.py @@ -17,7 +17,7 @@ freq_high = sample_rate / 2 numOfMelFilters = 20 -window = sig.hamming(FFTSize, sym=False) +window = sig.windows.hamming(FFTSize, sym=False) filtLen,filtPos,packedFilters = mfcc.melFilterMatrix(F32,freq_min, freq_high, numOfMelFilters,sample_rate,FFTSize) diff --git a/PythonWrapper/examples/testmfccq15.py b/PythonWrapper/examples/testmfccq15.py index a48a807f9..853f38536 100755 --- a/PythonWrapper/examples/testmfccq15.py +++ b/PythonWrapper/examples/testmfccq15.py @@ -17,7 +17,7 @@ freq_high = sample_rate / 2 numOfMelFilters = 20 -windowQ15 = dt.convert(sig.hamming(FFTSize, sym=False),Q15) +windowQ15 = dt.convert(sig.windows.hamming(FFTSize, sym=False),Q15) filtLen,filtPos,packedFiltersQ15 = mfcc.melFilterMatrix(Q15,freq_min, freq_high, numOfMelFilters,sample_rate,FFTSize) dctMatrixFiltersQ15 = mfcc.dctMatrix(Q15,numOfDctOutputs, numOfMelFilters) diff --git a/PythonWrapper/examples/testmfccq31.py b/PythonWrapper/examples/testmfccq31.py index 686dc6d74..08e31e473 100755 --- a/PythonWrapper/examples/testmfccq31.py +++ b/PythonWrapper/examples/testmfccq31.py @@ -17,7 +17,7 @@ freq_high = sample_rate / 2 numOfMelFilters = 20 -windowQ31 = dt.convert(sig.hamming(FFTSize, sym=False),Q31) +windowQ31 = dt.convert(sig.windows.hamming(FFTSize, sym=False),Q31) filtLen,filtPos,packedFiltersQ31 = mfcc.melFilterMatrix(Q31,freq_min, freq_high, numOfMelFilters,sample_rate,FFTSize) dctMatrixFiltersQ31 = mfcc.dctMatrix(Q31,numOfDctOutputs, numOfMelFilters) diff --git a/PythonWrapper_README.md b/PythonWrapper_README.md index eb14cbb56..fe7172150 100644 --- a/PythonWrapper_README.md +++ b/PythonWrapper_README.md @@ -11,17 +11,13 @@ The signal processing chain can thus be tested and developed in a Python environ A tutorial is also available but with less details than this README: https://developer.arm.com/documentation/102463/latest/ -This wrapper is also containing the scripts for the new [CMSIS-DSP compute graph framework](https://github.com/ARM-software/CMSIS-DSP/tree/main/ComputeGraph) (CG). - -CG is also including some nodes to communicate with Modelica using the VHT Modelica blocks developed as part of our [VHT-SystemModeling](https://github.com/ARM-software/VHT-SystemModeling) demos. - An history of the changes to this wrapper is available at the end of the README. # How to build and install ## Tested configurations -The building of this package has been tested on Windows with the Python install from python.org and Microsoft Visual 2017. +The building of this package has been tested on Windows with the Python install from python.org and Microsoft Visual Studio 2022 and on Ubuntu 22.04. It has also been tested with `cygwin`. In that case, `python-devel` must be installed too. On Mac, it was tested with standard XCode installation. @@ -43,8 +39,6 @@ You must have a recent `pip` (to automatically install the dependencies like `Nu DSP examples are available in the [CMSIS-DSP PythonWrapper examples](https://github.com/ARM-software/CMSIS-DSP/tree/main/PythonWrapper/examples) folder. -Synchronous Data Flow examples are available in the [ComputeGraph](https://github.com/ARM-software/CMSIS-DSP/tree/main/ComputeGraph) folder of [CMSIS-DSP](https://github.com/ARM-software/CMSIS-DSP) . - You can also install and run it from [Google colab](https://colab.research.google.com/): This [link](https://colab.research.google.com/github/ARM-software/CMSIS-DSP/blob/main/PythonWrapper/examples/cmsisdsp_tests.ipynb) will open a Jupyter notebook in [Google colab](https://colab.research.google.com/) for testing. This notebook is from the [examples](https://github.com/ARM-software/CMSIS-DSP/tree/main/PythonWrapper/examples) in the CMSIS-DSP GitHub repository. @@ -236,12 +230,18 @@ MEL filters are represented as 3 arrays to encode a sparse array. `datatype` is an API on top of `fixedpoint` to provide more reuse when converting between data formats. -The wrapper is now containing the compute graph Python scripts and you should refer the the documentation in `DSP/ComputeGraph` folder to know how to use those tools. - # Change history +## Version 1.9.9: +* Supports Python 3.12 + +## Version 1.9.8: +* Compute graph API has been removed +* Dependency on numpy 1.22 has been lifted, tested through numpy 1.26 +* Inconsistencies in distance and window modules have been fixed. + ## Version 1.9.7: * Upgrade for compatibility with google colab diff --git a/cmsisdsp/version.py b/cmsisdsp/version.py index 7da30a346..d357a33f1 100755 --- a/cmsisdsp/version.py +++ b/cmsisdsp/version.py @@ -1,2 +1,2 @@ # Python wrapper version -__version__ = "1.9.7" +__version__ = "1.9.9" diff --git a/pyproject.toml b/pyproject.toml index beaf444f0..777806804 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,6 +2,6 @@ requires = [ "setuptools>=42", "wheel", - "numpy>=1.22, < 1.23" + "numpy>=1.22" ] -build-backend = "setuptools.build_meta" \ No newline at end of file +build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index 0ae88b3d1..aa576848f 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ #from distutils.core import setup, Extension from setuptools import setup, Extension,find_packages -from distutils.util import convert_path +import io import glob import numpy import sys @@ -14,6 +14,15 @@ ROOT = here ROOT="" +PYTHON_MOD = os.path.join(ROOT,"cmsisdsp") +version_path = os.path.join(PYTHON_MOD,"version.py") + +__version__ = re.search( + r'__version__\s*=\s*[\'"]([^\'"]*)[\'"]', # It excludes inline comment too + io.open(version_path, encoding='utf_8_sig').read() + ).group(1) + + includes = [os.path.join(ROOT,"Include"),os.path.join(ROOT,"PrivateInclude"),os.path.join("PythonWrapper","cmsisdsp_pkg","src")] if sys.platform == 'win32': @@ -153,19 +162,9 @@ def build(): print('setup.py: Error: This package only supports Python 3.', file=sys.stderr) sys.exit(1) - main_ns = {} - ver_path = convert_path(os.path.join("cmsisdsp","version.py")) - with open(ver_path) as ver_file: - exec(ver_file.read(), main_ns) - setup (name = 'cmsisdsp', - version = main_ns['__version__'], - packages=["cmsisdsp", - "cmsisdsp.cg", - "cmsisdsp.cg.nodes", - "cmsisdsp.cg.nodes.host", - "cmsisdsp.cg.scheduler", - "cmsisdsp.cg.scheduler.templates"], + version = __version__, + packages=["cmsisdsp"], description = 'CMSIS-DSP Python API', long_description=open("PythonWrapper_README.md").read(), long_description_content_type='text/markdown', @@ -186,7 +185,7 @@ def build(): moduleWindow ], include_package_data=True, - author = 'Copyright (C) 2010-2023 ARM Limited or its affiliates. All rights reserved.', + author = 'Copyright (C) 2010-2024 ARM Limited or its affiliates. All rights reserved.', author_email = 'christophe.favergeon@arm.com', url="https://github.com/ARM-software/CMSIS-DSP", python_requires='>=3.7', @@ -205,11 +204,8 @@ def build(): "Intended Audience :: Developers", ], keywords=['development','dsp','cmsis','cmsis-dsp','Arm','signal processing','maths','ml','cortex-m','cortex-a'], - install_requires=['numpy>=1.22, < 1.23 ', - 'networkx>=3.0', - 'jinja2>= 3.1.2, <4.0', - 'sympy>=1.7.1', - 'MarkupSafe>=2.1.2, <3.0' + install_requires=[ + 'numpy>=1.22', ], project_urls={ # Optional 'Bug Reports': 'https://github.com/ARM-software/CMSIS-DSP/issues', @@ -218,4 +214,4 @@ def build(): ) -build() \ No newline at end of file +build()