[med-svn] [Git][med-team/nibabel][upstream] New upstream version 5.4.2
Andreas Tille (@tille)
gitlab at salsa.debian.org
Mon May 18 10:41:54 BST 2026
Andreas Tille pushed to branch upstream at Debian Med / nibabel
Commits:
cbee4bf8 by Andreas Tille at 2026-05-18T11:02:17+02:00
New upstream version 5.4.2
- - - - -
15 changed files:
- .git_archival.txt
- .github/workflows/test.yml
- .pre-commit-config.yaml
- .readthedocs.yaml
- Changelog
- doc/source/devel/devguide.rst
- nibabel/_compression.py
- nibabel/_typing.py
- nibabel/cmdline/tests/test_roi.py
- nibabel/pkg_info.py
- nibabel/tests/test_removalschedule.py
- pyproject.toml
- tools/markdown_release_notes.py
- tox.ini
- uv.lock
Changes:
=====================================
.git_archival.txt
=====================================
@@ -1,4 +1,4 @@
-node: 4602d9231d966c880dfb32f2621c48ec47d874fb
-node-date: 2026-03-02T12:53:11-05:00
-describe-name: 5.4.0
-ref-names: tag: 5.4.0, refs/pull/1471/head, rel/5.4.0, maint/5.4.x
+node: 513f421e0c61abf4a15ac85654f86352cf47f8ba
+node-date: 2026-03-11T09:13:56-04:00
+describe-name: 5.4.2
+ref-names: tag: 5.4.2, maint/5.4.x
=====================================
.github/workflows/test.yml
=====================================
@@ -39,18 +39,18 @@ permissions:
jobs:
build:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-slim
steps:
- uses: actions/checkout at v6
with:
fetch-depth: 0
- - uses: actions/setup-python at v6
+ - uses: astral-sh/setup-uv at v7
with:
python-version: 3
- - run: pip install --upgrade build twine
+ activate-environment: true
- name: Build sdist and wheel
- run: python -m build
- - run: twine check dist/*
+ run: uv build
+ - run: uvx twine check dist/*
- name: Build git archive
run: mkdir archive && git archive -v -o archive/nibabel-archive.tgz HEAD
- name: Upload sdist and wheel artifacts
@@ -83,29 +83,29 @@ jobs:
with:
name: archive
path: archive/
- - uses: actions/setup-python at v6
+ - name: Setup uv and Python ${{ matrix.python-version }}
+ uses: astral-sh/setup-uv at v7
with:
python-version: 3
+ activate-environment: true
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- - name: Update pip
- run: pip install --upgrade pip
- name: Install wheel
if: matrix.package == 'wheel'
- run: pip install dist/nibabel-*.whl
+ run: uv pip install dist/nibabel-*.whl
- name: Install sdist
if: matrix.package == 'sdist'
- run: pip install dist/nibabel-*.tar.gz
+ run: uv pip install dist/nibabel-*.tar.gz
- name: Install archive
if: matrix.package == 'archive'
- run: pip install archive/nibabel-archive.tgz
+ run: uv pip install archive/nibabel-archive.tgz
- run: python -c 'import nibabel; print(nibabel.__version__)'
- name: Install minimum test dependencies
- run: pip install nibabel[test]
+ run: uv pip install nibabel[test]
- name: Run tests
run: pytest --doctest-modules --doctest-plus -v --pyargs nibabel -n auto
- test:
+ tox:
# Check each OS, all supported Python, minimum versions and latest releases
runs-on: ${{ matrix.os }}
strategy:
@@ -227,32 +227,55 @@ jobs:
path: test-results.xml
if: ${{ always() }}
+ pytest:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ python-version: ['3.14']
+ steps:
+ - name: Shallow checkout
+ uses: actions/checkout at v6
+ - name: Setup uv and Python ${{ matrix.python-version }}
+ uses: astral-sh/setup-uv at v7
+ with:
+ python-version: ${{ matrix.python-version }}
+ activate-environment: true
+ - name: Display Python version
+ run: python -c "import sys; print(sys.version)"
+ - name: Install with pytest
+ run: uv sync --extra=test --extra=all
+ - name: Run test suite
+ run: python -m pytest
+
checks:
- runs-on: 'ubuntu-latest'
+ runs-on: 'ubuntu-slim'
continue-on-error: true
strategy:
matrix:
- check: ['style', 'doctest', 'typecheck', 'spellcheck']
+ check: ['doctest', 'typecheck']
steps:
- uses: actions/checkout at v6
- - name: Set up Python ${{ matrix.python-version }}
- uses: actions/setup-python at v6
+ - name: Setup uv and Python
+ uses: astral-sh/setup-uv at v7
with:
python-version: 3
+ activate-environment: true
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- - name: Show tox config
- run: pipx run tox c
+ - name: Install tox
+ run: uv tool install -v tox --with=tox-uv-bare --with=tox-gh-actions
- name: Show tox config (this call)
- run: pipx run tox c -e ${{ matrix.check }}
+ run: tox c -e ${{ matrix.check }}
+ - name: Setup check environment
+ run: tox -vv --notest -e ${{ matrix.check }}
- name: Run check
- run: pipx run tox -e ${{ matrix.check }}
+ run: tox -e ${{ matrix.check }}
publish:
runs-on: ubuntu-latest
environment: "Package deployment"
- needs: [test, test-package]
+ needs: [tox, pytest, test-package]
permissions:
# Required for trusted publishing
id-token: write
=====================================
.pre-commit-config.yaml
=====================================
@@ -1,7 +1,14 @@
+ci:
+ autoupdate_schedule: monthly
+ autoupdate_commit_message: 'chore: update pre-commit hooks'
+ autofix_prs: false
+ skip:
+ - typecheck
+
exclude: ".*/data/.*"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
- rev: v5.0.0
+ rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
@@ -13,28 +20,20 @@ repos:
- id: check-merge-conflict
- id: check-vcs-permalinks
- repo: https://github.com/astral-sh/ruff-pre-commit
- rev: v0.9.6
+ rev: v0.15.3
hooks:
- - id: ruff
+ - id: ruff-check
args: [ --fix ]
- exclude: = ["doc", "tools"]
- id: ruff-format
- exclude: = ["doc", "tools"]
- - repo: https://github.com/pre-commit/mirrors-mypy
- rev: v1.15.0
+ # Use uv run so we can use uv pinning
+ - repo: local
hooks:
- - id: mypy
- # Sync with project.optional-dependencies.typing
- additional_dependencies:
- - pytest
- - types-setuptools
- - types-Pillow
- - pydicom
- - numpy
- - backports.zstd
- - importlib_resources
- args: ["nibabel"]
+ - id: typecheck
+ name: Typecheck
+ language: python
+ entry: uv run --active --no-dev --group=typecheck mypy nibabel
pass_filenames: false
+ additional_dependencies: [uv]
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
=====================================
.readthedocs.yaml
=====================================
@@ -12,8 +12,10 @@ build:
create_environment:
- uv venv $READTHEDOCS_VIRTUALENV_PATH
install:
- # Use a cache dir in the same mount to halve the install time
- - VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH uv pip install --cache-dir $READTHEDOCS_VIRTUALENV_PATH/../../uv_cache .[doc]
+ - >
+ VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH
+ UV_CACHE_DIR=$READTHEDOCS_VIRTUALENV_PATH/../../uv_cache
+ uv sync --active --locked --group=doc
pre_build:
- ( cd doc; python tools/build_modref_templates.py nibabel source/reference False )
=====================================
Changelog
=====================================
@@ -25,6 +25,31 @@ Eric Larson (EL), Demian Wassermann, Stephan Gerhard and Ross Markello (RM).
References like "pr/298" refer to github pull request numbers.
+5.4.2 (Wednesday 11 March 2026)
+===============================
+
+Bug-fix release in the 5.4.x series.
+
+This release fixes an issue with automated deployment to PyPI.
+
+5.4.1 (Tuesday 10 March 2026)
+=============================
+
+Bug-fix release in the 5.4.x series.
+
+This release addresses test failures on shallow clones or when run with
+``python -m pytest`` in Python 3.14+.
+
+Bug fixes
+---------
+* Adjust tests to not depend on how pytest is run, or deep clones (pr/1478) (CM)
+
+Maintenance
+-----------
+* Consolidate environment management for development tasks to ensure tox and
+ pre-commit stay in sync. (pr/1475) (CM, reviewed by Rémi Gau)
+* Update pre-commit and ruff configurations (pr/1467) (Rémi Gau, reviewed by CM)
+
5.4.0 (Monday 2 March 2026)
===========================
=====================================
doc/source/devel/devguide.rst
=====================================
@@ -103,11 +103,18 @@ tox runs tests in isolated environments that we specify,
ensuring that we are able to test across many different environments,
and those environments do not depend on our local configurations.
-If you have the pipx_ tool installed, then you may simply::
+The simplest way to install the necessary tools is to run::
- pipx run tox
+ uv sync --group=dev
-Alternatively, you can install tox and run it::
+This will install tox_ and pre-commit_ with uv_ plugins into a local
+`.venv` environment.
+
+Otherwise, you may install tox using `uv tool`::
+
+ uv tool install --with=tox-uv-bare tox
+
+Or in any environment with::
python -m pip install tox
tox
@@ -131,28 +138,33 @@ Style guide
To ensure code consistency and readability, NiBabel has adopted the following
tools:
-* blue_ - An auto-formatter that aims to reduce diffs to relevant lines
-* isort_ - An import sorter that groups stdlib, third-party and local imports.
-* flake8_ - A style checker that can catch (but generally not fix) common
- errors in code.
+* ruff_ - A general linter and autoformatter.
* codespell_ - A spell checker targeted at source code.
* pre-commit_ - A pre-commit hook manager that runs the above and various
other checks/fixes.
+To apply our style checks uniformly, simply run::
+
+ pre-commit run --all-files
+
+Individual checks can be run with::
+
+ pre-commit run ruff-check --all-files
+ pre-commit run ruff-format --all-files
+ pre-commit run codespell --all-files
+
While some amount of personal preference is involved in selecting and
configuring auto-formatters, their value lies in largely eliminating the
need to think or argue about style.
With pre-commit turned on, you can write in the style that works for you,
and the NiBabel style will be adopted prior to the commit.
-To apply our style checks uniformly, simply run::
-
- tox -e style,spellcheck
-
-To fix any issues found::
-
- tox -e style-fix
- tox -e spellcheck -- -w
+Ruff implements a large number of checks.
+Many of them may not be applicable to our code base,
+or may produce a large amount of churn for little gain.
+Checks may be added or disabled, but the effort may outweigh the benefits.
+Please make an affirmative argument for each change,
+including an example diff.
Occasionally, codespell has a false positive. To ignore the suggestion, add
the intended word to ``tool.codespell.ignore-words-list`` in ``pyproject.toml``.
@@ -164,15 +176,20 @@ Pre-commit hooks
----------------
NiBabel uses pre-commit_ to help committers validate their changes
-before committing. To enable these, you can use pipx_::
+before committing.
- pipx run pre-commit install
+Install the pre-commit hooks with::
-Or install and run::
-
- python -m pip install pre-commit
pre-commit install
+If pre-commit is not already installed in your environment,
+use one of the following::
+
+ uv sync --group=dev
+ # or
+ uv tool install --with=pre-commit-uv-bare pre-commit
+ # or
+ python -m pip install pre-commit
Changelog
=========
@@ -203,9 +220,8 @@ Please see `our community guidelines
<https://github.com/nipy/nibabel/blob/master/.github/CODE_OF_CONDUCT.md>`_.
Other projects call these guidelines the "code of conduct".
-.. _blue: https://blue.readthedocs.io/
+.. _ruff: https://docs.astral.sh/ruff/
+.. _uv: https://docs.astral.sh/uv/
.. _codespell: https://github.com/codespell-project/codespell
-.. _flake8: https://flake8.pycqa.org/
-.. _pipx: https://pypa.github.io/pipx/
-.. _precommit: https://pre-commit.com/
+.. _pre-commit: https://pre-commit.com/
.. _tox: https://tox.wiki/
=====================================
nibabel/_compression.py
=====================================
@@ -40,9 +40,9 @@ if ty.TYPE_CHECKING:
ModeRB = ty.Literal['rb']
ModeWT = ty.Literal['w', 'wt']
ModeWB = ty.Literal['wb']
- ModeR = ty.Union[ModeRT, ModeRB]
- ModeW = ty.Union[ModeWT, ModeWB]
- Mode = ty.Union[ModeR, ModeW]
+ ModeR = ModeRT | ModeRB
+ ModeW = ModeWT | ModeWB
+ Mode = ModeR | ModeW
else:
indexed_gzip, HAVE_INDEXED_GZIP, _ = optional_package('indexed_gzip')
=====================================
nibabel/_typing.py
=====================================
@@ -1,11 +1,7 @@
"""Helpers for typing compatibility across Python versions"""
import sys
-
-if sys.version_info < (3, 10):
- from typing_extensions import ParamSpec
-else:
- from typing import ParamSpec
+from typing import ParamSpec
if sys.version_info < (3, 11):
from typing_extensions import Self
=====================================
nibabel/cmdline/tests/test_roi.py
=====================================
@@ -147,7 +147,7 @@ def test_entrypoint(capsys):
with pytest.raises(SystemExit):
main()
captured = capsys.readouterr()
- assert captured.out.startswith('usage: nib-roi')
+ assert captured.out.startswith('usage: ')
def test_nib_roi_unknown_axes(capsys):
=====================================
nibabel/pkg_info.py
=====================================
@@ -12,7 +12,7 @@ except ImportError:
__version__ = '0+unknown'
-COMMIT_HASH = '4602d9231d'
+COMMIT_HASH = '513f421e0c'
def _cmp(a: Version, b: Version) -> int:
=====================================
nibabel/tests/test_removalschedule.py
=====================================
@@ -173,3 +173,7 @@ def test_unremoved_object():
def test_unremoved_attr():
with pytest.raises(AssertionError):
test_attribute_removal()
+
+
+if cmp_pkg_version('1.0.0') > -1:
+ pytest.skip('Shallow checkout, version unavailable', allow_module_level=True)
=====================================
pyproject.toml
=====================================
@@ -59,15 +59,7 @@ minc2 = ["h5py >=3.8"]
spm = ["scipy >=1.11"]
viewers = ["matplotlib >=3.7"]
zstd = ["backports.zstd >=1.1; python_version<'3.14'"]
-# For doc and test, make easy to use outside of tox
-# tox should use these with extras instead of duplicating
-doc = [
- "sphinx >=7.4",
- "matplotlib>=3.5",
- "numpydoc >=1.9",
- "texext >=0.6.8",
- "tomli >=2.3; python_version < '3.11'",
-]
+# Test dependencies, to allow testing an installed package
test = [
"pytest >=8",
"pytest-doctestplus >=1.4",
@@ -76,19 +68,37 @@ test = [
"pytest-xdist >=3.5",
"coverage[toml]>=7.2",
]
-# Remaining: Simpler to centralize in tox
+# Development dependencies; transferred to dependency-groups, here to avoid
+# breaking existing users of these extras.
+doc = []
dev = []
doctest = []
style = []
typing = []
[dependency-groups]
-style = [
- "ruff >=0.14.0",
+dev = [
+ "pre-commit>=4.5.1",
+ "pre-commit-uv>=4.2.1",
+ "tox>=4.48.1",
+ "tox-uv>=1.33.1",
+]
+doc = [
+ "sphinx >=7.4",
+ "matplotlib>=3.5",
+ "numpydoc >=1.9",
+ "texext >=0.6.8",
+ "tomli >=2.3; python_version < '3.11'",
]
typecheck = [
"mypy >=1.15",
+ "nibabel[all]",
+ # Easier than including a bunch of unnecessary deps
+ "pytest >=8",
+ "types-pillow>=10.2.0.20240822",
]
+# Replaced by pre-commit
+style = []
[tool.hatch.build.targets.sdist]
exclude = [
@@ -156,21 +166,30 @@ ignore = [
"B023", # TODO: enable
"B028",
"B904",
+ "B905", # Consider: add explicit strict kwarg to zip calls
"C401",
"C408",
"C416",
"PERF203",
"PIE790",
"PT007",
+ "PT010", # Consider: Set expected exception in pytest.raises
"PT011",
"PT012",
"PT017",
"PT018",
+ "PT028", # Consider: Test function parameter has default argument
+ "PT030", # Consider: pytest.warns(UserWarning) is too broad
+ "PT031", # Consider: pytest.warns(UserWarning) block should contain 1 statement
"PYI024",
"RUF005",
+ "RUF007", # Consider: itertools.pairwise(x) over zip(x[:-1], x[1:])
"RUF012", # TODO: enable
"RUF015",
"RUF017", # TODO: enable
+ "RUF059", # Consider: Unpacked variables never used
+ "RUF061", # Consider: Use context-manager form of pytest.raises
+ "TC003", # Consider: Move import into type-checking block
# https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
"W191",
"E111",
=====================================
tools/markdown_release_notes.py
=====================================
@@ -1,4 +1,10 @@
#!/usr/bin/env python
+# /// script
+# requires-python = ">=3.13"
+# dependencies = [
+# "sphinx>=9.1.0",
+# ]
+# ///
import re
import sys
from collections import defaultdict
@@ -16,6 +22,7 @@ RELEASE_REGEX = re.compile(r"""((?:\d+)\.(?:\d+)\.(?:\d+)) \(\w+ \d{1,2} \w+ \d{
class MockConfig:
intersphinx_timeout: int | None = None
+ intersphinx_cache_limit: int | None = None
tls_verify = False
tls_cacerts: str | dict[str, str] | None = None
user_agent: str = ''
=====================================
tox.ini
=====================================
@@ -120,7 +120,7 @@ commands =
description = Build documentation site
labels = docs
allowlist_externals = make
-extras = doc
+dependency_groups = doc
commands =
make -C doc html
@@ -130,32 +130,33 @@ labels = docs
runner = uv-venv-lock-runner
allowlist_externals = make
extras =
- doc
test
+dependency_groups =
+ doc
commands =
make -C doc doctest
+# The following checks are pinned in .pre-commit-config.yaml
+# The preferred way to run these is `pre-commit run -a`, but they are left here
+# for now on the off chance that someone is using these regularly.
[testenv:style{,-fix}]
description = Check our style guide
labels = check
-runner = uv-venv-lock-runner
-dependency_groups =
- style
skip_install = true
+dependency_groups =
+ dev
commands =
- !fix: ruff check --diff nibabel
- !fix: ruff format --diff nibabel
- fix: ruff check --fix nibabel
- fix: ruff format nibabel
+ pre-commit run ruff-check --all
+ pre-commit run ruff-format --all
[testenv:spellcheck]
description = Check spelling
labels = check
-deps =
- codespell[toml]
skip_install = true
+dependency_groups =
+ dev
commands =
- codespell . {posargs}
+ pre-commit run codespell --all
[testenv:typecheck]
description = Check type consistency
@@ -163,9 +164,6 @@ labels = check
runner = uv-venv-lock-runner
dependency_groups =
typecheck
-extras =
- all
- test
commands =
mypy nibabel
=====================================
uv.lock
=====================================
The diff for this file was not included because it is too large.
View it on GitLab: https://salsa.debian.org/med-team/nibabel/-/commit/cbee4bf89c5616416995254eedcb29b9a5b02311
--
View it on GitLab: https://salsa.debian.org/med-team/nibabel/-/commit/cbee4bf89c5616416995254eedcb29b9a5b02311
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20260518/2a9b2c30/attachment-0001.htm>
More information about the debian-med-commit
mailing list