From 4cf3eeb9921665aa01f70208126d8ff5ae86d071 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 23 Oct 2024 10:42:41 -0400 Subject: [PATCH 01/28] CI: Test on Python 3.13t across OSs --- .github/workflows/test.yml | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3ca5769fe..44ab04e9c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -113,7 +113,7 @@ jobs: fail-fast: false matrix: os: ['ubuntu-latest', 'windows-latest', 'macos-13', 'macos-latest'] - python-version: ["3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13t"] architecture: ['x64', 'x86', 'arm64'] dependencies: ['full', 'pre'] include: @@ -125,10 +125,6 @@ jobs: - os: ubuntu-latest python-version: 3.9 dependencies: 'min' - # NoGIL - - os: ubuntu-latest - python-version: '3.13-dev' - dependencies: 'dev' exclude: # x86 for Windows + Python<3.12 - os: ubuntu-latest @@ -139,6 +135,8 @@ jobs: architecture: x86 - python-version: '3.12' architecture: x86 + - python-version: '3.13t' + architecture: x86 # arm64 is available for macos-14+ - os: ubuntu-latest architecture: arm64 @@ -167,25 +165,29 @@ jobs: with: submodules: recursive fetch-depth: 0 + - name: Install the latest version of uv + uses: astral-sh/setup-uv@v3 - name: Set up Python ${{ matrix.python-version }} - if: "!endsWith(matrix.python-version, '-dev')" + if: "!endsWith(matrix.python-version, 't')" uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} architecture: ${{ matrix.architecture }} allow-prereleases: true - name: Set up Python ${{ matrix.python-version }} - if: endsWith(matrix.python-version, '-dev') - uses: deadsnakes/action@v3.2.0 - with: - python-version: ${{ matrix.python-version }} - nogil: true + if: endsWith(matrix.python-version, 't') + run: | + uv python install ${{ matrix.python-version }} + uv venv --python ${{ matrix.python-version }} ../.venv + . .venv/bin/activate + echo "PATH=$PATH" >> $GITHUB_ENV + echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV + uv pip install pip - name: Display Python version run: python -c "import sys; print(sys.version)" - name: Install tox run: | - python -m pip install --upgrade pip - python -m pip install tox tox-gh-actions + uv tool install tox --with=tox-gh-actions --with=tox-uv - name: Show tox config run: tox c - name: Run tox From 7b4165ec89430b3c5304cd90d1c07a50eade0815 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 23 Oct 2024 10:50:17 -0400 Subject: [PATCH 02/28] Add 3.13 without free-threading, reduce non-Linux build matrix --- .github/workflows/test.yml | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 44ab04e9c..b14078bfe 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -113,20 +113,42 @@ jobs: fail-fast: false matrix: os: ['ubuntu-latest', 'windows-latest', 'macos-13', 'macos-latest'] - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13t"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.13t"] architecture: ['x64', 'x86', 'arm64'] dependencies: ['full', 'pre'] include: # Basic dependencies only - os: ubuntu-latest - python-version: 3.9 + python-version: "3.9" dependencies: 'none' # Absolute minimum dependencies - os: ubuntu-latest - python-version: 3.9 + python-version: "3.9" dependencies: 'min' exclude: - # x86 for Windows + Python<3.12 + # Use ubuntu-latest to cover the whole range of Python. For Windows + # and OSX, checking oldest and newest should be sufficient. + - os: windows-latest + python-version: "3.10" + - os: windows-latest + python-version: "3.11" + - os: windows-latest + python-version: "3.12" + - os: macos-13 + python-version: "3.10" + - os: macos-13 + python-version: "3.11" + - os: macos-13 + python-version: "3.12" + - os: macos-latest + python-version: "3.10" + - os: macos-latest + python-version: "3.11" + - os: macos-latest + python-version: "3.12" + + # Unavailable architectures + # x86 is only available for Windows + Python<3.12 - os: ubuntu-latest architecture: x86 - os: macos-13 @@ -135,6 +157,8 @@ jobs: architecture: x86 - python-version: '3.12' architecture: x86 + - python-version: '3.13' + architecture: x86 - python-version: '3.13t' architecture: x86 # arm64 is available for macos-14+ @@ -147,6 +171,8 @@ jobs: # x64 is not available for macos-14+ - os: macos-latest architecture: x64 + + # Reduced support # Drop pre tests for macos-13 - os: macos-13 dependencies: pre From 2c223596757051e5720bf620fcad5be0895debda Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 23 Oct 2024 10:55:49 -0400 Subject: [PATCH 03/28] Do not update VIRTUAL_ENV --- .github/workflows/test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b14078bfe..d45ea4f1d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -207,7 +207,6 @@ jobs: uv venv --python ${{ matrix.python-version }} ../.venv . .venv/bin/activate echo "PATH=$PATH" >> $GITHUB_ENV - echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV uv pip install pip - name: Display Python version run: python -c "import sys; print(sys.version)" From afe41170d291876e8ebf515c3ab7b0b8b8ab5552 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 23 Oct 2024 11:03:35 -0400 Subject: [PATCH 04/28] Install pip into tox environment --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d45ea4f1d..15ff066a5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -212,7 +212,7 @@ jobs: run: python -c "import sys; print(sys.version)" - name: Install tox run: | - uv tool install tox --with=tox-gh-actions --with=tox-uv + uv tool install tox --with=tox-gh-actions --with=tox-uv --with=pip - name: Show tox config run: tox c - name: Run tox From 3fbc2ef8811c20f00ed17c3181c9c487d8c352f5 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 23 Oct 2024 11:34:30 -0400 Subject: [PATCH 05/28] Use tomllib over tomli when available --- tools/update_requirements.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/update_requirements.py b/tools/update_requirements.py index eb0343bd7..2259d3188 100755 --- a/tools/update_requirements.py +++ b/tools/update_requirements.py @@ -2,7 +2,10 @@ import sys from pathlib import Path -import tomli +try: + import tomllib +except ImportError: + import tomli as tomllib if sys.version_info < (3, 6): print('This script requires Python 3.6 to work correctly') @@ -15,7 +18,7 @@ doc_reqs = repo_root / 'doc-requirements.txt' with open(pyproject_toml, 'rb') as fobj: - config = tomli.load(fobj) + config = tomllib.load(fobj) requirements = config['project']['dependencies'] doc_requirements = config['project']['optional-dependencies']['doc'] From 2e4a124b42a02aefc9328a5ff5c3c6906a0a7132 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 23 Oct 2024 11:34:48 -0400 Subject: [PATCH 06/28] Sync requirements.txt files --- doc-requirements.txt | 2 +- min-requirements.txt | 7 ++++--- requirements.txt | 7 ++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/doc-requirements.txt b/doc-requirements.txt index 42400ea57..4136b0f81 100644 --- a/doc-requirements.txt +++ b/doc-requirements.txt @@ -1,7 +1,7 @@ # Auto-generated by tools/update_requirements.py -r requirements.txt sphinx -matplotlib>=1.5.3 +matplotlib>=3.5 numpydoc texext tomli; python_version < '3.11' diff --git a/min-requirements.txt b/min-requirements.txt index 1cdd78bb7..09dee2082 100644 --- a/min-requirements.txt +++ b/min-requirements.txt @@ -1,4 +1,5 @@ # Auto-generated by tools/update_requirements.py -numpy ==1.20 -packaging ==17 -importlib_resources ==1.3; python_version < '3.9' +numpy ==1.22 +packaging ==20 +importlib_resources ==5.12; python_version < '3.12' +typing_extensions ==4.6; python_version < '3.13' diff --git a/requirements.txt b/requirements.txt index f74ccc085..c65baf5cb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ # Auto-generated by tools/update_requirements.py -numpy >=1.20 -packaging >=17 -importlib_resources >=1.3; python_version < '3.9' +numpy >=1.22 +packaging >=20 +importlib_resources >=5.12; python_version < '3.12' +typing_extensions >=4.6; python_version < '3.13' From 30f324b3dcd5a3899db494ddd42a3a48c0bf2e7b Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 23 Oct 2024 11:45:34 -0400 Subject: [PATCH 07/28] Compile min-requirements.txt --- min-requirements.txt | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/min-requirements.txt b/min-requirements.txt index 09dee2082..455c6c8c6 100644 --- a/min-requirements.txt +++ b/min-requirements.txt @@ -1,5 +1,16 @@ -# Auto-generated by tools/update_requirements.py -numpy ==1.22 -packaging ==20 -importlib_resources ==5.12; python_version < '3.12' -typing_extensions ==4.6; python_version < '3.13' +# This file was autogenerated by uv via the following command: +# uv pip compile --resolution lowest-direct --python 3.9 -o min-requirements.txt pyproject.toml +importlib-resources==5.12.0 + # via nibabel (pyproject.toml) +numpy==1.22.0 + # via nibabel (pyproject.toml) +packaging==20.0 + # via nibabel (pyproject.toml) +pyparsing==3.2.0 + # via packaging +six==1.16.0 + # via packaging +typing-extensions==4.6.0 + # via nibabel (pyproject.toml) +zipp==3.20.2 + # via importlib-resources From 2894a3ef84ad5afd5878bd4c79737c0f9bd2e313 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Thu, 31 Oct 2024 12:16:16 -0400 Subject: [PATCH 08/28] TOX: Control pip via environment variables --- tox.ini | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/tox.ini b/tox.ini index 82c13debc..6dbd57443 100644 --- a/tox.ini +++ b/tox.ini @@ -48,12 +48,6 @@ ARCH = [testenv] description = Pytest with coverage labels = test -install_command = - python -I -m pip install -v \ - dev: --only-binary numpy,scipy,h5py \ - !dev: --only-binary numpy,scipy,h5py,pillow,matplotlib \ - pre,dev: --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple \ - {opts} {packages} pip_pre = pre,dev: true pass_env = @@ -72,6 +66,9 @@ pass_env = CLICOLOR_FORCE set_env = py313: PYTHON_GIL=0 + dev: PIP_ONLY_BINARY=numpy,scipy,h5py + !dev: PIP_ONLY_BINARY=numpy,scipy,h5py,pillow,matplotlib + pre,dev: PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple extras = test deps = # General minimum dependencies: pin based on API usage @@ -118,7 +115,6 @@ description = Install and verify import succeeds labels = test deps = extras = -install_command = python -I -m pip install {opts} {packages} commands = python -c "import nibabel; print(nibabel.__version__)" From 62012efa6f344eaee24cc270102aa3531f2596f1 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Thu, 31 Oct 2024 12:29:18 -0400 Subject: [PATCH 09/28] Handle 3.13 better --- tox.ini | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index 6dbd57443..bd83a79db 100644 --- a/tox.ini +++ b/tox.ini @@ -7,7 +7,7 @@ requires = tox>=4 envlist = # No preinstallations - py3{9,10,11,12,13}-none + py3{9,10,11,12,13,13t}-none # Minimum Python py39-{min,full} # x86 support range @@ -31,6 +31,7 @@ python = 3.11: py311 3.12: py312 3.13: py313 + 3.13t: py313t [gh-actions:env] DEPENDS = @@ -58,6 +59,8 @@ pass_env = USERNAME # Environment variables we check for NIPY_EXTRA_TESTS + # Python variables + PYTHON_GIL # Pass user color preferences through PY_COLORS FORCE_COLOR @@ -65,7 +68,6 @@ pass_env = CLICOLOR CLICOLOR_FORCE set_env = - py313: PYTHON_GIL=0 dev: PIP_ONLY_BINARY=numpy,scipy,h5py !dev: PIP_ONLY_BINARY=numpy,scipy,h5py,pillow,matplotlib pre,dev: PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple From cf4ef0634a928524403441192d671716a5fa9aec Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Thu, 31 Oct 2024 12:29:57 -0400 Subject: [PATCH 10/28] Configure uv installation --- .github/workflows/test.yml | 2 +- pyproject.toml | 3 +++ tox.ini | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 15ff066a5..d45ea4f1d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -212,7 +212,7 @@ jobs: run: python -c "import sys; print(sys.version)" - name: Install tox run: | - uv tool install tox --with=tox-gh-actions --with=tox-uv --with=pip + uv tool install tox --with=tox-gh-actions --with=tox-uv - name: Show tox config run: tox c - name: Run tox diff --git a/pyproject.toml b/pyproject.toml index b62c0048a..f307d1d8c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -200,3 +200,6 @@ enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"] [tool.codespell] skip = "*/data/*,./nibabel-data" ignore-words-list = "ans,te,ue,ist,nin,nd,ccompiler,ser" + +[tool.uv.pip] +only-binary = ["numpy", "scipy", "h5py"] diff --git a/tox.ini b/tox.ini index bd83a79db..236186f72 100644 --- a/tox.ini +++ b/tox.ini @@ -71,6 +71,7 @@ set_env = dev: PIP_ONLY_BINARY=numpy,scipy,h5py !dev: PIP_ONLY_BINARY=numpy,scipy,h5py,pillow,matplotlib pre,dev: PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple + pre,dev: UV_INDEX=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple extras = test deps = # General minimum dependencies: pin based on API usage From 04c4d30fb45d5aee02b9d566dea3c9f154fc647d Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Thu, 31 Oct 2024 12:40:02 -0400 Subject: [PATCH 11/28] fix virtual environment --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d45ea4f1d..ac1e9ae4b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -204,8 +204,8 @@ jobs: if: endsWith(matrix.python-version, 't') run: | uv python install ${{ matrix.python-version }} - uv venv --python ${{ matrix.python-version }} ../.venv - . .venv/bin/activate + uv venv --python ${{ matrix.python-version }} ../venv + . ../venv/bin/activate echo "PATH=$PATH" >> $GITHUB_ENV uv pip install pip - name: Display Python version From 1ad263e1b97f2a35bdddcdb7fe441f5138b38809 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Sat, 7 Dec 2024 09:03:57 -0500 Subject: [PATCH 12/28] chore(ci): Try another way to find the right Python --- .github/workflows/test.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ac1e9ae4b..a79b6d3ba 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -204,15 +204,13 @@ jobs: if: endsWith(matrix.python-version, 't') run: | uv python install ${{ matrix.python-version }} - uv venv --python ${{ matrix.python-version }} ../venv - . ../venv/bin/activate - echo "PATH=$PATH" >> $GITHUB_ENV - uv pip install pip - name: Display Python version run: python -c "import sys; print(sys.version)" - name: Install tox run: | uv tool install tox --with=tox-gh-actions --with=tox-uv + env: + UV_PYTHON: ${{ matrix.python-version }} - name: Show tox config run: tox c - name: Run tox From b99ad93142887bbcfe6fc2e6086ce888594909b1 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Sat, 7 Dec 2024 10:23:04 -0500 Subject: [PATCH 13/28] chore(deps): Add missing and set min versions for optional deps --- pyproject.toml | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f307d1d8c..3b2dfc99b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,13 +51,15 @@ nib-roi = "nibabel.cmdline.roi:main" parrec2nii = "nibabel.cmdline.parrec2nii:main" [project.optional-dependencies] -all = ["nibabel[dicomfs,minc2,spm,zstd]"] +all = ["nibabel[dicomfs,indexed_gzip,minc2,spm,zstd]"] # Features +indexed_gzip = ["indexed_gzip >=1.6"] dicom = ["pydicom >=2.3"] -dicomfs = ["nibabel[dicom]", "pillow"] -minc2 = ["h5py"] -spm = ["scipy"] -zstd = ["pyzstd >= 0.14.3"] +dicomfs = ["nibabel[dicom]", "pillow >=8.4"] +minc2 = ["h5py >=3.5"] +spm = ["scipy >=1.8"] +viewers = ["matplotlib >=3.5"] +zstd = ["pyzstd >=0.15.2"] # For doc and test, make easy to use outside of tox # tox should use these with extras instead of duplicating doc = [ @@ -68,12 +70,12 @@ doc = [ "tomli; python_version < '3.11'", ] test = [ - "pytest", - "pytest-doctestplus", - "pytest-cov", - "pytest-httpserver", - "pytest-xdist", - "coverage>=7.2", + "pytest >=6", + "pytest-doctestplus >=1", + "pytest-cov >=2.11", + "pytest-httpserver >=1.0.7", + "pytest-xdist >=3.5", + "coverage[toml]>=7.2", ] # Remaining: Simpler to centralize in tox dev = ["tox"] From ee091355f6a60d809e0eec19116bbfc8b3e79a63 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Sat, 7 Dec 2024 10:23:41 -0500 Subject: [PATCH 14/28] chore(tox): Use uv_resolution to run minimum tests --- tox.ini | 58 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/tox.ini b/tox.ini index 236186f72..0b06e7206 100644 --- a/tox.ini +++ b/tox.ini @@ -5,6 +5,7 @@ [tox] requires = tox>=4 + tox-uv envlist = # No preinstallations py3{9,10,11,12,13,13t}-none @@ -71,41 +72,40 @@ set_env = dev: PIP_ONLY_BINARY=numpy,scipy,h5py !dev: PIP_ONLY_BINARY=numpy,scipy,h5py,pillow,matplotlib pre,dev: PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple - pre,dev: UV_INDEX=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple -extras = test + pre,dev: UV_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple + py313t: PYTHONGIL=0 +extras = + test + + # Simple, thanks pillow + !none: dicomfs + !none: indexed_gzip + + # Matplotlib has wheels for everything except win32 (x86) + {min,full,pre,dev}-{x,arm}64: viewers + + # Nightly, but not released cp313t wheels for: scipy + # When released, remove the py3* line and add min/full to the pre,dev line + py3{9,10,11,12,13}-{min,full}-{x,arm}64: spm + {pre,dev}-{x,arm}64: spm + + # No cp313t wheels for: h5py, pyzstd + py3{9,10,11,12,13}-{min,full,pre-dev}-{x,arm}64: minc2 + py3{9,10,11,12,13}-{min,full,pre-dev}-{x,arm}64: zstd + + # No win32 wheels for scipy/matplotlib after py39 + py39-full-x86: spm + py39-full-x86: viewers + deps = - # General minimum dependencies: pin based on API usage - # matplotlib 3.5 requires packaging 20 - min: packaging ==20 - min: importlib_resources ==5.12; python_version < '3.12' - min: typing_extensions ==4.6; python_version < '3.13' - # NEP29/SPEC0 + 1yr: Test on minor release series within the last 3 years - # We're extending this to all optional dependencies - # This only affects the range that we test on; numpy is the only non-optional - # dependency, and will be the only one to affect pip environment resolution. - min: numpy ==1.22 - min: h5py ==3.5 - min: indexed_gzip ==1.6 - min: matplotlib ==3.5 - min: pillow ==8.4 - min: pydicom ==2.3 - min: pyzstd ==0.15.2 - min: scipy ==1.8 # Numpy 2.0 is a major breaking release; we cannot put much effort into # supporting until it's at least RC stable dev: numpy >=2.1.dev0 - # Scipy stopped producing win32 wheels at py310 - py39-full-x86,x64,arm64: scipy >=1.8 - # Matplotlib depends on scipy, so cannot be built for py310 on x86 - py39-full-x86,x64,arm64: matplotlib >=3.5 - # h5py stopped producing win32 wheels at py39 - {full,pre}-{x64,arm64}: h5py >=3.5 - full,pre,dev: pillow >=8.4 - full,pre: indexed_gzip >=1.6 - full,pre,dev: pyzstd >=0.15.2 - full,pre: pydicom >=2.3 dev: pydicom @ git+https://github.com/pydicom/pydicom.git@main +uv_resolution = + min: lowest-direct + commands = pytest --doctest-modules --doctest-plus \ --cov nibabel --cov-report xml:cov.xml \ From 1acb1fb441b65477194563dade0d4e437dc3862e Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Sat, 7 Dec 2024 14:01:58 -0500 Subject: [PATCH 15/28] Define environment for py313t-full/pre --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 0b06e7206..e0e972cfc 100644 --- a/tox.ini +++ b/tox.ini @@ -15,7 +15,7 @@ envlist = py3{9,10,11}-{full,pre}-{x86,x64} py3{9,10,11}-pre-{x86,x64} # x64-only range - py3{12,13}-{full,pre}-x64 + py3{12,13,13t}-{full,pre}-x64 # Special environment for numpy 2.0-dev testing py313-dev-x64 install From 6023c351061e91e065f38bfb10863fabd6b7bc86 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Sat, 7 Dec 2024 20:04:19 -0500 Subject: [PATCH 16/28] Use tox-gh-actions branch --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a79b6d3ba..ddd13e177 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -208,7 +208,7 @@ jobs: run: python -c "import sys; print(sys.version)" - name: Install tox run: | - uv tool install tox --with=tox-gh-actions --with=tox-uv + uv tool install tox --with=git+https://github.com/effigies/tox-gh-actions@abiflags --with=tox-uv env: UV_PYTHON: ${{ matrix.python-version }} - name: Show tox config From bcb9f2dc3b174e22c07aeb11aa523c69ffe3a96c Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Sun, 8 Dec 2024 11:25:45 -0500 Subject: [PATCH 17/28] chore(ci): Test win32 with no extras for 3.9 and 3.13 --- .github/workflows/test.yml | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ddd13e177..46a5e1cdc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -114,17 +114,28 @@ jobs: matrix: os: ['ubuntu-latest', 'windows-latest', 'macos-13', 'macos-latest'] python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.13t"] - architecture: ['x64', 'x86', 'arm64'] + architecture: ['x64', 'arm64'] dependencies: ['full', 'pre'] include: # Basic dependencies only - os: ubuntu-latest python-version: "3.9" + architecture: 'x64' dependencies: 'none' # Absolute minimum dependencies - os: ubuntu-latest python-version: "3.9" + architecture: 'x64' dependencies: 'min' + # Only numpy of the scipy stack still supports win32 + - os: windows-latest + python-version: "3.9" + architecture: 'x86' + dependencies: 'none' + - os: windows-latest + python-version: "3.13" + architecture: 'x86' + dependencies: 'none' exclude: # Use ubuntu-latest to cover the whole range of Python. For Windows # and OSX, checking oldest and newest should be sufficient. @@ -148,26 +159,6 @@ jobs: python-version: "3.12" # Unavailable architectures - # x86 is only available for Windows + Python<3.12 - - os: ubuntu-latest - architecture: x86 - - os: macos-13 - architecture: x86 - - os: macos-latest - architecture: x86 - - python-version: '3.12' - architecture: x86 - - python-version: '3.13' - architecture: x86 - - python-version: '3.13t' - architecture: x86 - # arm64 is available for macos-14+ - - os: ubuntu-latest - architecture: arm64 - - os: windows-latest - architecture: arm64 - - os: macos-13 - architecture: arm64 # x64 is not available for macos-14+ - os: macos-latest architecture: x64 From 78a8878ec9eefbe409e1edf6668e7f374b713f7f Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Sun, 8 Dec 2024 11:26:06 -0500 Subject: [PATCH 18/28] chore(tox): Remove unused env vars --- tox.ini | 2 -- 1 file changed, 2 deletions(-) diff --git a/tox.ini b/tox.ini index e0e972cfc..ec34f7b82 100644 --- a/tox.ini +++ b/tox.ini @@ -69,8 +69,6 @@ pass_env = CLICOLOR CLICOLOR_FORCE set_env = - dev: PIP_ONLY_BINARY=numpy,scipy,h5py - !dev: PIP_ONLY_BINARY=numpy,scipy,h5py,pillow,matplotlib pre,dev: PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple pre,dev: UV_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple py313t: PYTHONGIL=0 From 91d2e422671a2c019f65e7331661c1d8b7f3968b Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Sun, 8 Dec 2024 11:26:20 -0500 Subject: [PATCH 19/28] chore(tox): Set PYTHONGIL from environment if found --- tox.ini | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tox.ini b/tox.ini index ec34f7b82..d7081549b 100644 --- a/tox.ini +++ b/tox.ini @@ -60,8 +60,6 @@ pass_env = USERNAME # Environment variables we check for NIPY_EXTRA_TESTS - # Python variables - PYTHON_GIL # Pass user color preferences through PY_COLORS FORCE_COLOR @@ -71,7 +69,7 @@ pass_env = set_env = pre,dev: PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple pre,dev: UV_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple - py313t: PYTHONGIL=0 + py313t: PYTHONGIL={env:PYTHONGIL:0} extras = test From 265257eee31b875335bde9bf9364a13241a552b0 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Sun, 8 Dec 2024 11:29:25 -0500 Subject: [PATCH 20/28] chore(ci): Update setup-uv version --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 46a5e1cdc..abcf1ed38 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -183,7 +183,7 @@ jobs: submodules: recursive fetch-depth: 0 - name: Install the latest version of uv - uses: astral-sh/setup-uv@v3 + uses: astral-sh/setup-uv@v4 - name: Set up Python ${{ matrix.python-version }} if: "!endsWith(matrix.python-version, 't')" uses: actions/setup-python@v5 From 6cb49a3c98c17653274facdde0c6a4e85977d32e Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Sun, 8 Dec 2024 11:42:26 -0500 Subject: [PATCH 21/28] chore(ci): Re-add arm64 exclusions --- .github/workflows/test.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index abcf1ed38..3599bc2c2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -158,12 +158,19 @@ jobs: - os: macos-latest python-version: "3.12" - # Unavailable architectures + ## Unavailable architectures + # arm64 is available for macos-14+ + - os: ubuntu-latest + architecture: arm64 + - os: windows-latest + architecture: arm64 + - os: macos-13 + architecture: arm64 # x64 is not available for macos-14+ - os: macos-latest architecture: x64 - # Reduced support + ## Reduced support # Drop pre tests for macos-13 - os: macos-13 dependencies: pre From 81e2e9fb362df433d2d16defabf3c1288c11794d Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Sun, 8 Dec 2024 11:50:16 -0500 Subject: [PATCH 22/28] chore: Disable writing min-requirements from update_requirements.py --- tools/update_requirements.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/update_requirements.py b/tools/update_requirements.py index 2259d3188..13709b22e 100755 --- a/tools/update_requirements.py +++ b/tools/update_requirements.py @@ -30,9 +30,10 @@ lines[1:-1] = requirements reqs.write_text('\n'.join(lines)) -# Write minimum requirements -lines[1:-1] = [req.replace('>=', '==').replace('~=', '==') for req in requirements] -min_reqs.write_text('\n'.join(lines)) +# # Write minimum requirements +# lines[1:-1] = [req.replace('>=', '==').replace('~=', '==') for req in requirements] +# min_reqs.write_text('\n'.join(lines)) +print(f"To update {min_reqs.name}, use `uv pip compile` (see comment at top of file).") # Write documentation requirements lines[1:-1] = ['-r requirements.txt'] + doc_requirements From 6f77556f5b57070979ba4a8b8665caafae06b523 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Sun, 8 Dec 2024 12:06:24 -0500 Subject: [PATCH 23/28] chore(ci): Restore x86 for Windows, will just drop mpl in tox --- .github/workflows/test.yml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3599bc2c2..c99b4367b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -114,7 +114,7 @@ jobs: matrix: os: ['ubuntu-latest', 'windows-latest', 'macos-13', 'macos-latest'] python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.13t"] - architecture: ['x64', 'arm64'] + architecture: ['x86', 'x64', 'arm64'] dependencies: ['full', 'pre'] include: # Basic dependencies only @@ -127,15 +127,6 @@ jobs: python-version: "3.9" architecture: 'x64' dependencies: 'min' - # Only numpy of the scipy stack still supports win32 - - os: windows-latest - python-version: "3.9" - architecture: 'x86' - dependencies: 'none' - - os: windows-latest - python-version: "3.13" - architecture: 'x86' - dependencies: 'none' exclude: # Use ubuntu-latest to cover the whole range of Python. For Windows # and OSX, checking oldest and newest should be sufficient. @@ -159,6 +150,13 @@ jobs: python-version: "3.12" ## Unavailable architectures + # x86 is available for Windows + - os: ubuntu-latest + architecture: x86 + - os: macos-latest + architecture: x86 + - os: macos-13 + architecture: x86 # arm64 is available for macos-14+ - os: ubuntu-latest architecture: arm64 From 85a6cfece89b8a551ff8ddd6ce07ce0c5dca80c0 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Sun, 8 Dec 2024 12:07:25 -0500 Subject: [PATCH 24/28] chore(tox): Drop mpl from x86, old numpy constraint --- tox.ini | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tox.ini b/tox.ini index d7081549b..824993716 100644 --- a/tox.ini +++ b/tox.ini @@ -73,7 +73,7 @@ set_env = extras = test - # Simple, thanks pillow + # Simple, thanks Hugo and Paul !none: dicomfs !none: indexed_gzip @@ -89,14 +89,10 @@ extras = py3{9,10,11,12,13}-{min,full,pre-dev}-{x,arm}64: minc2 py3{9,10,11,12,13}-{min,full,pre-dev}-{x,arm}64: zstd - # No win32 wheels for scipy/matplotlib after py39 + # No win32 wheels for scipy after py39 py39-full-x86: spm - py39-full-x86: viewers deps = - # Numpy 2.0 is a major breaking release; we cannot put much effort into - # supporting until it's at least RC stable - dev: numpy >=2.1.dev0 dev: pydicom @ git+https://github.com/pydicom/pydicom.git@main uv_resolution = From 5e4c4aeb8f76771a3bcdb37f58886f2f1f9fe283 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Sun, 8 Dec 2024 12:10:04 -0500 Subject: [PATCH 25/28] chore(tox): Drop dev, pre is good enough --- tox.ini | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/tox.ini b/tox.ini index 824993716..a0b84ee69 100644 --- a/tox.ini +++ b/tox.ini @@ -16,8 +16,6 @@ envlist = py3{9,10,11}-pre-{x86,x64} # x64-only range py3{12,13,13t}-{full,pre}-x64 - # Special environment for numpy 2.0-dev testing - py313-dev-x64 install doctest style @@ -38,7 +36,6 @@ python = DEPENDS = none: none, install pre: pre - dev: dev full: full, install min: min @@ -51,7 +48,7 @@ ARCH = description = Pytest with coverage labels = test pip_pre = - pre,dev: true + pre: true pass_env = # getpass.getuser() sources for Windows: LOGNAME @@ -67,8 +64,8 @@ pass_env = CLICOLOR CLICOLOR_FORCE set_env = - pre,dev: PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple - pre,dev: UV_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple + pre: PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple + pre: UV_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple py313t: PYTHONGIL={env:PYTHONGIL:0} extras = test @@ -78,22 +75,22 @@ extras = !none: indexed_gzip # Matplotlib has wheels for everything except win32 (x86) - {min,full,pre,dev}-{x,arm}64: viewers + {min,full,pre}-{x,arm}64: viewers # Nightly, but not released cp313t wheels for: scipy - # When released, remove the py3* line and add min/full to the pre,dev line + # When released, remove the py3* line and add min/full to the pre line py3{9,10,11,12,13}-{min,full}-{x,arm}64: spm - {pre,dev}-{x,arm}64: spm + pre-{x,arm}64: spm # No cp313t wheels for: h5py, pyzstd - py3{9,10,11,12,13}-{min,full,pre-dev}-{x,arm}64: minc2 - py3{9,10,11,12,13}-{min,full,pre-dev}-{x,arm}64: zstd + py3{9,10,11,12,13}-{min,full,pre}-{x,arm}64: minc2 + py3{9,10,11,12,13}-{min,full,pre}-{x,arm}64: zstd # No win32 wheels for scipy after py39 py39-full-x86: spm deps = - dev: pydicom @ git+https://github.com/pydicom/pydicom.git@main + pre: pydicom @ git+https://github.com/pydicom/pydicom.git@main uv_resolution = min: lowest-direct From 76b809c9ebe694d1d6a7a080311e029d775ce8b6 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Sun, 8 Dec 2024 13:10:47 -0500 Subject: [PATCH 26/28] chore(tox): Rework default environments, extras --- tox.ini | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/tox.ini b/tox.ini index a0b84ee69..cba8b17d6 100644 --- a/tox.ini +++ b/tox.ini @@ -9,13 +9,10 @@ requires = envlist = # No preinstallations py3{9,10,11,12,13,13t}-none - # Minimum Python - py39-{min,full} - # x86 support range - py3{9,10,11}-{full,pre}-{x86,x64} - py3{9,10,11}-pre-{x86,x64} - # x64-only range - py3{12,13,13t}-{full,pre}-x64 + # Minimum Python with minimum deps + py39-min + # Run full and pre dependencies against all archs + py3{9,10,11,12,13,13t}-{full,pre}-{x86,x64,arm64} install doctest style @@ -34,7 +31,7 @@ python = [gh-actions:env] DEPENDS = - none: none, install + none: none pre: pre full: full, install min: min @@ -74,19 +71,25 @@ extras = !none: dicomfs !none: indexed_gzip + # Minimum dependencies + min: minc2 + min: spm + min: viewers + min: zstd + # Matplotlib has wheels for everything except win32 (x86) - {min,full,pre}-{x,arm}64: viewers + {full,pre}-{x,arm}64: viewers # Nightly, but not released cp313t wheels for: scipy - # When released, remove the py3* line and add min/full to the pre line - py3{9,10,11,12,13}-{min,full}-{x,arm}64: spm + # When released, remove the py3* line and add full to the pre line + py3{9,10,11,12,13}-full-{x,arm}64: spm pre-{x,arm}64: spm # No cp313t wheels for: h5py, pyzstd - py3{9,10,11,12,13}-{min,full,pre}-{x,arm}64: minc2 - py3{9,10,11,12,13}-{min,full,pre}-{x,arm}64: zstd + py3{9,10,11,12,13}-{full,pre}-{x,arm}64: minc2 + py3{9,10,11,12,13}-{full,pre}-{x,arm}64: zstd - # No win32 wheels for scipy after py39 + # win32 (x86) wheels still exist for scipy+py39 py39-full-x86: spm deps = From 821f34bb24c579f5202e120bca2bbefcefe96539 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Sun, 8 Dec 2024 18:25:43 -0500 Subject: [PATCH 27/28] chore(ci): Improve version specification for uv --- .github/workflows/test.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c99b4367b..1effca4d7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -199,7 +199,18 @@ jobs: - name: Set up Python ${{ matrix.python-version }} if: endsWith(matrix.python-version, 't') run: | - uv python install ${{ matrix.python-version }} + uv python install ${IMPL}-${VERSION}-${OS%-*}-${ARCH}-${LIBC} + env: + IMPL: cpython + VERSION: ${{ matrix.python-version }} + # uv expects linux|macos|windows, we can drop the -* but need to rename ubuntu + OS: ${{ matrix.os == 'ubuntu-latest' && 'linux' || matrix.os }} + # uv expects x86, x86_64, aarch64 (among others) + ARCH: ${{ matrix.architecture == 'x64' && 'x86_64' || + matrix.architecture == 'arm64' && 'aarch64' || + matrix.architecture }} + # windows and macos have no options, gnu is the only option for the archs + LIBC: ${{ matrix.os == 'ubuntu-latest' && 'gnu' || 'none' }} - name: Display Python version run: python -c "import sys; print(sys.version)" - name: Install tox From 1e8043d4f92b2272094e19aca86f4fb8f4c1a539 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Sun, 12 Jan 2025 09:41:42 -0500 Subject: [PATCH 28/28] chore: Nudge uv a bit harder --- .github/workflows/test.yml | 8 ++++---- tox.ini | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1effca4d7..06143e635 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -199,7 +199,9 @@ jobs: - name: Set up Python ${{ matrix.python-version }} if: endsWith(matrix.python-version, 't') run: | - uv python install ${IMPL}-${VERSION}-${OS%-*}-${ARCH}-${LIBC} + echo "UV_PYTHON=${IMPL}-${VERSION}-${OS%-*}-${ARCH}-${LIBC}" >> $GITHUB_ENV + source $GITHUB_ENV + uv python install $UV_PYTHON env: IMPL: cpython VERSION: ${{ matrix.python-version }} @@ -215,9 +217,7 @@ jobs: run: python -c "import sys; print(sys.version)" - name: Install tox run: | - uv tool install tox --with=git+https://github.com/effigies/tox-gh-actions@abiflags --with=tox-uv - env: - UV_PYTHON: ${{ matrix.python-version }} + uv tool install -v tox --with=git+https://github.com/effigies/tox-gh-actions@abiflags --with=tox-uv - name: Show tox config run: tox c - name: Run tox diff --git a/tox.ini b/tox.ini index cba8b17d6..05d977951 100644 --- a/tox.ini +++ b/tox.ini @@ -60,6 +60,8 @@ pass_env = NO_COLOR CLICOLOR CLICOLOR_FORCE + # uv needs help in this case + py313t-x86: UV_PYTHON set_env = pre: PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple pre: UV_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple