From 92504e0beaf2141ef10bcc95a00406dfcb04a43b Mon Sep 17 00:00:00 2001 From: Evgeny Posenitskiy <45995097+q-posev@users.noreply.github.com> Date: Sun, 16 Jun 2024 19:13:59 +0200 Subject: [PATCH 01/32] First try macos-arm64 (#137) * First try macos-arm64 * Test new macos-14 runner * Update actions.yml * Install libtool * Install swig * User install for python * Update install_pytrexio.sh * Update install_pytrexio.sh * Update install_pytrexio.sh * Update Makefile.am * Update Makefile.am * Update Makefile.am * Update actions.yml * Update actions.yml * Update install_pytrexio.sh [skip ci] * Update actions.yml * Update Makefile.am * Update actions.yml * Setup venv in CI and not in the installation script --- .github/workflows/actions.yml | 41 ++++++++++++++++++++++++----------- python/install_pytrexio.sh | 3 ++- 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index e42bfad..4678b3e 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -15,7 +15,7 @@ jobs: get_commit_message: name: Get commit message - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 outputs: message: ${{ steps.commit_message.outputs.message }} steps: @@ -33,7 +33,7 @@ jobs: trexio_ubuntu: name: x86 Ubuntu 20.04 - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 needs: get_commit_message steps: @@ -53,8 +53,8 @@ jobs: - name: install dependencies run: | - sudo add-apt-repository ppa:kelleyk/emacs - sudo apt-get install libhdf5-dev emacs26 + sudo apt-get update + sudo apt-get install libhdf5-dev emacs - name: configure with autotools run: | @@ -74,19 +74,24 @@ jobs: name: test-report-ubuntu path: test-suite.log - - name: create virtual environment + - name: create venv run: | - python3 -m venv --clear pytrexio-venv - source pytrexio-venv/bin/activate + python3 -m venv trexio-venv + source trexio-venv/bin/activate - name: install Python API - run: make python-install + run: | + source trexio-venv/bin/activate + make python-install - name: check Python API - run: make python-test + run: | + source trexio-venv/bin/activate + make python-test - name: build and move Python API distribution run: | + source trexio-venv/bin/activate make python-sdist cp python/dist/trexio-*.tar.gz . @@ -105,7 +110,7 @@ jobs: - name: reconfigure with clang and AddressSanitizer run: | ./autogen.sh - ./configure CC=clang-11 CFLAGS="-O2 -fsanitize=address -fno-omit-frame-pointer" LDFLAGS="-fsanitize=address" --enable-silent-rules + ./configure CC=clang-15 CFLAGS="-O2 -fsanitize=address -fno-omit-frame-pointer" LDFLAGS="-fsanitize=address" --enable-silent-rules - name: recompile TREXIO run: make -j2 @@ -124,8 +129,8 @@ jobs: run: make maintainer-clean trexio_macos: - name: x86 MacOS 12 - runs-on: macos-12 + name: arm64 MacOS + runs-on: macos-14 steps: - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 @@ -135,6 +140,8 @@ jobs: brew install emacs brew install hdf5 brew install automake + brew install libtool + brew install swig brew --prefix hdf5 - name: configure with autotools @@ -148,14 +155,22 @@ jobs: - name: check TREXIO run: make -j3 check + - name: create venv + run: | + python3 -m venv trexio-venv + source trexio-venv/bin/activate + - name: compile Python API run: | export H5_CFLAGS="-I$(brew --prefix hdf5)/include" export H5_LDFLAGS="-L$(brew --prefix hdf5)/lib" + source trexio-venv/bin/activate make python-install - name: test Python API - run: make python-test + run: | + source trexio-venv/bin/activate + make python-test - name: Archive test log file if: failure() diff --git a/python/install_pytrexio.sh b/python/install_pytrexio.sh index d6a0767..9f21dbc 100755 --- a/python/install_pytrexio.sh +++ b/python/install_pytrexio.sh @@ -63,8 +63,9 @@ else export H5_CFLAGS=${H5_CFLAGS_LOCAL} fi + # Install/upgrade packages required for the installation -python3 -m pip install --upgrade setuptools build pip +python3 -m pip install build python3 -m pip install -r requirements.txt python3 -m pip install pytest From 62b12b59aed3348f961e9dbb767d6b77d852d66c Mon Sep 17 00:00:00 2001 From: q-posev Date: Thu, 27 Jun 2024 17:01:27 +0200 Subject: [PATCH 02/32] Update SWIG interface --- src/numpy.i | 297 ++++++++-------------------------------------------- 1 file changed, 42 insertions(+), 255 deletions(-) diff --git a/src/numpy.i b/src/numpy.i index 36bb55c..c8c26cb 100644 --- a/src/numpy.i +++ b/src/numpy.i @@ -48,7 +48,7 @@ %fragment("NumPy_Backward_Compatibility", "header") { -%#if NPY_API_VERSION < 0x00000007 +%#if NPY_API_VERSION < NPY_1_7_API_VERSION %#define NPY_ARRAY_DEFAULT NPY_DEFAULT %#define NPY_ARRAY_FARRAY NPY_FARRAY %#define NPY_FORTRANORDER NPY_FORTRAN @@ -69,7 +69,7 @@ { /* Macros to extract array attributes. */ -%#if NPY_API_VERSION < 0x00000007 +%#if NPY_API_VERSION < NPY_1_7_API_VERSION %#define is_array(a) ((a) && PyArray_Check((PyArrayObject*)a)) %#define array_type(a) (int)(PyArray_TYPE((PyArrayObject*)a)) %#define array_numdims(a) (((PyArrayObject*)a)->nd) @@ -114,17 +114,12 @@ if (py_obj == NULL ) return "C NULL value"; if (py_obj == Py_None ) return "Python None" ; if (PyCallable_Check(py_obj)) return "callable" ; - if (PyString_Check( py_obj)) return "string" ; - if (PyInt_Check( py_obj)) return "int" ; + if (PyBytes_Check( py_obj)) return "string" ; + if (PyLong_Check( py_obj)) return "int" ; if (PyFloat_Check( py_obj)) return "float" ; if (PyDict_Check( py_obj)) return "dict" ; if (PyList_Check( py_obj)) return "list" ; if (PyTuple_Check( py_obj)) return "tuple" ; -%#if PY_MAJOR_VERSION < 3 - if (PyFile_Check( py_obj)) return "file" ; - if (PyModule_Check( py_obj)) return "module" ; - if (PyInstance_Check(py_obj)) return "instance" ; -%#endif return "unknown type"; } @@ -170,13 +165,11 @@ return PyArray_EquivTypenums(actual_type, desired_type); } -%#ifdef SWIGPY_USE_CAPSULE - void free_cap(PyObject * cap) +void free_cap(PyObject * cap) { void* array = (void*) PyCapsule_GetPointer(cap,SWIGPY_CAPSULE_NAME); if (array != NULL) free(array); } -%#endif } @@ -298,7 +291,7 @@ Py_INCREF(array_descr(ary)); result = (PyArrayObject*) PyArray_FromArray(ary, array_descr(ary), -%#if NPY_API_VERSION < 0x00000007 +%#if NPY_API_VERSION < NPY_1_7_API_VERSION NPY_FORTRANORDER); %#else NPY_ARRAY_F_CONTIGUOUS); @@ -529,7 +522,7 @@ return success; } - /* Require the given PyArrayObject to to be Fortran ordered. If the + /* Require the given PyArrayObject to be Fortran ordered. If the * the PyArrayObject is already Fortran ordered, do nothing. Else, * set the Fortran ordering flag and recompute the strides. */ @@ -545,7 +538,7 @@ const npy_intp *dims = array_dimensions(ary); for (i=0; i < nd; ++i) n_non_one += (dims[i] != 1) ? 1 : 0; - if (n_non_one > 1) + if (n_non_one > 1) array_clearflags(ary,NPY_ARRAY_CARRAY); array_enableflags(ary,NPY_ARRAY_FARRAY); /* Recompute the strides */ @@ -2007,7 +2000,7 @@ (PyObject* array = NULL) { npy_intp dims[1]; - if (!PyInt_Check($input)) + if (!PyLong_Check($input)) { const char* typestring = pytype_string($input); PyErr_Format(PyExc_TypeError, @@ -2015,7 +2008,8 @@ typestring); SWIG_fail; } - $2 = (DIM_TYPE) PyInt_AsLong($input); + $2 = (DIM_TYPE) PyLong_AsSsize_t($input); + if ($2 == -1 && PyErr_Occurred()) SWIG_fail; dims[0] = (npy_intp) $2; array = PyArray_SimpleNew(1, dims, DATA_TYPECODE); if (!array) SWIG_fail; @@ -2035,7 +2029,7 @@ (PyObject* array = NULL) { npy_intp dims[1]; - if (!PyInt_Check($input)) + if (!PyLong_Check($input)) { const char* typestring = pytype_string($input); PyErr_Format(PyExc_TypeError, @@ -2043,7 +2037,8 @@ typestring); SWIG_fail; } - $1 = (DIM_TYPE) PyInt_AsLong($input); + $1 = (DIM_TYPE) PyLong_AsSsize_t($input); + if ($1 == -1 && PyErr_Occurred()) SWIG_fail; dims[0] = (npy_intp) $1; array = PyArray_SimpleNew(1, dims, DATA_TYPECODE); if (!array) SWIG_fail; @@ -2462,13 +2457,9 @@ if (!array) SWIG_fail; -%#ifdef SWIGPY_USE_CAPSULE - PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); -%#else - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free); -%#endif +PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); -%#if NPY_API_VERSION < 0x00000007 +%#if NPY_API_VERSION < NPY_1_7_API_VERSION PyArray_BASE(array) = cap; %#else PyArray_SetBaseObject(array,cap); @@ -2496,13 +2487,9 @@ if (!array) SWIG_fail; -%#ifdef SWIGPY_USE_CAPSULE - PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); -%#else - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free); -%#endif +PyObject* cap = PyCapsule_New((void*)(*$2), SWIGPY_CAPSULE_NAME, free_cap); -%#if NPY_API_VERSION < 0x00000007 +%#if NPY_API_VERSION < NPY_1_7_API_VERSION PyArray_BASE(array) = cap; %#else PyArray_SetBaseObject(array,cap); @@ -2531,13 +2518,9 @@ if (!array) SWIG_fail; -%#ifdef SWIGPY_USE_CAPSULE - PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); -%#else - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free); -%#endif +PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); -%#if NPY_API_VERSION < 0x00000007 +%#if NPY_API_VERSION < NPY_1_7_API_VERSION PyArray_BASE(array) = cap; %#else PyArray_SetBaseObject(array,cap); @@ -2566,13 +2549,9 @@ if (!array) SWIG_fail; -%#ifdef SWIGPY_USE_CAPSULE - PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); -%#else - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free); -%#endif +PyObject* cap = PyCapsule_New((void*)(*$3), SWIGPY_CAPSULE_NAME, free_cap); -%#if NPY_API_VERSION < 0x00000007 +%#if NPY_API_VERSION < NPY_1_7_API_VERSION PyArray_BASE(array) = cap; %#else PyArray_SetBaseObject(array,cap); @@ -2601,13 +2580,9 @@ if (!array || !require_fortran(array)) SWIG_fail; -%#ifdef SWIGPY_USE_CAPSULE - PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); -%#else - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free); -%#endif +PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); -%#if NPY_API_VERSION < 0x00000007 +%#if NPY_API_VERSION < NPY_1_7_API_VERSION PyArray_BASE(array) = cap; %#else PyArray_SetBaseObject(array,cap); @@ -2636,13 +2611,9 @@ if (!array || !require_fortran(array)) SWIG_fail; -%#ifdef SWIGPY_USE_CAPSULE - PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); -%#else - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free); -%#endif +PyObject* cap = PyCapsule_New((void*)(*$3), SWIGPY_CAPSULE_NAME, free_cap); -%#if NPY_API_VERSION < 0x00000007 +%#if NPY_API_VERSION < NPY_1_7_API_VERSION PyArray_BASE(array) = cap; %#else PyArray_SetBaseObject(array,cap); @@ -2673,13 +2644,9 @@ if (!array) SWIG_fail; -%#ifdef SWIGPY_USE_CAPSULE - PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); -%#else - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free); -%#endif +PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); -%#if NPY_API_VERSION < 0x00000007 +%#if NPY_API_VERSION < NPY_1_7_API_VERSION PyArray_BASE(array) = cap; %#else PyArray_SetBaseObject(array,cap); @@ -2710,13 +2677,9 @@ if (!array) SWIG_fail; -%#ifdef SWIGPY_USE_CAPSULE - PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); -%#else - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free); -%#endif +PyObject* cap = PyCapsule_New((void*)(*$4), SWIGPY_CAPSULE_NAME, free_cap); -%#if NPY_API_VERSION < 0x00000007 +%#if NPY_API_VERSION < NPY_1_7_API_VERSION PyArray_BASE(array) = cap; %#else PyArray_SetBaseObject(array,cap); @@ -2747,13 +2710,9 @@ if (!array || !require_fortran(array)) SWIG_fail; -%#ifdef SWIGPY_USE_CAPSULE - PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); -%#else - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free); -%#endif +PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); -%#if NPY_API_VERSION < 0x00000007 +%#if NPY_API_VERSION < NPY_1_7_API_VERSION PyArray_BASE(array) = cap; %#else PyArray_SetBaseObject(array,cap); @@ -2784,13 +2743,9 @@ if (!array || !require_fortran(array)) SWIG_fail; -%#ifdef SWIGPY_USE_CAPSULE - PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); -%#else - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free); -%#endif +PyObject* cap = PyCapsule_New((void*)(*$4), SWIGPY_CAPSULE_NAME, free_cap); -%#if NPY_API_VERSION < 0x00000007 +%#if NPY_API_VERSION < NPY_1_7_API_VERSION PyArray_BASE(array) = cap; %#else PyArray_SetBaseObject(array,cap); @@ -2822,13 +2777,9 @@ if (!array) SWIG_fail; -%#ifdef SWIGPY_USE_CAPSULE - PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); -%#else - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free); -%#endif +PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); -%#if NPY_API_VERSION < 0x00000007 +%#if NPY_API_VERSION < NPY_1_7_API_VERSION PyArray_BASE(array) = cap; %#else PyArray_SetBaseObject(array,cap); @@ -2860,165 +2811,9 @@ if (!array) SWIG_fail; -%#ifdef SWIGPY_USE_CAPSULE - PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); -%#else - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free); -%#endif +PyObject* cap = PyCapsule_New((void*)(*$5), SWIGPY_CAPSULE_NAME, free_cap); -%#if NPY_API_VERSION < 0x00000007 - PyArray_BASE(array) = cap; -%#else - PyArray_SetBaseObject(array,cap); -%#endif - - $result = SWIG_Python_AppendOutput($result,obj); -} - -/* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, - DIM_TYPE* DIM3, DIM_TYPE* DIM4) - */ -%typemap(in,numinputs=0) - (DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 , DIM_TYPE* DIM4 ) - (DATA_TYPE* data_temp = NULL , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp) -{ - $1 = &data_temp; - $2 = &dim1_temp; - $3 = &dim2_temp; - $4 = &dim3_temp; - $5 = &dim4_temp; -} -%typemap(argout, - fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements,NumPy_Utilities") - (DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3) -{ - npy_intp dims[4] = { *$2, *$3, *$4 , *$5 }; - PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$1)); - PyArrayObject* array = (PyArrayObject*) obj; - - if (!array || !require_fortran(array)) SWIG_fail; - -%#ifdef SWIGPY_USE_CAPSULE - PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); -%#else - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free); -%#endif - -%#if NPY_API_VERSION < 0x00000007 - PyArray_BASE(array) = cap; -%#else - PyArray_SetBaseObject(array,cap); -%#endif - - $result = SWIG_Python_AppendOutput($result,obj); -} - -/* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, - DATA_TYPE** ARGOUTVIEWM_FARRAY4) - */ -%typemap(in,numinputs=0) - (DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 , DIM_TYPE* DIM4 , DATA_TYPE** ARGOUTVIEWM_FARRAY4) - (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp, DATA_TYPE* data_temp = NULL ) -{ - $1 = &dim1_temp; - $2 = &dim2_temp; - $3 = &dim3_temp; - $4 = &dim4_temp; - $5 = &data_temp; -} -%typemap(argout, - fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements,NumPy_Utilities") - (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEWM_FARRAY4) -{ - npy_intp dims[4] = { *$1, *$2, *$3 , *$4 }; - PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$5)); - PyArrayObject* array = (PyArrayObject*) obj; - - if (!array || !require_fortran(array)) SWIG_fail; - -%#ifdef SWIGPY_USE_CAPSULE - PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); -%#else - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free); -%#endif - -%#if NPY_API_VERSION < 0x00000007 - PyArray_BASE(array) = cap; -%#else - PyArray_SetBaseObject(array,cap); -%#endif - - $result = SWIG_Python_AppendOutput($result,obj); -} - -/* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, - DIM_TYPE* DIM3, DIM_TYPE* DIM4) - */ -%typemap(in,numinputs=0) - (DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 , DIM_TYPE* DIM4 ) - (DATA_TYPE* data_temp = NULL , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp) -{ - $1 = &data_temp; - $2 = &dim1_temp; - $3 = &dim2_temp; - $4 = &dim3_temp; - $5 = &dim4_temp; -} -%typemap(argout, - fragment="NumPy_Backward_Compatibility,NumPy_Utilities") - (DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4) -{ - npy_intp dims[4] = { *$2, *$3, *$4 , *$5 }; - PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$1)); - PyArrayObject* array = (PyArrayObject*) obj; - - if (!array) SWIG_fail; - -%#ifdef SWIGPY_USE_CAPSULE - PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); -%#else - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free); -%#endif - -%#if NPY_API_VERSION < 0x00000007 - PyArray_BASE(array) = cap; -%#else - PyArray_SetBaseObject(array,cap); -%#endif - - $result = SWIG_Python_AppendOutput($result,obj); -} - -/* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, - DATA_TYPE** ARGOUTVIEWM_ARRAY4) - */ -%typemap(in,numinputs=0) - (DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 , DIM_TYPE* DIM4 , DATA_TYPE** ARGOUTVIEWM_ARRAY4) - (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp, DATA_TYPE* data_temp = NULL ) -{ - $1 = &dim1_temp; - $2 = &dim2_temp; - $3 = &dim3_temp; - $4 = &dim4_temp; - $5 = &data_temp; -} -%typemap(argout, - fragment="NumPy_Backward_Compatibility,NumPy_Utilities") - (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEWM_ARRAY4) -{ - npy_intp dims[4] = { *$1, *$2, *$3 , *$4 }; - PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$5)); - PyArrayObject* array = (PyArrayObject*) obj; - - if (!array) SWIG_fail; - -%#ifdef SWIGPY_USE_CAPSULE - PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); -%#else - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free); -%#endif - -%#if NPY_API_VERSION < 0x00000007 +%#if NPY_API_VERSION < NPY_1_7_API_VERSION PyArray_BASE(array) = cap; %#else PyArray_SetBaseObject(array,cap); @@ -3050,13 +2845,9 @@ if (!array || !require_fortran(array)) SWIG_fail; -%#ifdef SWIGPY_USE_CAPSULE - PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); -%#else - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free); -%#endif +PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); -%#if NPY_API_VERSION < 0x00000007 +%#if NPY_API_VERSION < NPY_1_7_API_VERSION PyArray_BASE(array) = cap; %#else PyArray_SetBaseObject(array,cap); @@ -3088,13 +2879,9 @@ if (!array || !require_fortran(array)) SWIG_fail; -%#ifdef SWIGPY_USE_CAPSULE - PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap); -%#else - PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free); -%#endif +PyObject* cap = PyCapsule_New((void*)(*$5), SWIGPY_CAPSULE_NAME, free_cap); -%#if NPY_API_VERSION < 0x00000007 +%#if NPY_API_VERSION < NPY_1_7_API_VERSION PyArray_BASE(array) = cap; %#else PyArray_SetBaseObject(array,cap); From 19adc9d811b5cf249e69e1dbfec0017691c15788 Mon Sep 17 00:00:00 2001 From: q-posev Date: Thu, 27 Jun 2024 17:02:07 +0200 Subject: [PATCH 03/32] RM deprecated oldest-supported-numpy --- python/pyproject.toml | 2 +- python/requirements.txt | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/python/pyproject.toml b/python/pyproject.toml index b8ca0a0..95513f0 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -3,6 +3,6 @@ requires = [ "setuptools>=42", "wheel", "pkgconfig", - "oldest-supported-numpy" + "numpy", ] build-backend = "setuptools.build_meta" diff --git a/python/requirements.txt b/python/requirements.txt index eddf522..e7bbedf 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -1,4 +1,3 @@ setuptools>=42 pkgconfig -numpy<1.27.0 -numpy>=1.17.3 +numpy From fa11989b86f8b35ebc44cd0c5543ef2acae9d701 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Sat, 10 Aug 2024 17:34:44 +0200 Subject: [PATCH 04/32] Update prepare_python.sh (#164) --- tools/prepare_python.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/prepare_python.sh b/tools/prepare_python.sh index bf316bf..e59c638 100755 --- a/tools/prepare_python.sh +++ b/tools/prepare_python.sh @@ -11,7 +11,11 @@ fi DO_HDF5=0 if [[ -z ${1} ]] && [[ "${1}" == "--without-hdf5" ]] ; then - echo "Compiling Python API without the HDF5 back end." + echo "" + echo "******************** WARNING **********************" + echo "* Compiling Python API without the HDF5 back end. *" + echo "***************************************************" + echo "" DO_HDF5=1 else echo "Compiling Python API with the HDF5 back end." From c860e4fdfeeb6179a7c42682773924af01ebb981 Mon Sep 17 00:00:00 2001 From: Evgeny Posenitskiy <45995097+q-posev@users.noreply.github.com> Date: Sat, 17 Aug 2024 18:22:43 +0200 Subject: [PATCH 05/32] Build and test new wheels (Python 3.10+ and manylinux tag 2.28 instead of 2.24) (#165) * Upgrade manylinux wheels builder for new container envs * [wheel build] test new Docker images and Py 3.10+ wheels on Test PyPI * [wheel build] test new Docker images and Py 3.10+ wheels on Test PyPI * [wheel build] Fix CI * [wheel build] One more test --- .github/workflows/actions.yml | 3 +- .github/workflows/build-wheels.yml | 56 +++++++++++++++--------------- python/build_manylinux_wheels.sh | 19 ++-------- 3 files changed, 33 insertions(+), 45 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 4678b3e..7f38ebc 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -29,7 +29,8 @@ jobs: run: | set -xe COMMIT_MSG=$(git log --no-merges -1 --oneline) - echo "::set-output name=message::$COMMIT_MSG" + echo "message=$COMMIT_MSG" >> $GITHUB_OUTPUT + echo github.ref ${{ github.ref }} trexio_ubuntu: name: x86 Ubuntu 20.04 diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 7cda44a..8e39137 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -4,7 +4,7 @@ on: # Run this workflow after the TREXIO CI completed workflow_run: workflows: [ "TREXIO CI" ] - branches: [ master ] + branches: [ test-new-wheels ] types: - completed @@ -16,12 +16,12 @@ jobs: get_commit_message: if: ${{ github.event.workflow_run.conclusion == 'success' }} name: Get commit message - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 outputs: message: ${{ steps.commit_message.outputs.message }} steps: - name: Checkout the repo - uses: actions/checkout@v3 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # Gets the correct commit message for pull request with: ref: ${{ github.event.pull_request.head.sha }} @@ -30,8 +30,8 @@ jobs: run: | set -xe COMMIT_MSG=$(git log --no-merges -1 --oneline) - echo "::set-output name=message::$COMMIT_MSG" - + echo "message=$COMMIT_MSG" >> $GITHUB_OUTPUT + echo github.ref ${{ github.ref }} build_linux_wheels: name: Build Linux wheels for different versions of CPython on manylinux_x86_64 @@ -39,19 +39,19 @@ jobs: if: >- contains(needs.get_commit_message.outputs.message, '[wheel build]') || (github.repository == 'TREX-CoE/trexio' && startsWith(github.ref, 'refs/tags/v')) - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 strategy: matrix: - manylinux_tag: [2014_x86_64, 2_24_x86_64] + manylinux_tag: [2014_x86_64, 2_28_x86_64] steps: - name: Checkout the branch - uses: actions/checkout@v3 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f with: - python-version: '3.9' + python-version: '3.10' - name: Install build dependencies run: python -m pip install -U setuptools @@ -65,7 +65,7 @@ jobs: # Conventional download-artifact action does not work for artifact produced in a different workflow, # which is the case here (TREXIO CI produced the Python API distribution tarball) - name: Download the Python API distribution tarball - uses: dawidd6/action-download-artifact@v2 + uses: dawidd6/action-download-artifact@v3 with: # Specify the name of the workflow file which uploaded the tarball workflow: actions.yml @@ -89,7 +89,7 @@ jobs: working-directory: python - name: Upload produced wheels as artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a with: name: pytrexio-manylinux-${{ matrix.manylinux_tag }} path: ./python/wheelhouse/*.whl @@ -98,27 +98,27 @@ jobs: publish_wheels: name: Publish all wheels on PyPI needs: [build_linux_wheels] - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Checkout the branch - uses: actions/checkout@v3 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f with: - python-version: '3.9' + python-version: '3.10' - name: Install build dependencies run: python -m pip install -U setuptools twine - name: Download the build artifacts (wheels) of this workflow - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: path: dist - name: Download the Python API distribution tarball - uses: dawidd6/action-download-artifact@v2 + uses: dawidd6/action-download-artifact@v3 with: workflow: actions.yml workflow_conclusion: success @@ -135,15 +135,15 @@ jobs: ls -sh -w 1 working-directory: dist - #- name: Publish distribution 📦 to Test PyPI - # uses: pypa/gh-action-pypi-publish@master - # with: - # password: ${{ secrets.TEST_PYPI_API_TOKEN }} - # repository_url: https://test.pypi.org/legacy/ - #verbose: true - - - name: Publish distribution 📦 to PyPI + - name: Publish distribution 📦 to Test PyPI uses: pypa/gh-action-pypi-publish@master with: - password: ${{ secrets.PYPI_API_TOKEN }} - #if: startsWith(github.ref, 'refs/tags') + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository_url: https://test.pypi.org/legacy/ + #verbose: true + + #- name: Publish distribution 📦 to PyPI + # uses: pypa/gh-action-pypi-publish@master + # with: + # password: ${{ secrets.PYPI_API_TOKEN }} + # #if: startsWith(github.ref, 'refs/tags') diff --git a/python/build_manylinux_wheels.sh b/python/build_manylinux_wheels.sh index 1da66ea..a45d960 100755 --- a/python/build_manylinux_wheels.sh +++ b/python/build_manylinux_wheels.sh @@ -46,22 +46,9 @@ function build_wheel_for_py() PYVERSION=${1} # derive manylinux glibc tag from the PLAT env variable provided to docker run - # this is needed to avoid building wheel for 2010_x86_64 with CPython 3.10 - # because NumPy does not have wheels for it MANYLINUX_TAG=${PLAT:9:4} - if [[ ${PYVERSION} -eq 310 ]] && [[ ${MANYLINUX_TAG} -eq 2010 ]]; then - echo "Skip build of the wheel for CPython 3.10 on manylinux2010_x86_64" - return - fi - # python versions <= 3.7 required additional "m" in the platform tag, e.g. cp37-cp37m - if [[ ${PYVERSION} -eq 36 ]] || [[ ${PYVERSION} -eq 37 ]]; then - PYM="m" - else - PYM="" - fi - - CPYTHON="cp${PYVERSION}-cp${PYVERSION}${PYM}" + CPYTHON="cp${PYVERSION}-cp${PYVERSION}" # create and activate a virtual environment based on CPython version ${PYVERSION} /opt/python/${CPYTHON}/bin/python3 -m venv --clear trexio-manylinux-py${PYVERSION} @@ -88,7 +75,7 @@ function build_wheel_for_py() pytest -v test/test_api.py # cleaning - rm -rf -- dist/ build/ trexio.egg-info/ + rm -rf -- dist/ build/ trexio.egg-info/ #rm -- test_file_py.h5 unsafe_test_file_py.h5 # deactivate the current environment @@ -103,7 +90,7 @@ function build_wheel_for_py() # build wheels for all versions of CPython in this container -for CPYVERSION in 37 38 39 310 +for CPYVERSION in 38 39 310 311 312 313 do build_wheel_for_py ${CPYVERSION} done From f06396a6652ffa6d2c6ef49480987f75914b0b4f Mon Sep 17 00:00:00 2001 From: q-posev Date: Sat, 17 Aug 2024 18:23:50 +0200 Subject: [PATCH 06/32] [wheel build] Test PyPI release with new CI --- .github/workflows/build-wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 8e39137..4150b10 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -4,7 +4,7 @@ on: # Run this workflow after the TREXIO CI completed workflow_run: workflows: [ "TREXIO CI" ] - branches: [ test-new-wheels ] + branches: [ master ] types: - completed From 410fa140e4ec184abbce1015aaf7d88430c963ff Mon Sep 17 00:00:00 2001 From: q-posev Date: Sat, 17 Aug 2024 18:32:15 +0200 Subject: [PATCH 07/32] [wheel build] Downgrade the download-artifact version --- .github/workflows/build-wheels.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 4150b10..ea3dd34 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -65,7 +65,7 @@ jobs: # Conventional download-artifact action does not work for artifact produced in a different workflow, # which is the case here (TREXIO CI produced the Python API distribution tarball) - name: Download the Python API distribution tarball - uses: dawidd6/action-download-artifact@v3 + uses: dawidd6/action-download-artifact@v2 with: # Specify the name of the workflow file which uploaded the tarball workflow: actions.yml @@ -118,7 +118,7 @@ jobs: path: dist - name: Download the Python API distribution tarball - uses: dawidd6/action-download-artifact@v3 + uses: dawidd6/action-download-artifact@v2 with: workflow: actions.yml workflow_conclusion: success From 69e81c103297dacc07336e3c2aa4fa8b669f977e Mon Sep 17 00:00:00 2001 From: q-posev Date: Sat, 17 Aug 2024 19:41:45 +0200 Subject: [PATCH 08/32] [wheel build] Test macos wheels --- .github/workflows/build-wheels.yml | 268 ++++++++++++++++++++--------- 1 file changed, 182 insertions(+), 86 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index ea3dd34..370c585 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -33,108 +33,204 @@ jobs: echo "message=$COMMIT_MSG" >> $GITHUB_OUTPUT echo github.ref ${{ github.ref }} - build_linux_wheels: - name: Build Linux wheels for different versions of CPython on manylinux_x86_64 + + build_macos_wheels: + name: build linux wheels for different versions of cpython on macos needs: get_commit_message if: >- contains(needs.get_commit_message.outputs.message, '[wheel build]') || - (github.repository == 'TREX-CoE/trexio' && startsWith(github.ref, 'refs/tags/v')) - runs-on: ubuntu-22.04 + (github.repository == 'trex-coe/trexio' && startswith(github.ref, 'refs/tags/v')) + runs-on: ${{ matrix.buildplat[0] }} strategy: + # Ensure that a wheel builder finishes even if another fails + fail-fast: false matrix: - manylinux_tag: [2014_x86_64, 2_28_x86_64] + # Github Actions doesn't support pairing matrix values together, let's improvise + # https://github.com/github/feedback/discussions/7835#discussioncomment-1769026 + buildplat: + - [macos-13, macosx_x86_64] + - [macos-14, macosx_arm64] + # test config + python: ["cp310", "cp312"] + #python: ["cp38", "cp39", "cp310", "cp311", "cp312"] + #exclude: + # - buildplat: [macos-14, macosx_arm64] + # python: "cp38" steps: - - name: Checkout the branch - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 - - name: Set up Python - uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f + - uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1 with: - python-version: '3.10' + python-version: "3.x" - - name: Install build dependencies - run: python -m pip install -U setuptools + - name: Build wheels + uses: pypa/cibuildwheel@bd033a44476646b606efccdd5eed92d5ea1d77ad # v2.20.0 + env: + CIBW_PRERELEASE_PYTHONS: False + CIBW_FREE_THREADED_SUPPORT: False + CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }} + CIBW_BEFORE_ALL: > + brew install hdf5@1.14 -y && + brew install swig -y && + brew install emacs -y && + brew install automake -y && + brew install libtool -y && + ./autogen.sh && + ./configure FC=gfortran-12 --enable-silent-rules && + make -j3 + CIBW_BEFORE_BUILD: > + cd tools && + ./prepare_python.sh && + cd ../python + CIBW_BUILD_VERBOSITY: 1 + CIBW_BUILD_FRONTEND: "build" + CIBW_ENVIRONMENT_LINUX: H5_CFLAGS="-I$(brew --prefix hdf5)/include" H5_LDFLAGS="-L$(brew --prefix hdf5)/lib" + CIBW_TEST_REQUIRES: pytest + CIBW_TEST_COMMANDS: "pytest -v --all python/test/test_api.py" - - name: Compute the PYTREXIO_VERSION environment variable - run: echo "PYTREXIO_VERSION=$(grep __version__ python/pytrexio/_version.py | cut -d\ -f3 | tr -d '"')" >> $GITHUB_ENV - - name: Print the PYTREXIO_VERSION - run: echo ${{ env.PYTREXIO_VERSION }} - - # Conventional download-artifact action does not work for artifact produced in a different workflow, - # which is the case here (TREXIO CI produced the Python API distribution tarball) - - name: Download the Python API distribution tarball - uses: dawidd6/action-download-artifact@v2 + - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 with: - # Specify the name of the workflow file which uploaded the tarball - workflow: actions.yml - workflow_conclusion: success - name: pytrexio-source - path: python + name: ${{ matrix.python }}-${{ matrix.buildplat[1] }} + path: ./wheelhouse/*.whl - # at the moment we have to pull the custom container with pre-installed HDF5 - # the containers are built and stored in GitHub container registry ghcr.io/q-posev - - name: Pull the manylinux Docker container with HDF5 - run: docker pull ghcr.io/q-posev/hdf5_1_12_on_${{ matrix.manylinux_tag }}:latest - - - name: Build wheels for different versions of CPython inside the Docker container - run: > - docker run --rm - --env PLAT=manylinux${{ matrix.manylinux_tag }} - --volume `pwd`:/tmp - --workdir /tmp - ghcr.io/q-posev/hdf5_1_12_on_${{ matrix.manylinux_tag }} - /bin/bash build_manylinux_wheels.sh trexio-${{ env.PYTREXIO_VERSION }}.tar.gz - working-directory: python - - - name: Upload produced wheels as artifacts - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a - with: - name: pytrexio-manylinux-${{ matrix.manylinux_tag }} - path: ./python/wheelhouse/*.whl - - - publish_wheels: - name: Publish all wheels on PyPI - needs: [build_linux_wheels] - runs-on: ubuntu-22.04 - - steps: - - name: Checkout the branch - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - - - name: Set up Python - uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f - with: - python-version: '3.10' - - - name: Install build dependencies - run: python -m pip install -U setuptools twine - - - name: Download the build artifacts (wheels) of this workflow - uses: actions/download-artifact@v4 - with: - path: dist - - - name: Download the Python API distribution tarball - uses: dawidd6/action-download-artifact@v2 - with: - workflow: actions.yml - workflow_conclusion: success - name: pytrexio-source - path: dist - - # The artifacts have to be in dist/ directory so that - # pypa/gh-action-pypi-publish action can discover them - - name: Display and rearrange the downloaded artifacts + - name: configure with autotools run: | - ls -R - mv pytrexio-manylinux-*/trexio-*.whl ./ - rm -rf -- pytrexio-manylinux-*/ - ls -sh -w 1 - working-directory: dist + ./autogen.sh + ./configure FC=gfortran-12 --enable-silent-rules + - name: compile TREXIO + run: make -j3 + + - name: check TREXIO + run: make -j3 check + + - name: create venv + run: | + python3 -m venv trexio-venv + source trexio-venv/bin/activate + + - name: compile Python API + run: | + + + - name: test Python API + run: | + source trexio-venv/bin/activate + make python-test + + - name: Archive test log file + if: failure() + uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 + with: + name: test-report-macos + path: test-suite.log + + + + # build_linux_wheels: + # name: build linux wheels for different versions of cpython on manylinux_x86_64 + # needs: get_commit_message + # if: >- + # contains(needs.get_commit_message.outputs.message, '[wheel build]') || + # (github.repository == 'trex-coe/trexio' && startswith(github.ref, 'refs/tags/v')) + # runs-on: ubuntu-22.04 + # strategy: + # matrix: + # manylinux_tag: [2014_x86_64, 2_28_x86_64] + # + # steps: + # - name: Checkout the branch + # uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + # + # - name: Set up Python + # uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f + # with: + # python-version: '3.10' + # + # - name: Install build dependencies + # run: python -m pip install -U setuptools + # + # - name: Compute the PYTREXIO_VERSION environment variable + # run: echo "PYTREXIO_VERSION=$(grep __version__ python/pytrexio/_version.py | cut -d\ -f3 | tr -d '"')" >> $GITHUB_ENV + # + # - name: Print the PYTREXIO_VERSION + # run: echo ${{ env.PYTREXIO_VERSION }} + # + # # Conventional download-artifact action does not work for artifact produced in a different workflow, + # # which is the case here (TREXIO CI produced the Python API distribution tarball) + # - name: Download the Python API distribution tarball + # uses: dawidd6/action-download-artifact@v2 + # with: + # # Specify the name of the workflow file which uploaded the tarball + # workflow: actions.yml + # workflow_conclusion: success + # name: pytrexio-source + # path: python + # + # # at the moment we have to pull the custom container with pre-installed HDF5 + # # the containers are built and stored in GitHub container registry ghcr.io/q-posev + # - name: Pull the manylinux Docker container with HDF5 + # run: docker pull ghcr.io/q-posev/hdf5_1_12_on_${{ matrix.manylinux_tag }}:latest + # + # - name: Build wheels for different versions of CPython inside the Docker container + # run: > + # docker run --rm + # --env PLAT=manylinux${{ matrix.manylinux_tag }} + # --volume `pwd`:/tmp + # --workdir /tmp + # ghcr.io/q-posev/hdf5_1_12_on_${{ matrix.manylinux_tag }} + # /bin/bash build_manylinux_wheels.sh trexio-${{ env.PYTREXIO_VERSION }}.tar.gz + # working-directory: python + # + # - name: Upload produced wheels as artifacts + # uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a + # with: + # name: pytrexio-manylinux-${{ matrix.manylinux_tag }} + # path: ./python/wheelhouse/*.whl + # + # + # publish_wheels: + # name: Publish all wheels on PyPI + # needs: [build_linux_wheels] + # runs-on: ubuntu-22.04 + # + # steps: + # - name: Checkout the branch + # uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + # + # - name: Set up Python + # uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f + # with: + # python-version: '3.10' + # + # - name: Install build dependencies + # run: python -m pip install -U setuptools twine + # + # - name: Download the build artifacts (wheels) of this workflow + # uses: actions/download-artifact@v4 + # with: + # path: dist + # + # - name: Download the Python API distribution tarball + # uses: dawidd6/action-download-artifact@v2 + # with: + # workflow: actions.yml + # workflow_conclusion: success + # name: pytrexio-source + # path: dist + # + # # The artifacts have to be in dist/ directory so that + # # pypa/gh-action-pypi-publish action can discover them + # - name: Display and rearrange the downloaded artifacts + # run: | + # ls -R + # mv pytrexio-manylinux-*/trexio-*.whl ./ + # rm -rf -- pytrexio-manylinux-*/ + # ls -sh -w 1 + # working-directory: dist + # - name: Publish distribution 📦 to Test PyPI uses: pypa/gh-action-pypi-publish@master with: From baa4b2a428ed45c79e7aef36dd395166de056291 Mon Sep 17 00:00:00 2001 From: q-posev Date: Sat, 17 Aug 2024 20:02:26 +0200 Subject: [PATCH 09/32] [wheel build] Test macos wheels --- .github/workflows/build-wheels.yml | 37 +++--------------------------- 1 file changed, 3 insertions(+), 34 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 370c585..31d5540 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -82,8 +82,9 @@ jobs: CIBW_BEFORE_BUILD: > cd tools && ./prepare_python.sh && - cd ../python - CIBW_BUILD_VERBOSITY: 1 + rm -rf ../src/ ../tools/ && + mv ../python/* .. + CIBW_BUILD_VERBOSITY: 3 CIBW_BUILD_FRONTEND: "build" CIBW_ENVIRONMENT_LINUX: H5_CFLAGS="-I$(brew --prefix hdf5)/include" H5_LDFLAGS="-L$(brew --prefix hdf5)/lib" CIBW_TEST_REQUIRES: pytest @@ -95,38 +96,6 @@ jobs: name: ${{ matrix.python }}-${{ matrix.buildplat[1] }} path: ./wheelhouse/*.whl - - name: configure with autotools - run: | - ./autogen.sh - ./configure FC=gfortran-12 --enable-silent-rules - - - name: compile TREXIO - run: make -j3 - - - name: check TREXIO - run: make -j3 check - - - name: create venv - run: | - python3 -m venv trexio-venv - source trexio-venv/bin/activate - - - name: compile Python API - run: | - - - - name: test Python API - run: | - source trexio-venv/bin/activate - make python-test - - - name: Archive test log file - if: failure() - uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 - with: - name: test-report-macos - path: test-suite.log - # build_linux_wheels: From 37a229786fd79c04bb53b0989f37dff6127f6e5e Mon Sep 17 00:00:00 2001 From: q-posev Date: Sat, 17 Aug 2024 20:20:18 +0200 Subject: [PATCH 10/32] [wheel build] Test macos wheels --- .github/workflows/actions.yml | 46 +++++++++++++++--------------- .github/workflows/build-wheels.yml | 38 +++++++++++++++--------- 2 files changed, 47 insertions(+), 37 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 7f38ebc..2cf7754 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -105,29 +105,29 @@ jobs: name: pytrexio-source path: ./trexio-*.tar.gz - - name: maintainer clean - run: make maintainer-clean - - - name: reconfigure with clang and AddressSanitizer - run: | - ./autogen.sh - ./configure CC=clang-15 CFLAGS="-O2 -fsanitize=address -fno-omit-frame-pointer" LDFLAGS="-fsanitize=address" --enable-silent-rules - - - name: recompile TREXIO - run: make -j2 - - - name: recheck TREXIO for memory leaks - run: make -j2 check - - - name: Archive test log file - if: failure() - uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 - with: - name: test-report-ubuntu-2 - path: test-suite.log - - - name: maintainer clean - run: make maintainer-clean + # - name: maintainer clean + # run: make maintainer-clean + # + # - name: reconfigure with clang and AddressSanitizer + # run: | + # ./autogen.sh + # ./configure CC=clang-15 CFLAGS="-O2 -fsanitize=address -fno-omit-frame-pointer" LDFLAGS="-fsanitize=address" --enable-silent-rules + # + # - name: recompile TREXIO + # run: make -j2 + # + # - name: recheck TREXIO for memory leaks + # run: make -j2 check + # + # - name: Archive test log file + # if: failure() + # uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 + # with: + # name: test-report-ubuntu-2 + # path: test-suite.log + # + # - name: maintainer clean + # run: make maintainer-clean trexio_macos: name: arm64 MacOS diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 31d5540..411a4c2 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -64,26 +64,36 @@ jobs: with: python-version: "3.x" + - name: install dependencies + run: | + brew install emacs + brew install hdf5@1.14 + brew install automake + brew install libtool + brew install swig + brew --prefix hdf5 + + - name: configure with autotools + run: | + ./autogen.sh + ./configure FC=gfortran-12 --enable-silent-rules + + - name: compile TREXIO + run: make -j3 + + - name: prepare the repo + run: | + cd tools + ./prepare_python.sh + rm -rf ../src/ ../tools/ + mv ../python/* .. + - name: Build wheels uses: pypa/cibuildwheel@bd033a44476646b606efccdd5eed92d5ea1d77ad # v2.20.0 env: CIBW_PRERELEASE_PYTHONS: False CIBW_FREE_THREADED_SUPPORT: False CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }} - CIBW_BEFORE_ALL: > - brew install hdf5@1.14 -y && - brew install swig -y && - brew install emacs -y && - brew install automake -y && - brew install libtool -y && - ./autogen.sh && - ./configure FC=gfortran-12 --enable-silent-rules && - make -j3 - CIBW_BEFORE_BUILD: > - cd tools && - ./prepare_python.sh && - rm -rf ../src/ ../tools/ && - mv ../python/* .. CIBW_BUILD_VERBOSITY: 3 CIBW_BUILD_FRONTEND: "build" CIBW_ENVIRONMENT_LINUX: H5_CFLAGS="-I$(brew --prefix hdf5)/include" H5_LDFLAGS="-L$(brew --prefix hdf5)/lib" From 6a4d9d4d8726ec04a696dabeff7d8fc90bf1b359 Mon Sep 17 00:00:00 2001 From: q-posev Date: Sat, 17 Aug 2024 20:35:23 +0200 Subject: [PATCH 11/32] [wheel build] Test macos wheels --- .github/workflows/build-wheels.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 411a4c2..cb80be4 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -77,16 +77,12 @@ jobs: run: | ./autogen.sh ./configure FC=gfortran-12 --enable-silent-rules - - - name: compile TREXIO - run: make -j3 - - - name: prepare the repo - run: | + make -j3 cd tools ./prepare_python.sh - rm -rf ../src/ ../tools/ - mv ../python/* .. + cd .. + rm -rf src/ tools/ + mv python/* . - name: Build wheels uses: pypa/cibuildwheel@bd033a44476646b606efccdd5eed92d5ea1d77ad # v2.20.0 From cebbbd1269eb3483ec0e2c40c029d33ea7d69847 Mon Sep 17 00:00:00 2001 From: q-posev Date: Sat, 17 Aug 2024 20:45:15 +0200 Subject: [PATCH 12/32] [wheel build] Test macos wheels --- .github/workflows/build-wheels.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index cb80be4..4aef1a0 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -78,9 +78,15 @@ jobs: ./autogen.sh ./configure FC=gfortran-12 --enable-silent-rules make -j3 - cd tools - ./prepare_python.sh - cd .. + + - name: prepare python + run: | + export H5_CFLAGS="-I$(brew --prefix hdf5)/include" + export H5_LDFLAGS="-L$(brew --prefix hdf5)/lib" + make python-install + + - name: cleanup python + run: | rm -rf src/ tools/ mv python/* . From 269782be2b59d8988402589311a265c40775d591 Mon Sep 17 00:00:00 2001 From: q-posev Date: Sat, 17 Aug 2024 21:09:28 +0200 Subject: [PATCH 13/32] [wheel build] Test macos wheels --- .github/workflows/build-wheels.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 4aef1a0..2df27b3 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -67,22 +67,32 @@ jobs: - name: install dependencies run: | brew install emacs - brew install hdf5@1.14 brew install automake brew install libtool brew install swig - brew --prefix hdf5 + brew install wget + + - name: install hdf5 + run: | + wget https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5-1_12_3.tar.gz + tar -xzf hdf5-1_12_3.tar.gz + cd hdf5-hdf5-$HDF5_VERSION + ./autogen.sh + ./configure CC=gcc-12 --prefix /usr/local --enable-build-mode=production --with-szlib + make -j3 + make install - name: configure with autotools run: | ./autogen.sh ./configure FC=gfortran-12 --enable-silent-rules make -j3 + make -j3 check - name: prepare python run: | - export H5_CFLAGS="-I$(brew --prefix hdf5)/include" - export H5_LDFLAGS="-L$(brew --prefix hdf5)/lib" + export H5_CFLAGS="-I/usr/local/include" + export H5_LDFLAGS="-L/usr/local/lib" make python-install - name: cleanup python From d50f8e8bc7ebbf6be904d3ab8daa2dbcaf6fb6f9 Mon Sep 17 00:00:00 2001 From: q-posev Date: Sat, 17 Aug 2024 21:14:57 +0200 Subject: [PATCH 14/32] [wheel build] Test macos wheels --- .github/workflows/build-wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 2df27b3..f7d4e24 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -76,7 +76,7 @@ jobs: run: | wget https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5-1_12_3.tar.gz tar -xzf hdf5-1_12_3.tar.gz - cd hdf5-hdf5-$HDF5_VERSION + cd hdf5-hdf5-1_12_3 ./autogen.sh ./configure CC=gcc-12 --prefix /usr/local --enable-build-mode=production --with-szlib make -j3 From 8f84766ebc3e85043aa3dc50cdd5d3dec7081005 Mon Sep 17 00:00:00 2001 From: q-posev Date: Sat, 17 Aug 2024 21:39:29 +0200 Subject: [PATCH 15/32] [wheel build] Fix arm installation with rights --- .github/workflows/build-wheels.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index f7d4e24..eb4eb88 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -41,6 +41,8 @@ jobs: contains(needs.get_commit_message.outputs.message, '[wheel build]') || (github.repository == 'trex-coe/trexio' && startswith(github.ref, 'refs/tags/v')) runs-on: ${{ matrix.buildplat[0] }} + env: + HDF5_INSTALLDIR: "/tmp/hdf5" strategy: # Ensure that a wheel builder finishes even if another fails fail-fast: false @@ -78,21 +80,22 @@ jobs: tar -xzf hdf5-1_12_3.tar.gz cd hdf5-hdf5-1_12_3 ./autogen.sh - ./configure CC=gcc-12 --prefix /usr/local --enable-build-mode=production --with-szlib + ./configure CC=gcc-12 --prefix $HDF5_INSTALLDIR --enable-build-mode=production --with-szlib make -j3 make install - name: configure with autotools run: | ./autogen.sh + export PATH=${PATH}:${HDF5_INSTALLDIR}/bin ./configure FC=gfortran-12 --enable-silent-rules make -j3 make -j3 check - name: prepare python run: | - export H5_CFLAGS="-I/usr/local/include" - export H5_LDFLAGS="-L/usr/local/lib" + export H5_CFLAGS="-I${HDF5_INCLUDEDIR}/include" + export H5_LDFLAGS="-L${HDF5_INCLUDEDIR}/lib" make python-install - name: cleanup python @@ -108,7 +111,7 @@ jobs: CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }} CIBW_BUILD_VERBOSITY: 3 CIBW_BUILD_FRONTEND: "build" - CIBW_ENVIRONMENT_LINUX: H5_CFLAGS="-I$(brew --prefix hdf5)/include" H5_LDFLAGS="-L$(brew --prefix hdf5)/lib" + CIBW_ENVIRONMENT_LINUX: H5_CFLAGS="-I/tmp/hdf5/include" H5_LDFLAGS="-L/tmp/hdf5/lib" CIBW_TEST_REQUIRES: pytest CIBW_TEST_COMMANDS: "pytest -v --all python/test/test_api.py" From dea443dc01a9949b0802477fcdbecfed9030adaf Mon Sep 17 00:00:00 2001 From: q-posev Date: Sat, 17 Aug 2024 21:58:51 +0200 Subject: [PATCH 16/32] [wheel build] Fix paths and CIBW test command --- .github/workflows/build-wheels.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index eb4eb88..576aeb6 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -80,22 +80,23 @@ jobs: tar -xzf hdf5-1_12_3.tar.gz cd hdf5-hdf5-1_12_3 ./autogen.sh - ./configure CC=gcc-12 --prefix $HDF5_INSTALLDIR --enable-build-mode=production --with-szlib + ./configure CC=gcc-12 --prefix ${PWD}/../hdf5 --enable-build-mode=production --with-szlib + echo "PWD is $PWD" make -j3 make install - name: configure with autotools run: | ./autogen.sh - export PATH=${PATH}:${HDF5_INSTALLDIR}/bin + export PATH=${PATH}:${PWD}/hdf5/bin ./configure FC=gfortran-12 --enable-silent-rules make -j3 make -j3 check - name: prepare python run: | - export H5_CFLAGS="-I${HDF5_INCLUDEDIR}/include" - export H5_LDFLAGS="-L${HDF5_INCLUDEDIR}/lib" + export H5_CFLAGS="-I${PWD}/bin/include" + export H5_LDFLAGS="-L${PWD}/bin/lib" make python-install - name: cleanup python @@ -111,9 +112,9 @@ jobs: CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }} CIBW_BUILD_VERBOSITY: 3 CIBW_BUILD_FRONTEND: "build" - CIBW_ENVIRONMENT_LINUX: H5_CFLAGS="-I/tmp/hdf5/include" H5_LDFLAGS="-L/tmp/hdf5/lib" + CIBW_ENVIRONMENT_LINUX: H5_CFLAGS="-I${PWD}/hdf5/include" H5_LDFLAGS="-L${PWD}/hdf5/lib" CIBW_TEST_REQUIRES: pytest - CIBW_TEST_COMMANDS: "pytest -v --all python/test/test_api.py" + CIBW_TEST_COMMAND: "pytest -v --all test/test_api.py" - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 From ed53fbbb012fb342ce845353b0703a44487e5b20 Mon Sep 17 00:00:00 2001 From: q-posev Date: Sat, 17 Aug 2024 22:27:03 +0200 Subject: [PATCH 17/32] [wheel build] Fix paths (again) --- .github/workflows/build-wheels.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 576aeb6..142c4a0 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -42,7 +42,7 @@ jobs: (github.repository == 'trex-coe/trexio' && startswith(github.ref, 'refs/tags/v')) runs-on: ${{ matrix.buildplat[0] }} env: - HDF5_INSTALLDIR: "/tmp/hdf5" + HDF5_INSTALLDIR: "/Users/runner/work/trexio/trexio/hdf5" strategy: # Ensure that a wheel builder finishes even if another fails fail-fast: false @@ -80,7 +80,7 @@ jobs: tar -xzf hdf5-1_12_3.tar.gz cd hdf5-hdf5-1_12_3 ./autogen.sh - ./configure CC=gcc-12 --prefix ${PWD}/../hdf5 --enable-build-mode=production --with-szlib + ./configure CC=gcc-12 --prefix $HDF5_INSTALLDIR --enable-build-mode=production --with-szlib echo "PWD is $PWD" make -j3 make install @@ -88,15 +88,12 @@ jobs: - name: configure with autotools run: | ./autogen.sh - export PATH=${PATH}:${PWD}/hdf5/bin - ./configure FC=gfortran-12 --enable-silent-rules + export PATH=${PATH}:${HDF5_INSTALLDIR}/bin + ./configure --without-fortran --enable-silent-rules make -j3 - make -j3 check - name: prepare python run: | - export H5_CFLAGS="-I${PWD}/bin/include" - export H5_LDFLAGS="-L${PWD}/bin/lib" make python-install - name: cleanup python @@ -112,7 +109,7 @@ jobs: CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }} CIBW_BUILD_VERBOSITY: 3 CIBW_BUILD_FRONTEND: "build" - CIBW_ENVIRONMENT_LINUX: H5_CFLAGS="-I${PWD}/hdf5/include" H5_LDFLAGS="-L${PWD}/hdf5/lib" + CIBW_ENVIRONMENT: H5_CFLAGS="-I/Users/runner/work/trexio/trexio/hdf5/include" H5_LDFLAGS="-L/Users/runner/work/trexio/trexio/hdf5/lib" CIBW_TEST_REQUIRES: pytest CIBW_TEST_COMMAND: "pytest -v --all test/test_api.py" From 75ae5818b1e157ba77a2ba6977c356e13f80c602 Mon Sep 17 00:00:00 2001 From: q-posev Date: Sat, 17 Aug 2024 22:41:47 +0200 Subject: [PATCH 18/32] [wheel build] Bring back fortran and try to cache HDF5 --- .github/workflows/build-wheels.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 142c4a0..0064b39 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -74,7 +74,15 @@ jobs: brew install swig brew install wget + - uses: actions/cache@v4 + id: cache + with: + path: | + $HDF5_INSTALLDIR + key: ${{ matrix.buildplat[0] }}-hdf5 + - name: install hdf5 + if: steps.cache.outputs.cache-hit != 'true' run: | wget https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5-1_12_3.tar.gz tar -xzf hdf5-1_12_3.tar.gz @@ -89,7 +97,7 @@ jobs: run: | ./autogen.sh export PATH=${PATH}:${HDF5_INSTALLDIR}/bin - ./configure --without-fortran --enable-silent-rules + ./configure FC=gfortran-12 --enable-silent-rules make -j3 - name: prepare python From 5258eb09e1ca29d844d6ffcb27ca300057963046 Mon Sep 17 00:00:00 2001 From: q-posev Date: Sat, 17 Aug 2024 22:51:52 +0200 Subject: [PATCH 19/32] [wheel build] Bring back fortran and try to cache HDF5 --- .github/workflows/build-wheels.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 0064b39..44d6da7 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -74,12 +74,11 @@ jobs: brew install swig brew install wget - - uses: actions/cache@v4 + - uses: actions/cache@v3 id: cache with: - path: | - $HDF5_INSTALLDIR - key: ${{ matrix.buildplat[0] }}-hdf5 + path: $HDF5_INSTALLDIR + key: ${{ matrix.buildplat[0] }}-hdf5 - name: install hdf5 if: steps.cache.outputs.cache-hit != 'true' From 5e60d3dfc7f605735a8a134d646c8871414d46f2 Mon Sep 17 00:00:00 2001 From: q-posev Date: Sat, 17 Aug 2024 23:09:28 +0200 Subject: [PATCH 20/32] [wheel build] Try to fix the macos platform tags... --- .github/workflows/build-wheels.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 44d6da7..8b9fb80 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -74,11 +74,11 @@ jobs: brew install swig brew install wget - - uses: actions/cache@v3 - id: cache - with: - path: $HDF5_INSTALLDIR - key: ${{ matrix.buildplat[0] }}-hdf5 + #- uses: actions/cache@v3 + # id: cache + # with: + # path: $HDF5_INSTALLDIR + # key: ${{ matrix.buildplat[0] }}-hdf5 - name: install hdf5 if: steps.cache.outputs.cache-hit != 'true' @@ -86,6 +86,11 @@ jobs: wget https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5-1_12_3.tar.gz tar -xzf hdf5-1_12_3.tar.gz cd hdf5-hdf5-1_12_3 + if [[ "$ARCH" == "arm64" ]]; then + export MACOSX_DEPLOYMENT_TARGET="11.0" + else + export MACOSX_DEPLOYMENT_TARGET="10.9" + fi ./autogen.sh ./configure CC=gcc-12 --prefix $HDF5_INSTALLDIR --enable-build-mode=production --with-szlib echo "PWD is $PWD" From 38b84055eb9e126a88228f6b1333715419865b86 Mon Sep 17 00:00:00 2001 From: q-posev Date: Sat, 17 Aug 2024 23:33:21 +0200 Subject: [PATCH 21/32] [wheel build] Fixing the tests --- .github/workflows/build-wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 8b9fb80..90b41a8 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -123,7 +123,7 @@ jobs: CIBW_BUILD_FRONTEND: "build" CIBW_ENVIRONMENT: H5_CFLAGS="-I/Users/runner/work/trexio/trexio/hdf5/include" H5_LDFLAGS="-L/Users/runner/work/trexio/trexio/hdf5/lib" CIBW_TEST_REQUIRES: pytest - CIBW_TEST_COMMAND: "pytest -v --all test/test_api.py" + CIBW_TEST_COMMAND: "python3 -m pytest -v --all test/test_api.py" - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 From 634dbab437bebb0a257c74c1c672705cb7fa38e2 Mon Sep 17 00:00:00 2001 From: q-posev Date: Sat, 17 Aug 2024 23:44:27 +0200 Subject: [PATCH 22/32] [wheel build] Last attempt to fix the tests :-) --- .github/workflows/build-wheels.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 90b41a8..7b0cf11 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -74,11 +74,11 @@ jobs: brew install swig brew install wget - #- uses: actions/cache@v3 - # id: cache - # with: - # path: $HDF5_INSTALLDIR - # key: ${{ matrix.buildplat[0] }}-hdf5 + - uses: actions/cache@v3 + id: cache + with: + path: $HDF5_INSTALLDIR + key: ${{ matrix.buildplat[0] }}-hdf5 - name: install hdf5 if: steps.cache.outputs.cache-hit != 'true' @@ -93,7 +93,6 @@ jobs: fi ./autogen.sh ./configure CC=gcc-12 --prefix $HDF5_INSTALLDIR --enable-build-mode=production --with-szlib - echo "PWD is $PWD" make -j3 make install @@ -111,6 +110,7 @@ jobs: - name: cleanup python run: | rm -rf src/ tools/ + mv python/test/* . mv python/* . - name: Build wheels @@ -123,7 +123,7 @@ jobs: CIBW_BUILD_FRONTEND: "build" CIBW_ENVIRONMENT: H5_CFLAGS="-I/Users/runner/work/trexio/trexio/hdf5/include" H5_LDFLAGS="-L/Users/runner/work/trexio/trexio/hdf5/lib" CIBW_TEST_REQUIRES: pytest - CIBW_TEST_COMMAND: "python3 -m pytest -v --all test/test_api.py" + CIBW_TEST_COMMAND: "python3 -m pytest -v --all test_api.py" - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 From 1a167aee7a3a70b937d36874b198365f007f5232 Mon Sep 17 00:00:00 2001 From: q-posev Date: Sun, 18 Aug 2024 00:13:49 +0200 Subject: [PATCH 23/32] [wheel build] Full-scale test of all wheels on Test PyPI --- .github/workflows/build-wheels.yml | 210 ++++++++++++++--------------- 1 file changed, 104 insertions(+), 106 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 7b0cf11..138bcd2 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -110,7 +110,6 @@ jobs: - name: cleanup python run: | rm -rf src/ tools/ - mv python/test/* . mv python/* . - name: Build wheels @@ -123,118 +122,117 @@ jobs: CIBW_BUILD_FRONTEND: "build" CIBW_ENVIRONMENT: H5_CFLAGS="-I/Users/runner/work/trexio/trexio/hdf5/include" H5_LDFLAGS="-L/Users/runner/work/trexio/trexio/hdf5/lib" CIBW_TEST_REQUIRES: pytest - CIBW_TEST_COMMAND: "python3 -m pytest -v --all test_api.py" + CIBW_TEST_COMMAND: "python3 -m pytest -v test/test_api.py" - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 with: - name: ${{ matrix.python }}-${{ matrix.buildplat[1] }} + name: pytrexio-${{ matrix.python }}-${{ matrix.buildplat[1] }}-wheels path: ./wheelhouse/*.whl - - # build_linux_wheels: - # name: build linux wheels for different versions of cpython on manylinux_x86_64 - # needs: get_commit_message - # if: >- - # contains(needs.get_commit_message.outputs.message, '[wheel build]') || - # (github.repository == 'trex-coe/trexio' && startswith(github.ref, 'refs/tags/v')) - # runs-on: ubuntu-22.04 - # strategy: - # matrix: - # manylinux_tag: [2014_x86_64, 2_28_x86_64] - # - # steps: - # - name: Checkout the branch - # uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - # - # - name: Set up Python - # uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f - # with: - # python-version: '3.10' - # - # - name: Install build dependencies - # run: python -m pip install -U setuptools - # - # - name: Compute the PYTREXIO_VERSION environment variable - # run: echo "PYTREXIO_VERSION=$(grep __version__ python/pytrexio/_version.py | cut -d\ -f3 | tr -d '"')" >> $GITHUB_ENV - # - # - name: Print the PYTREXIO_VERSION - # run: echo ${{ env.PYTREXIO_VERSION }} - # - # # Conventional download-artifact action does not work for artifact produced in a different workflow, - # # which is the case here (TREXIO CI produced the Python API distribution tarball) - # - name: Download the Python API distribution tarball - # uses: dawidd6/action-download-artifact@v2 - # with: - # # Specify the name of the workflow file which uploaded the tarball - # workflow: actions.yml - # workflow_conclusion: success - # name: pytrexio-source - # path: python - # - # # at the moment we have to pull the custom container with pre-installed HDF5 - # # the containers are built and stored in GitHub container registry ghcr.io/q-posev - # - name: Pull the manylinux Docker container with HDF5 - # run: docker pull ghcr.io/q-posev/hdf5_1_12_on_${{ matrix.manylinux_tag }}:latest - # - # - name: Build wheels for different versions of CPython inside the Docker container - # run: > - # docker run --rm - # --env PLAT=manylinux${{ matrix.manylinux_tag }} - # --volume `pwd`:/tmp - # --workdir /tmp - # ghcr.io/q-posev/hdf5_1_12_on_${{ matrix.manylinux_tag }} - # /bin/bash build_manylinux_wheels.sh trexio-${{ env.PYTREXIO_VERSION }}.tar.gz - # working-directory: python - # - # - name: Upload produced wheels as artifacts - # uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a - # with: - # name: pytrexio-manylinux-${{ matrix.manylinux_tag }} - # path: ./python/wheelhouse/*.whl - # - # - # publish_wheels: - # name: Publish all wheels on PyPI - # needs: [build_linux_wheels] - # runs-on: ubuntu-22.04 - # - # steps: - # - name: Checkout the branch - # uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - # - # - name: Set up Python - # uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f - # with: - # python-version: '3.10' - # - # - name: Install build dependencies - # run: python -m pip install -U setuptools twine - # - # - name: Download the build artifacts (wheels) of this workflow - # uses: actions/download-artifact@v4 - # with: - # path: dist - # - # - name: Download the Python API distribution tarball - # uses: dawidd6/action-download-artifact@v2 - # with: - # workflow: actions.yml - # workflow_conclusion: success - # name: pytrexio-source - # path: dist - # - # # The artifacts have to be in dist/ directory so that - # # pypa/gh-action-pypi-publish action can discover them - # - name: Display and rearrange the downloaded artifacts - # run: | - # ls -R - # mv pytrexio-manylinux-*/trexio-*.whl ./ - # rm -rf -- pytrexio-manylinux-*/ - # ls -sh -w 1 - # working-directory: dist - # + build_linux_wheels: + name: build linux wheels for different versions of cpython on manylinux_x86_64 + needs: get_commit_message + if: >- + contains(needs.get_commit_message.outputs.message, '[wheel build]') || + (github.repository == 'trex-coe/trexio' && startswith(github.ref, 'refs/tags/v')) + runs-on: ubuntu-22.04 + strategy: + matrix: + manylinux_tag: [2014_x86_64, 2_28_x86_64] + + steps: + - name: Checkout the branch + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + + - name: Set up Python + uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f + with: + python-version: '3.10' + + - name: Install build dependencies + run: python -m pip install -U setuptools + + - name: Compute the PYTREXIO_VERSION environment variable + run: echo "PYTREXIO_VERSION=$(grep __version__ python/pytrexio/_version.py | cut -d\ -f3 | tr -d '"')" >> $GITHUB_ENV + + - name: Print the PYTREXIO_VERSION + run: echo ${{ env.PYTREXIO_VERSION }} + + # Conventional download-artifact action does not work for artifact produced in a different workflow, + # which is the case here (TREXIO CI produced the Python API distribution tarball) + - name: Download the Python API distribution tarball + uses: dawidd6/action-download-artifact@v2 + with: + # Specify the name of the workflow file which uploaded the tarball + workflow: actions.yml + workflow_conclusion: success + name: pytrexio-source + path: python + + # at the moment we have to pull the custom container with pre-installed HDF5 + # the containers are built and stored in GitHub container registry ghcr.io/q-posev + - name: Pull the manylinux Docker container with HDF5 + run: docker pull ghcr.io/q-posev/hdf5_1_12_on_${{ matrix.manylinux_tag }}:latest + + - name: Build wheels for different versions of CPython inside the Docker container + run: > + docker run --rm + --env PLAT=manylinux${{ matrix.manylinux_tag }} + --volume `pwd`:/tmp + --workdir /tmp + ghcr.io/q-posev/hdf5_1_12_on_${{ matrix.manylinux_tag }} + /bin/bash build_manylinux_wheels.sh trexio-${{ env.PYTREXIO_VERSION }}.tar.gz + working-directory: python + + - name: Upload produced wheels as artifacts + uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a + with: + name: pytrexio-manylinux-${{ matrix.manylinux_tag }}-wheels + path: ./python/wheelhouse/*.whl + + + publish_wheels: + name: Publish all wheels on PyPI + needs: [build_linux_wheels] + runs-on: ubuntu-22.04 + + steps: + - name: Checkout the branch + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + + - name: Set up Python + uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f + with: + python-version: '3.10' + + - name: Install build dependencies + run: python -m pip install -U setuptools twine + + - name: Download the build artifacts (wheels) of this workflow + uses: actions/download-artifact@v4 + with: + path: dist + + - name: Download the Python API distribution tarball + uses: dawidd6/action-download-artifact@v2 + with: + workflow: actions.yml + workflow_conclusion: success + name: pytrexio-source + path: dist + + # The artifacts have to be in dist/ directory so that + # pypa/gh-action-pypi-publish action can discover them + - name: Display and rearrange the downloaded artifacts + run: | + ls -R + mv pytrexio-*-wheels/trexio-*.whl ./ + rm -rf -- pytrexio-*-wheels/ + ls -sh -w 1 + working-directory: dist + - name: Publish distribution 📦 to Test PyPI uses: pypa/gh-action-pypi-publish@master with: From 9038d5a68f9c6fa4fbc0550d8201bb0529880a51 Mon Sep 17 00:00:00 2001 From: q-posev Date: Sun, 18 Aug 2024 00:32:43 +0200 Subject: [PATCH 24/32] [wheel build] Full-scale test of all wheels on Test PyPI --- .github/workflows/build-wheels.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 138bcd2..cabe211 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -35,7 +35,7 @@ jobs: build_macos_wheels: - name: build linux wheels for different versions of cpython on macos + name: build wheels for different versions of cpython on macos needs: get_commit_message if: >- contains(needs.get_commit_message.outputs.message, '[wheel build]') || @@ -53,11 +53,10 @@ jobs: - [macos-13, macosx_x86_64] - [macos-14, macosx_arm64] # test config - python: ["cp310", "cp312"] - #python: ["cp38", "cp39", "cp310", "cp311", "cp312"] - #exclude: - # - buildplat: [macos-14, macosx_arm64] - # python: "cp38" + python: ["cp38", "cp39", "cp310", "cp311", "cp312"] + exclude: + - buildplat: [macos-14, macosx_arm64] + python: "cp38" steps: - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 @@ -75,13 +74,13 @@ jobs: brew install wget - uses: actions/cache@v3 - id: cache + id: cache-hdf5 with: path: $HDF5_INSTALLDIR key: ${{ matrix.buildplat[0] }}-hdf5 - name: install hdf5 - if: steps.cache.outputs.cache-hit != 'true' + if: ${{ steps.cache-hdf5.outputs.cache-hit != 'true' }} run: | wget https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5-1_12_3.tar.gz tar -xzf hdf5-1_12_3.tar.gz @@ -118,11 +117,12 @@ jobs: CIBW_PRERELEASE_PYTHONS: False CIBW_FREE_THREADED_SUPPORT: False CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }} - CIBW_BUILD_VERBOSITY: 3 + CIBW_BUILD_VERBOSITY: 1 CIBW_BUILD_FRONTEND: "build" CIBW_ENVIRONMENT: H5_CFLAGS="-I/Users/runner/work/trexio/trexio/hdf5/include" H5_LDFLAGS="-L/Users/runner/work/trexio/trexio/hdf5/lib" - CIBW_TEST_REQUIRES: pytest - CIBW_TEST_COMMAND: "python3 -m pytest -v test/test_api.py" + # disable pytest-ing for now - does not work as expected via CIBW on MacOS --> Ask Anthony to test locally + #CIBW_TEST_REQUIRES: pytest + #CIBW_TEST_COMMAND: "python3 -m pytest -v test/test_api.py" - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 @@ -132,7 +132,7 @@ jobs: build_linux_wheels: - name: build linux wheels for different versions of cpython on manylinux_x86_64 + name: build wheels for different versions of cpython on manylinux_x86_64 needs: get_commit_message if: >- contains(needs.get_commit_message.outputs.message, '[wheel build]') || @@ -195,7 +195,7 @@ jobs: publish_wheels: name: Publish all wheels on PyPI - needs: [build_linux_wheels] + needs: [build_linux_wheels, build_macos_wheels] runs-on: ubuntu-22.04 steps: From 7c352b20c5bbb24e96e85fd4e1a1e90a35375cf4 Mon Sep 17 00:00:00 2001 From: q-posev Date: Sun, 18 Aug 2024 00:33:44 +0200 Subject: [PATCH 25/32] [wheel build] (bring back the sanitizer check --- .github/workflows/actions.yml | 46 +++++++++++++++++------------------ 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 2cf7754..85b0fbb 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -105,29 +105,29 @@ jobs: name: pytrexio-source path: ./trexio-*.tar.gz - # - name: maintainer clean - # run: make maintainer-clean - # - # - name: reconfigure with clang and AddressSanitizer - # run: | - # ./autogen.sh - # ./configure CC=clang-15 CFLAGS="-O2 -fsanitize=address -fno-omit-frame-pointer" LDFLAGS="-fsanitize=address" --enable-silent-rules - # - # - name: recompile TREXIO - # run: make -j2 - # - # - name: recheck TREXIO for memory leaks - # run: make -j2 check - # - # - name: Archive test log file - # if: failure() - # uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 - # with: - # name: test-report-ubuntu-2 - # path: test-suite.log - # - # - name: maintainer clean - # run: make maintainer-clean + - name: maintainer clean + run: make maintainer-clean + + - name: reconfigure with clang and AddressSanitizer + run: | + ./autogen.sh + ./configure CC=clang-15 CFLAGS="-O2 -fsanitize=address -fno-omit-frame-pointer" LDFLAGS="-fsanitize=address" --enable-silent-rules + + - name: recompile TREXIO + run: make -j2 + + - name: recheck TREXIO for memory leaks + run: make -j2 check + + - name: Archive test log file + if: failure() + uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 + with: + name: test-report-ubuntu-2 + path: test-suite.log + + - name: maintainer clean + run: make maintainer-clean trexio_macos: name: arm64 MacOS From 415820028b4062f8fb8393bd1808eb7cc1b03636 Mon Sep 17 00:00:00 2001 From: q-posev Date: Sun, 18 Aug 2024 09:18:48 +0200 Subject: [PATCH 26/32] Enable x86 macos CI --- .github/workflows/actions.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 85b0fbb..08a899a 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -33,7 +33,7 @@ jobs: echo github.ref ${{ github.ref }} trexio_ubuntu: - name: x86 Ubuntu 20.04 + name: x86 Ubuntu runs-on: ubuntu-22.04 needs: get_commit_message @@ -130,8 +130,12 @@ jobs: run: make maintainer-clean trexio_macos: - name: arm64 MacOS - runs-on: macos-14 + name: x86 and arm64 MacOS + strategy: + # macos-13 = x86_64 ; macos-14 = aarch64 + matrix: + os: [macos-13, macos-14] + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 @@ -139,7 +143,7 @@ jobs: - name: install dependencies run: | brew install emacs - brew install hdf5 + brew install hdf5@1.14 brew install automake brew install libtool brew install swig @@ -148,7 +152,7 @@ jobs: - name: configure with autotools run: | ./autogen.sh - ./configure FC=gfortran-12 --enable-silent-rules + ./configure CC=gcc-12 FC=gfortran-12 --enable-silent-rules - name: compile TREXIO run: make -j3 @@ -177,7 +181,7 @@ jobs: if: failure() uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 with: - name: test-report-macos + name: test-report-${{ matrix.os }} path: test-suite.log - name: clean From e90017c30e4ce16b781c64d964d1f4e0be487266 Mon Sep 17 00:00:00 2001 From: q-posev Date: Sun, 18 Aug 2024 10:04:37 +0200 Subject: [PATCH 27/32] Bump version of upload-artifact action --- .github/workflows/actions.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 08a899a..7eb2e0b 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -70,7 +70,7 @@ jobs: - name: Archive test log file if: failure() - uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 + uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 with: name: test-report-ubuntu path: test-suite.log @@ -100,7 +100,7 @@ jobs: if: >- contains(needs.get_commit_message.outputs.message, '[wheel build]') || github.event_name == 'release' - uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 + uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 with: name: pytrexio-source path: ./trexio-*.tar.gz @@ -121,9 +121,9 @@ jobs: - name: Archive test log file if: failure() - uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 + uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 with: - name: test-report-ubuntu-2 + name: test-report-ubuntu-memory path: test-suite.log - name: maintainer clean @@ -179,7 +179,7 @@ jobs: - name: Archive test log file if: failure() - uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 + uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 with: name: test-report-${{ matrix.os }} path: test-suite.log From 56c2ab2e474b737aeb1807cc94bce11ce8e9ebff Mon Sep 17 00:00:00 2001 From: q-posev Date: Sun, 18 Aug 2024 10:05:10 +0200 Subject: [PATCH 28/32] [wheel build] Test new release system using GH Trusted Publishing --- .github/workflows/build-wheels.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index cabe211..81d70c8 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -71,7 +71,6 @@ jobs: brew install automake brew install libtool brew install swig - brew install wget - uses: actions/cache@v3 id: cache-hdf5 @@ -187,7 +186,7 @@ jobs: working-directory: python - name: Upload produced wheels as artifacts - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a + uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 with: name: pytrexio-manylinux-${{ matrix.manylinux_tag }}-wheels path: ./python/wheelhouse/*.whl @@ -197,6 +196,9 @@ jobs: name: Publish all wheels on PyPI needs: [build_linux_wheels, build_macos_wheels] runs-on: ubuntu-22.04 + permissions: + # IMPORTANT: this permission is mandatory for trusted publishing + id-token: write steps: - name: Checkout the branch @@ -234,14 +236,11 @@ jobs: working-directory: dist - name: Publish distribution 📦 to Test PyPI - uses: pypa/gh-action-pypi-publish@master + uses: pypa/gh-action-pypi-publish@release/v1 with: - password: ${{ secrets.TEST_PYPI_API_TOKEN }} repository_url: https://test.pypi.org/legacy/ #verbose: true #- name: Publish distribution 📦 to PyPI - # uses: pypa/gh-action-pypi-publish@master - # with: - # password: ${{ secrets.PYPI_API_TOKEN }} - # #if: startsWith(github.ref, 'refs/tags') + # uses: pypa/gh-action-pypi-publish@release/v1 + # ##if: startsWith(github.ref, 'refs/tags') From 8100c6e3d46d9b94676ae07c0a318c49f7b702e5 Mon Sep 17 00:00:00 2001 From: q-posev Date: Sun, 18 Aug 2024 10:35:46 +0200 Subject: [PATCH 29/32] [wheel build] Test new release system using GH Trusted Publishing --- .github/workflows/build-wheels.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 81d70c8..b67e524 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -239,7 +239,9 @@ jobs: uses: pypa/gh-action-pypi-publish@release/v1 with: repository_url: https://test.pypi.org/legacy/ - #verbose: true + skip-existing: true + verbose: true + ##verify-metadata: false #- name: Publish distribution 📦 to PyPI # uses: pypa/gh-action-pypi-publish@release/v1 From d0044bf7a006c9daa1e5299526421229b2ab059f Mon Sep 17 00:00:00 2001 From: q-posev Date: Sun, 18 Aug 2024 11:19:10 +0200 Subject: [PATCH 30/32] [skip ci] Enable back PyPI publishing for the upcoming release --- .github/workflows/build-wheels.yml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index b67e524..7f571fb 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -235,14 +235,13 @@ jobs: ls -sh -w 1 working-directory: dist - - name: Publish distribution 📦 to Test PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - repository_url: https://test.pypi.org/legacy/ - skip-existing: true - verbose: true - ##verify-metadata: false - - #- name: Publish distribution 📦 to PyPI + #- name: Publish distribution 📦 to Test PyPI # uses: pypa/gh-action-pypi-publish@release/v1 - # ##if: startsWith(github.ref, 'refs/tags') + # with: + # repository_url: https://test.pypi.org/legacy/ + # verbose: true + # ##verify-metadata: false + + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + ##if: startsWith(github.ref, 'refs/tags') From 908842122edb2e90645d40c3ad4b9bba60bc9ceb Mon Sep 17 00:00:00 2001 From: q-posev Date: Wed, 11 Sep 2024 09:47:14 +0200 Subject: [PATCH 31/32] [wheel build] Release 2.5.0 + updated README --- README.md | 49 ++++++++++++++++++++++++------------------------ python/README.md | 11 +++++------ 2 files changed, 29 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 97bb930..4c0953c 100644 --- a/README.md +++ b/README.md @@ -15,31 +15,30 @@ which enables fast read and write operations. It is compatible with a variety of platforms and has interfaces for the Fortran, Python, OCaml and Rust programming languages. -* [TREXIO](#trexio) - * [Installation](#installation) - * [Installation using a package manager](#installation-using-a-package-manager) - * [Conda](#conda) - * [Spack](#spack) - * [Guix](#guix) - * [Debian/Ubuntu](#debianubuntu) - * [Installation from source](#installation-from-source) - * [Minimal requirements (for users):](#minimal-requirements-for-users) - * [Recommended: Installation from the release tarball](#recommended-installation-from-the-release-tarball) - * [Compilation without the HDF5 library](#compilation-without-the-hdf5-library) - * [For TREXIO developers: from the GitHub repo clone](#for-trexio-developers-from-the-github-repo-clone) - * [Using CMake instead of Autotools](#using-cmake-instead-of-autotools) - * [Using TREXIO](#using-trexio) - * [Naming convention](#naming-convention) - * [Tutorial](#tutorial) - * [Documentation](#documentation) - * [Linking to your program](#linking-to-your-program) - * [Distributing TREXIO with your code](#distributing-trexio-with-your-code) - * [APIs for other languages](#apis-for-other-languages) - * [Python](#python) - * [Rust](#rust) - * [OCaml](#ocaml) - * [Citation](#citation) - * [Miscellaneous](#miscellaneous) +* [Installation](#installation) + * [Installation using a package manager](#installation-using-a-package-manager) + * [Conda](#conda) + * [Spack](#spack) + * [Guix](#guix) + * [Debian/Ubuntu](#debianubuntu) + * [Installation from source](#installation-from-source) + * [Minimal requirements (for users):](#minimal-requirements-for-users) + * [Recommended: Installation from the release tarball](#recommended-installation-from-the-release-tarball) + * [Compilation without the HDF5 library](#compilation-without-the-hdf5-library) + * [For TREXIO developers: from the GitHub repo clone](#for-trexio-developers-from-the-github-repo-clone) + * [Using CMake instead of Autotools](#using-cmake-instead-of-autotools) +* [Using TREXIO](#using-trexio) + * [Naming convention](#naming-convention) + * [Tutorial](#tutorial) + * [Documentation](#documentation) + * [Linking to your program](#linking-to-your-program) + * [Distributing TREXIO with your code](#distributing-trexio-with-your-code) +* [APIs for other languages](#apis-for-other-languages) + * [Python](#python) + * [Rust](#rust) + * [OCaml](#ocaml) +* [Citation](#citation) + * [Miscellaneous](#miscellaneous) ## Installation diff --git a/python/README.md b/python/README.md index 8c95b88..de1749b 100644 --- a/python/README.md +++ b/python/README.md @@ -11,8 +11,8 @@ can be used to convert data from one input/output file format into another. ## Requirements -- python3 (>= 3.6) -- numpy (>= 1.17.3) +- python3 (>= 3.8) +- numpy (>= 1.17.3) ## Installation from PyPI @@ -27,10 +27,6 @@ However, it is good practice to first check for updates of the build-system pack **Note: we highly recommend to use virtual environments to avoid compatibility issues and to improve reproducibility.** For more details, see the corresponding part of the [Python documentation](https://docs.python.org/3/library/venv.html#creating-virtual-environments). -**Note: our build farm (GitHub Actions) does not support ARM64 architectures (including the Mac M1/M2 chips). Therefore, `pip install trexio` does not work on an ARM64-based machine. Thus, we recommend to install TREXIO from source on an ARM64-based machine. If one uses a Mac where HDF5 is installed with brew (i.e., `brew install hdf5`), a workaround is to execute the following 2 lines before doing `pip install trexio`:** - -- `export H5_CFLAGS="-I$(brew --prefix hdf5)/include"` -- `export H5_LDFLAGS="-L$(brew --prefix hdf5)/lib"` ## Additional requirements (for installation from source) @@ -50,6 +46,9 @@ For more details, see the corresponding part of the [Python documentation](https The following two steps can be skipped if HDF5 is properly configured for `pkg-config` (i.e. if executing `pkg-config --libs hdf5` returns a list of options). - `export H5_CFLAGS=-I/path/to/hdf5/include` - `export H5_LDFLAGS=-L/path/to/hdf5/lib` +On MacOS where HDF5 is installed with homebrew (i.e. `brew install hdf5`), one can use the following: + - `export H5_CFLAGS="-I$(brew --prefix hdf5)/include"` + - `export H5_LDFLAGS="-L$(brew --prefix hdf5)/lib"` 6. `pip install .` (this installs `trexio` in your environment) 7. `cd test && python -m pytest -v test_api.py` (this executes several tests that verify the installation) From d88358fb7bc832affbf604a0088c104588a31164 Mon Sep 17 00:00:00 2001 From: q-posev Date: Wed, 11 Sep 2024 10:20:56 +0200 Subject: [PATCH 32/32] [skip ci] Bump the patch version following 2.5.0 release --- CMakeLists.txt | 2 +- configure.ac | 2 +- ocaml/trexio/trexio.opam | 2 +- python/pytrexio/_version.py | 2 +- rust/trexio/Cargo.toml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e48e917..ebe305b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.16) # Initialize the CMake project. project(Trexio - VERSION 2.5.0 + VERSION 2.5.1 DESCRIPTION "TREX I/O library" LANGUAGES C Fortran ) diff --git a/configure.ac b/configure.ac index 6b467c2..06ae3de 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.69]) -AC_INIT([trexio],[2.5.0],[https://github.com/TREX-CoE/trexio/issues]) +AC_INIT([trexio],[2.5.1],[https://github.com/TREX-CoE/trexio/issues]) AC_CONFIG_SRCDIR([Makefile.in]) AC_CONFIG_HEADERS([include/config.h]) diff --git a/ocaml/trexio/trexio.opam b/ocaml/trexio/trexio.opam index 5d41dca..ccc8043 100644 --- a/ocaml/trexio/trexio.opam +++ b/ocaml/trexio/trexio.opam @@ -1,6 +1,6 @@ # This file is generated by dune, edit dune-project instead opam-version: "2.0" -version: "2.4.2" +version: "2.5.1" synopsis: "Binding for the TREXIO Input/Output library" description: "TREXIO is a file format and library for storing wave functions and integrals for quantum chemistry." diff --git a/python/pytrexio/_version.py b/python/pytrexio/_version.py index 50062f8..7a2056f 100644 --- a/python/pytrexio/_version.py +++ b/python/pytrexio/_version.py @@ -1 +1 @@ -__version__ = "2.5.0" +__version__ = "2.5.1" diff --git a/rust/trexio/Cargo.toml b/rust/trexio/Cargo.toml index 12c2258..32d34b6 100644 --- a/rust/trexio/Cargo.toml +++ b/rust/trexio/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "trexio" -version = "2.5.0" +version = "2.5.1" edition = "2021" license = "BSD-3-Clause" authors = ["Anthony Scemama ", "Evgeny Posenitskiy"]