From 920480d930a61b6a981f35e2db2830303536a486 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Mon, 17 Jul 2023 20:00:35 -0400 Subject: [PATCH 1/5] CI: Add 3.12 pre-release tests --- .github/workflows/pre-release.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 630f09d99..4431c7135 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -33,7 +33,7 @@ jobs: strategy: matrix: os: ['ubuntu-latest', 'windows-latest', 'macos-latest'] - python-version: ["3.9", "3.10", "3.11"] + python-version: ["3.9", "3.10", "3.11", "3.12"] architecture: ['x64', 'x86'] install: ['pip'] check: ['test'] @@ -54,6 +54,8 @@ jobs: architecture: x86 - os: macos-latest architecture: x86 + - python-version: '3.12' + architecture: x86 env: DEPENDS: ${{ matrix.depends }} @@ -72,6 +74,7 @@ jobs: with: python-version: ${{ matrix.python-version }} architecture: ${{ matrix.architecture }} + allow-prereleases: true - name: Display Python version run: python -c "import sys; print(sys.version)" - name: Create virtual environment From 5b64c51b4ac8e7908b473d5360e02d80ba23b387 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Tue, 15 Aug 2023 09:01:06 -0400 Subject: [PATCH 2/5] TEST: Mark file:/// URL test as xfail --- nibabel/tests/test_image_api.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nibabel/tests/test_image_api.py b/nibabel/tests/test_image_api.py index 091bc57e8..890619bad 100644 --- a/nibabel/tests/test_image_api.py +++ b/nibabel/tests/test_image_api.py @@ -25,6 +25,7 @@ import io import pathlib +import sys import warnings from functools import partial from itertools import product @@ -579,6 +580,10 @@ def validate_from_url(self, imaker, params): del img del rt_img + @pytest.mark.xfail( + sys.version_info >= (3, 12), + reason='Response type for file: urls is not a stream in Python 3.12', + ) def validate_from_file_url(self, imaker, params): tmp_path = self.tmp_path From e895749489edcedaa168ece082a862b45d1afadf Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Tue, 15 Aug 2023 09:10:27 -0400 Subject: [PATCH 3/5] CI: Disable building dependencies from source --- tools/ci/install_dependencies.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/ci/install_dependencies.sh b/tools/ci/install_dependencies.sh index f26c5204c..2ea4a524e 100755 --- a/tools/ci/install_dependencies.sh +++ b/tools/ci/install_dependencies.sh @@ -19,10 +19,10 @@ if [ -n "$EXTRA_PIP_FLAGS" ]; then fi if [ -n "$DEPENDS" ]; then - pip install ${EXTRA_PIP_FLAGS} --prefer-binary ${!DEPENDS} + pip install ${EXTRA_PIP_FLAGS} --only-binary :all: ${!DEPENDS} if [ -n "$OPTIONAL_DEPENDS" ]; then for DEP in ${!OPTIONAL_DEPENDS}; do - pip install ${EXTRA_PIP_FLAGS} --prefer-binary $DEP || true + pip install ${EXTRA_PIP_FLAGS} --only-binary :all: $DEP || true done fi fi From 6b7ce7a772b0af400808d7a45c59ee5f23f4517e Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 23 Aug 2023 10:27:01 -0400 Subject: [PATCH 4/5] FIX: Hack around 3.12rc1 bug (python/cpython#108111) --- nibabel/openers.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nibabel/openers.py b/nibabel/openers.py index 90c7774d1..9a024680a 100644 --- a/nibabel/openers.py +++ b/nibabel/openers.py @@ -78,6 +78,12 @@ def __init__( mtime=mtime, ) + def seek(self, pos: int, whence: int = 0, /) -> int: + # Work around bug (gh-180111) in Python 3.12rc1, where seeking without + # flushing can cause write of excess null bytes + self.flush() + return super().seek(pos, whence) + def _gzip_open( filename: str, From 30ba615ecb46fbddb5725d2622302d9b31f1cff6 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Mon, 17 Jul 2023 19:48:02 -0400 Subject: [PATCH 5/5] CI: Update scipy nightly wheel repository --- tools/ci/env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ci/env.sh b/tools/ci/env.sh index dd2944312..3d37ad955 100644 --- a/tools/ci/env.sh +++ b/tools/ci/env.sh @@ -12,6 +12,6 @@ PYDICOM_MASTER="git+https://github.com/pydicom/pydicom.git@master" MIN_OPT_DEPENDS="matplotlib==1.5.3 pydicom==1.0.1 pillow==2.6" # Numpy and scipy upload nightly/weekly/intermittent wheels -NIGHTLY_WHEELS="https://pypi.anaconda.org/scipy-wheels-nightly/simple" +NIGHTLY_WHEELS="https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" STAGING_WHEELS="https://pypi.anaconda.org/multibuild-wheels-staging/simple" PRE_PIP_FLAGS="--pre --extra-index-url $NIGHTLY_WHEELS --extra-index-url $STAGING_WHEELS"