From 8b732a229d0f629404d3a70854f909b52cbc3b05 Mon Sep 17 00:00:00 2001 From: Jonathan Wright Date: Tue, 18 Jun 2024 14:40:20 +0200 Subject: [PATCH 1/3] numpy 2, the adventure begins --- pyproject.toml | 9 ++++++++- setup.py | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a59ec013..a0ac7a5d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,5 +3,12 @@ requires = ["setuptools", "six", "wheel", "numpy; python_version=='2.7'", - "oldest-supported-numpy; python_version>='3.0'" ] +# There is no way to compile for versions < 1.25 and up to 2. +# See https://numpy.org/doc/2.0/dev/depending_on_numpy.html +# +# This gives you all versions < 2.0 +# "oldest-supported-numpy; python_version>='3.0'" ] +# +# This gives all versions > 1.25 + "numpy>=2.0.0rc1; python_version>='3.0'" ] build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index fe9445a0..c003b8ff 100644 --- a/setup.py +++ b/setup.py @@ -142,7 +142,8 @@ def build_extension(self, ext): minimal = [ # can't compile without this "six", - "numpy", + 'numpy ; python_version < "3"', + 'numpy>=1.23.5 ; python_version >= "3"', "setuptools", ] From ea5aa69a1f3b61adf90fed54860cdbf574f1bc65 Mon Sep 17 00:00:00 2001 From: Jonathan Wright Date: Tue, 18 Jun 2024 14:58:46 +0200 Subject: [PATCH 2/3] Not ready for python2 due to dependencies --- appveyor.yml | 2 +- pyproject.toml | 8 ++++++-- setup.py | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 600d09d0..acc87bbc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -20,7 +20,7 @@ install: - "set TMPDIR=C:\\tmp" - python -c "import sys; print(sys.executable, sys.version)" - python -m pip install --upgrade pip setuptools - - python -m pip install pytest numpy + - python -m pip install pytest 'numpy<2' - python -m pip install --ignore-installed certifi --upgrade-strategy only-if-needed --only-binary=h5py --only-binary=scipy --only-binary=hdf5plugin . diff --git a/pyproject.toml b/pyproject.toml index a0ac7a5d..450bf7b9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,8 +7,12 @@ requires = ["setuptools", # See https://numpy.org/doc/2.0/dev/depending_on_numpy.html # # This gives you all versions < 2.0 -# "oldest-supported-numpy; python_version>='3.0'" ] + "oldest-supported-numpy; python_version>='3.0'" ] # # This gives all versions > 1.25 - "numpy>=2.0.0rc1; python_version>='3.0'" ] +# "numpy>=2.0.0rc1; python_version>='3.0'" ] +# +# As usual, the dependencies are not ready. +# pin numpy < 2 for now. +# build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index c003b8ff..edb46c11 100644 --- a/setup.py +++ b/setup.py @@ -143,7 +143,8 @@ def build_extension(self, ext): minimal = [ # can't compile without this "six", 'numpy ; python_version < "3"', - 'numpy>=1.23.5 ; python_version >= "3"', + # Until the dependencies are ready + 'numpy<2 ; python_version >= "3"', "setuptools", ] From 04f45242c844a6bfa07a7b87d512cdbbb30404a4 Mon Sep 17 00:00:00 2001 From: Jonathan Wright Date: Tue, 18 Jun 2024 15:02:45 +0200 Subject: [PATCH 3/3] fstring removed for 2.7 --- ImageD11/sinograms/lima_segmenter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ImageD11/sinograms/lima_segmenter.py b/ImageD11/sinograms/lima_segmenter.py index 2421f9be..76ec102a 100755 --- a/ImageD11/sinograms/lima_segmenter.py +++ b/ImageD11/sinograms/lima_segmenter.py @@ -447,8 +447,8 @@ def sbatchlocal(fname, cores=None): for line in lines: if line.find('--array=')>=0: start, end = line.split('=')[-1].split('-') - commands = [ f'SLURM_ARRAY_TASK_ID={i} bash {fname} > {fname}_{i}.log' for - i in range(int(start), int(end)) ] + commands = [ 'SLURM_ARRAY_TASK_ID=%d bash %s > %s_%d.log'%(i, fname, fname, i ) + for i in range(int(start), int(end)) ] with concurrent.futures.ThreadPoolExecutor(max_workers = cores) as pool: for _ in pool.map( os.system, commands ): pass