From 4c493712aac97f118a4b427341c96ea155a803d7 Mon Sep 17 00:00:00 2001 From: Ollie Copping Date: Wed, 14 Aug 2024 15:11:28 +0100 Subject: [PATCH 1/6] Update Numpy and Cython for Python 3.9, 10 and 11 builds --- .github/workflows/build.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 481a822..e268224 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -94,22 +94,22 @@ jobs: os: ubuntu-latest pyver: cp39-cp39 piparch: manylinux2010_x86_64 - numpy: numpy==1.19.3 - cython: Cython==0.29.23 + numpy: numpy==2.0.1 + cython: Cython==3.0.10 - name: linux 3.10 amd64 os: ubuntu-latest pyver: cp310-cp310 piparch: manylinux2014_x86_64 - numpy: numpy==1.22.0 - cython: Cython==0.29.23 + numpy: numpy==2.0.1 + cython: Cython==3.0.10 - name: linux 3.11 amd64 os: ubuntu-latest pyver: cp311-cp311 piparch: manylinux2014_x86_64 - numpy: numpy==1.23.5 - cython: Cython==0.29.35 + numpy: numpy==2.0.1 + cython: Cython==3.0.10 - name: linux 3.12 amd64 os: ubuntu-latest From 0243daecc02853da116ca93de243ed5db97772ed Mon Sep 17 00:00:00 2001 From: Ollie Copping Date: Thu, 15 Aug 2024 08:32:21 +0100 Subject: [PATCH 2/6] Change Numpy version dependencies --- pyproject.toml | 3 +-- setup.py | 24 +++++++++++++++--------- src/p4p.h | 1 + 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 767d25b..77bd054 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,8 +4,7 @@ requires = [ "setuptools_dso>=2.7a1,<=2.10; python_version<='3.11'", "setuptools_dso>=2.11a2; python_version>='3.12'", "wheel", - "numpy", - "numpy>=2.0.1; python_version>='3.10'", + "numpy>=1.7", "Cython>=0.20", "epicscorelibs==7.0.7.99.0.2; python_version<='3.11'", "epicscorelibs>=7.0.7.99.1.1a2; python_version>='3.12'", diff --git a/setup.py b/setup.py index 57af131..167aeaa 100755 --- a/setup.py +++ b/setup.py @@ -93,6 +93,20 @@ def get_numpy_include_dirs(): with open(os.path.join(os.path.dirname(__file__), 'README.md')) as F: long_description = F.read() +install_requires = [ + epicscorelibs.version.abi_requires(), + pvxslibs.version.abi_requires(), + 'nose2>=0.8.0', + 'ply', # for asLib +] + +if numpy.lib.NumpyVersion(numpy.__version__) >= '2.0.0b1': + install_requires += ['numpy >= 1.7', 'numpy < 3'] +else: + # assume ABI forward compatibility as indicated by + # https://github.com/numpy/numpy/blob/master/numpy/core/setup_common.py#L28 + install_requires += ['numpy >=%s'%numpy.version.short_version, 'numpy < 2'] + setup( name='p4p', version=package_version, @@ -131,15 +145,7 @@ def get_numpy_include_dirs(): package_dir={'':'src'}, package_data={'p4p': ['*.conf', '*.service']}, ext_modules = exts, - install_requires = [ - epicscorelibs.version.abi_requires(), - pvxslibs.version.abi_requires(), - # assume ABI forward compatibility as indicated by - # https://github.com/numpy/numpy/blob/master/numpy/core/setup_common.py#L28 - 'numpy >=%s'%numpy.version.short_version, - 'nose2>=0.8.0', - 'ply', # for asLib - ], + install_requires = install_requires, extras_require={ 'qt': ['qtpy'], }, diff --git a/src/p4p.h b/src/p4p.h index 6504706..330f1d4 100644 --- a/src/p4p.h +++ b/src/p4p.h @@ -43,6 +43,7 @@ // avoid numpy deprecation warnings when building with cython >= 3.0 #if CYTHON_HEX_VERSION>=0x03000000 # define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION +# define NPY_TARGET_VERSION NPY_1_7_API_VERSION #endif namespace p4p { From 47e04e5ccf92f119338b66198ed895ce88dd5827 Mon Sep 17 00:00:00 2001 From: Ollie Copping Date: Wed, 14 Aug 2024 15:37:22 +0100 Subject: [PATCH 3/6] Bump version to 4.2.0a2 --- src/p4p/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p4p/version.py b/src/p4p/version.py index 23c763b..a24f069 100644 --- a/src/p4p/version.py +++ b/src/p4p/version.py @@ -67,4 +67,4 @@ def __ge__(self, o): def __gt__(self, o): return self._cmp(o)>0 -version = Version('4.2.0a1') +version = Version('4.2.0a2') From 6a255faacb6ce200198699744c8ec7bf2d79374a Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Thu, 15 Aug 2024 19:09:59 -0700 Subject: [PATCH 4/6] numpy compat fixups --- .github/workflows/build.yml | 4 ++-- setup.py | 2 +- src/p4p.h | 6 ++---- src/pvxs_value.cpp | 4 ++-- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e268224..78cda5d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -94,8 +94,8 @@ jobs: os: ubuntu-latest pyver: cp39-cp39 piparch: manylinux2010_x86_64 - numpy: numpy==2.0.1 - cython: Cython==3.0.10 + numpy: numpy==1.19.3 + cython: Cython==0.29.23 - name: linux 3.10 amd64 os: ubuntu-latest diff --git a/setup.py b/setup.py index 167aeaa..869029e 100755 --- a/setup.py +++ b/setup.py @@ -100,7 +100,7 @@ def get_numpy_include_dirs(): 'ply', # for asLib ] -if numpy.lib.NumpyVersion(numpy.__version__) >= '2.0.0b1': +if hasattr(numpy.lib, "NumpyVersion") and numpy.lib.NumpyVersion(numpy.__version__) >= '2.0.0b1': install_requires += ['numpy >= 1.7', 'numpy < 3'] else: # assume ABI forward compatibility as indicated by diff --git a/src/p4p.h b/src/p4p.h index 330f1d4..e7cbd9a 100644 --- a/src/p4p.h +++ b/src/p4p.h @@ -41,10 +41,8 @@ #endif // avoid numpy deprecation warnings when building with cython >= 3.0 -#if CYTHON_HEX_VERSION>=0x03000000 -# define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION -# define NPY_TARGET_VERSION NPY_1_7_API_VERSION -#endif +#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION +#define NPY_TARGET_VERSION NPY_1_7_API_VERSION namespace p4p { diff --git a/src/pvxs_value.cpp b/src/pvxs_value.cpp index 4ab07a8..834ecc7 100644 --- a/src/pvxs_value.cpp +++ b/src/pvxs_value.cpp @@ -159,7 +159,7 @@ PyObject* asPy(const Value& v, bool unpackstruct, bool unpackrecurse, PyObject* PyRef pyarr(PyArray_New(&PyArray_Type, 1, &shape, ntype, nullptr, const_cast(varr.data()), // should not actually be modifiable - esize, NPY_CARRAY_RO, nullptr)); + esize, NPY_ARRAY_CARRAY_RO, nullptr)); #ifdef PyArray_SetBaseObject PyArray_SetBaseObject((PyArrayObject*)pyarr.obj, holder.release()); @@ -530,7 +530,7 @@ void storePy(Value& v, PyObject* py, bool forceCast) } PyRef arr(PyArray_FromAny(py, PyArray_DescrFromType(ntype), 0, 0, - NPY_CARRAY_RO|NPY_ARRAY_FORCECAST, nullptr)); + NPY_ARRAY_CARRAY_RO|NPY_ARRAY_FORCECAST, nullptr)); if(PyArray_NDIM((PyArrayObject*)arr.obj)!=1) throw std::logic_error("Only 1-d array can be assigned"); From 0ab8b4b518fe587237c05f305449d3974ae66419 Mon Sep 17 00:00:00 2001 From: Ollie Copping Date: Wed, 14 Aug 2024 10:27:46 +0100 Subject: [PATCH 5/6] Remove Python 2.7 and 3.5 builds Updated piparch versions to no longer be deprecated --- .github/workflows/build.yml | 76 ++++--------------------------------- 1 file changed, 8 insertions(+), 68 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 78cda5d..9fed5ee 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -47,104 +47,57 @@ jobs: source: true # Linux py builds x64 - # TODO: manylinux1 and 2014 are EOL, even more reason to remove these supported versions - - name: linux 2.7 amd64 - os: ubuntu-latest - pyver: cp27-cp27m - piparch: manylinux1_x86_64 - numpy: numpy==1.8.2 - cython: Cython==0.29.2 - - - name: linux 2.7u amd64 - os: ubuntu-latest - pyver: cp27-cp27mu - piparch: manylinux1_x86_64 - numpy: numpy==1.8.2 - cython: Cython==0.29.2 - - - name: linux 3.5 amd64 - os: ubuntu-latest - pyver: cp35-cp35m - piparch: manylinux1_x86_64 - numpy: numpy==1.12.1 - cython: Cython==0.29.2 - - name: linux 3.6 amd64 os: ubuntu-latest pyver: cp36-cp36m - piparch: manylinux1_x86_64 + piparch: manylinux_2_28_x86_64 numpy: numpy==1.12.1 cython: Cython==0.29.2 - name: linux 3.7 amd64 os: ubuntu-latest pyver: cp37-cp37m - piparch: manylinux1_x86_64 + piparch: manylinux_2_28_x86_64 numpy: numpy==1.16.2 cython: Cython==0.29.2 - name: linux 3.8 amd64 os: ubuntu-latest pyver: cp38-cp38 - piparch: manylinux1_x86_64 + piparch: manylinux_2_28_x86_64 numpy: numpy==1.17.3 cython: Cython==0.29.2 - name: linux 3.9 amd64 os: ubuntu-latest pyver: cp39-cp39 - piparch: manylinux2010_x86_64 + piparch: manylinux_2_28_x86_64 numpy: numpy==1.19.3 cython: Cython==0.29.23 - name: linux 3.10 amd64 os: ubuntu-latest pyver: cp310-cp310 - piparch: manylinux2014_x86_64 + piparch: manylinux_2_28_x86_64 numpy: numpy==2.0.1 cython: Cython==3.0.10 - name: linux 3.11 amd64 os: ubuntu-latest pyver: cp311-cp311 - piparch: manylinux2014_x86_64 + piparch: manylinux_2_28_x86_64 numpy: numpy==2.0.1 cython: Cython==3.0.10 - name: linux 3.12 amd64 os: ubuntu-latest pyver: cp312-cp312 - piparch: manylinux2014_x86_64 + piparch: manylinux_2_28_x86_64 numpy: numpy==2.0.1 cython: Cython==3.0.10 skip_cothread: yes # Linux py builds x64 - # TODO: manylinux1 and 2014 are EOL, even more reason to remove these supported versions - - name: linux 2.7 i686 - os: ubuntu-latest - pyver: cp27-cp27m - piparch: manylinux1_i686 - numpy: numpy==1.11.1 - cython: Cython==0.29.2 - pre: linux32 - - - name: linux 2.7u i686 - os: ubuntu-latest - pyver: cp27-cp27mu - piparch: manylinux1_i686 - numpy: numpy==1.11.1 - cython: Cython==0.29.2 - pre: linux32 - - - name: linux 3.5 i686 - os: ubuntu-latest - pyver: cp35-cp35m - piparch: manylinux1_i686 - numpy: numpy==1.12.1 - cython: Cython==0.29.2 - pre: linux32 - - name: linux 3.6 i686 os: ubuntu-latest pyver: cp36-cp36m @@ -174,7 +127,7 @@ jobs: - name: linux 3.9 i686 os: ubuntu-latest pyver: cp39-cp39 - piparch: manylinux2010_i686 + piparch: manylinux2014_i686 numpy: numpy==1.19.5 cython: Cython==0.29.23 pre: linux32 @@ -244,13 +197,6 @@ jobs: # python: "3.12" # piparch: win_amd64 - - name: win64 3.5 - os: windows-2019 - python: "3.5" - piparch: win_amd64 - profile: latest - skip_cothread: yes - - name: win64 3.6 os: windows-latest python: "3.6" @@ -312,12 +258,6 @@ jobs: python-version: ${{ matrix.python }} #architecture: x64 - # TLS 1.0 and 1.1 support was removed from pypi so the cached pip won't work - - name: Python 3.5 Fix - if: ${{ matrix.python == '3.5' }} - run: | - curl https://bootstrap.pypa.io/pip/3.5/get-pip.py | python - - name: Automatic core dumper analysis uses: mdavidsaver/ci-core-dumper@master From a8570c6385b3724fd527769f8826e32f03123dcc Mon Sep 17 00:00:00 2001 From: Ollie Copping Date: Fri, 16 Aug 2024 11:18:14 +0100 Subject: [PATCH 6/6] Update Python 3.9 x64 build to use Numpy 2.0.1 --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9fed5ee..77374d7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -72,8 +72,8 @@ jobs: os: ubuntu-latest pyver: cp39-cp39 piparch: manylinux_2_28_x86_64 - numpy: numpy==1.19.3 - cython: Cython==0.29.23 + numpy: numpy==2.0.1 + cython: Cython==3.0.10 - name: linux 3.10 amd64 os: ubuntu-latest