Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REL: 5.3.0 #1373

Merged
merged 8 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,17 @@ jobs:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'windows-latest', 'macos-13', 'macos-latest']
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
architecture: ['x64', 'x86', 'arm64']
dependencies: ['full', 'pre']
include:
# Basic dependencies only
- os: ubuntu-latest
python-version: 3.8
python-version: 3.9
dependencies: 'none'
# Absolute minimum dependencies
- os: ubuntu-latest
python-version: 3.8
python-version: 3.9
dependencies: 'min'
# NoGIL
- os: ubuntu-latest
Expand Down Expand Up @@ -153,10 +153,10 @@ jobs:
- os: macos-13
dependencies: pre
# Drop pre tests for SPEC-0-unsupported Python versions
- python-version: '3.8'
dependencies: pre
- python-version: '3.9'
dependencies: pre
- python-version: '3.10'
dependencies: pre

env:
DEPENDS: ${{ matrix.dependencies }}
Expand Down
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ Oliver P. Hinds <[email protected]>
Or Duek <[email protected]>
Oscar Esteban <[email protected]>
Paul McCarthy <[email protected]> <[email protected]>
Paul McCarthy <[email protected]> <[email protected]>
Reinder Vos de Wael <[email protected]> <[email protected]>
Roberto Guidotti <[email protected]>
Roberto Guidotti <[email protected]> <[email protected]>
Expand Down
44 changes: 25 additions & 19 deletions .zenodo.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
"name": "Cipollini, Ben",
"orcid": "0000-0002-7782-0790"
},
{
"affiliation": "CEA",
"name": "Papadopoulos Orfanos, Dimitri",
"orcid": "0000-0002-1242-8990"
},
{
"name": "McCarthy, Paul"
},
Expand Down Expand Up @@ -78,13 +83,11 @@
"orcid": "0000-0001-7159-1387"
},
{
"name": "Wang, Hao-Ting",
"orcid": "0000-0003-4078-2038"
"name": "Moloney, Brendan"
},
{
"affiliation": "CEA",
"name": "Papadopoulos Orfanos, Dimitri",
"orcid": "0000-0002-1242-8990"
"name": "Wang, Hao-Ting",
"orcid": "0000-0003-4078-2038"
},
{
"affiliation": "Harvard University - Psychology",
Expand Down Expand Up @@ -123,9 +126,6 @@
{
"name": "S\u00f3lon, Anibal"
},
{
"name": "Moloney, Brendan"
},
{
"name": "Morency, F\u00e9lix C."
},
Expand Down Expand Up @@ -177,6 +177,11 @@
{
"name": "Van, Andrew"
},
{
"affiliation": "Brigham and Women's Hospital, Mass General Brigham/Harvard Medical School",
"name": "Legarreta, Jon Haitz",
"orcid": "0000-0002-9661-1396"
},
{
"affiliation": "Google",
"name": "Gorgolewski, Krzysztof J.",
Expand All @@ -203,6 +208,9 @@
{
"name": "Baker, Eric M."
},
{
"name": "Koudoro, Serge"
},
{
"name": "Hayashi, Soichi"
},
Expand All @@ -220,14 +228,14 @@
"name": "Esteban, Oscar",
"orcid": "0000-0001-8435-6191"
},
{
"name": "Koudoro, Serge"
},
{
"affiliation": "University College London",
"name": "P\u00e9rez-Garc\u00eda, Fernando",
"orcid": "0000-0001-9090-3024"
},
{
"name": "Becq, Guillaume"
},
{
"name": "Dock\u00e8s, J\u00e9r\u00f4me"
},
Expand Down Expand Up @@ -270,9 +278,9 @@
"orcid": "0000-0003-1076-5122"
},
{
"affiliation": "Brigham and Women's Hospital, Mass General Brigham/Harvard Medical School",
"name": "Legarreta, Jon Haitz",
"orcid": "0000-0002-9661-1396"
"affiliation": "Polytechnique Montr\u00e9al, Montr\u00e9al, CA",
"name": "Newton, Joshua",
"orcid": "0009-0005-6963-3812"
},
{
"name": "Hahn, Kevin S."
Expand All @@ -285,6 +293,9 @@
{
"name": "Hinds, Oliver P."
},
{
"name": "Sandro"
},
{
"name": "Fauber, Bennet"
},
Expand Down Expand Up @@ -391,11 +402,6 @@
},
{
"name": "freec84"
},
{
"affiliation": "Polytechnique Montréal, Montréal, CA",
"name": "Newton, Joshua",
"orcid": "0009-0005-6963-3812"
}
],
"keywords": [
Expand Down
61 changes: 51 additions & 10 deletions Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,72 @@ Eric Larson (EL), Demian Wassermann, Stephan Gerhard and Ross Markello (RM).

References like "pr/298" refer to github pull request numbers.

Upcoming release (To be determined)
===================================
5.3.0 (Tuesday 8 October 2024)
==============================

This release primarily adds support for Python 3.13 and Numpy 2.0.

NiBabel 6.0 will drop support for Numpy 1.x.

New features
------------
* Update NIfTI extension protocol to include ``.content : bytes``, ``.text : str`` and ``.json : dict``
properties for accessing extension contents. Exceptions will be raised on ``.text`` and ``.json`` if
conversion fails. (pr/1336) (CM)

Enhancements
------------
* Ability to read data from many multiframe DICOM files that previously generated errors
* Ability to read data from many multiframe DICOM files that previously generated errors (pr/1340)
(Brendan Moloney, reviewed by CM)
* ``nib-nifti-dx`` now supports NIfTI-2 files with a ``--nifti2`` flag (pr/1323) (CM)
* Update :mod:`nibabel.streamlines.tractogram` to support ragged arrays. (pr/1291)
(Serge Koudoro, reviewed by CM)
* Filter numpy ``UserWarning`` on ``np.finfo(np.longdouble)``. This can occur on
Windows systems, but it's done in the context of checking for the problem that
is being warned against, so there's no need to be noisy. (pr/1310)
(Joshua Newton, reviewed by CM)
* Improve error message for for dicomwrapper errors in shape calculation (pr/1302)
(YOH, reviewed by CM)
* Support "flat" ASCII-encoded GIFTI DataArrays (pr/1298) (PM, reviewed by CM)

Bug fixes
---------
* Fixed multiframe DICOM issue where data could be flipped along slice dimension relative to the
affine
* Fixed multiframe DICOM issue where ``image_position`` and the translation component in the
``affine`` could be incorrect

Documentation
-------------
* Fix location initialization/update in OrthoSlicer3D for permuted axes (pr/1319, pr/1350)
(Guillaume Becq, reviewed by CM)
* Fix DICOM scaling, making frame filtering explicit (pr/1342) (Brendan Moloney, reviewed by CM)
* Fixed multiframe DICOM issue where data could be flipped along slice dimension relative to the
affine (pr/1340) (Brendan Moloney, reviewed by CM)
* Fixed multiframe DICOM issue where ``image_position`` and the translation component in the
``affine`` could be incorrect (pr/1340) (Brendan Moloney, reviewed by CM)

Maintenance
-----------
* Numpy 2.0 compatibility and addressing deprecations in numpy API
(pr/1304, pr/1330, pr/1331, pr/1334, pr/1337) (Jon Haitz Legarreta Gorroño, CM)
* Python 3.13 compatibility (pr/1315) (Sandro from the Fedora Project, reviewed by CM)
* Testing on Python 3.13 with free-threading (pr/1339) (CM)
* Testing on ARM64 Mac OS runners (pr/1320) (CM)
* Proactively address deprecations in coming Python versions (pr/1329, pr/1332, pr/1333)
(Jon Haitz Legarreta Gorroño, reviewed by CM)
* Replace nose-era ``setup()`` and ``teardown()`` functions with pytest equivalents
(pr/1325) (Sandro from the Fedora Project, reviewed by Étienne Mollier and CM)
* Transitioned from blue/isort/flake8 to `ruff <https://docs.astral.sh/ruff/>`__. (pr/1289)
(Dimitri Papadopoulos, reviewed by CM)
* Vetted and added various rules to the ruff configuration for auto-formatting and style
guide enforcement. (pr/1321, pr/1351, pr/1352, pr/1353, pr/1354, pr/1355, pr/1357, pr/1358,
pr/1359, pr/1360, pr/1361, pr/1362, pr/1363, pr/1364, pr/1368, pr/1369)
(Dimitri Papadopoulos, reviewed by CM)
* Fixing typos when found. (pr/1313, pr/1370) (MB, Dimitri Papadopoulos)
* Applied Repo-Review suggestions (Dimitri Papadopoulos, reviewed by CM)

API changes and deprecations
----------------------------
* Raise :class:`~nibabel.spatialimages.HeaderDataError` from
:func:`~nibabel.nifti1.Nifti1Header.set_qform` if the affine fails to decompose.
This would previously result in :class:`numpy.linalg.LinAlgError`. (pr/1227) (CM)
* The :func:`nibabel.onetime.auto_attr` module can be replaced by :func:`functools.cached_property`
in all supported versions of Python. This alias may be removed in future versions. (pr/1341) (CM)
* Removed the deprecated ``nisext`` (setuptools extensions) package. (pr/1290) (CM, reviewed by MB)


5.2.1 (Monday 26 February 2024)
Expand Down
2 changes: 1 addition & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@

# General information about the project.
project = 'NiBabel'
copyright = f"2006-2023, {authors['name']} <{authors['email']}>"
copyright = f"2006, {authors['name']} <{authors['email']}>"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down
3 changes: 3 additions & 0 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ contributed code and discussion (in rough order of appearance):
* Reinder Vos de Wael
* Peter Suter
* Blake Dewey
* Guillaume Becq
* Joshua Newton
* Sandro from the Fedora Project

License reprise
===============
Expand Down
20 changes: 10 additions & 10 deletions doc/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,16 @@ is for you.
Requirements
------------

.. check these against pyproject.toml

* Python_ 3.8 or greater
* NumPy_ 1.20 or greater
* Packaging_ 17.0 or greater
* importlib-resources_ 1.3 or greater (or Python 3.9+)
* SciPy_ (optional, for full SPM-ANALYZE support)
* h5py_ (optional, for MINC2 support)
* PyDICOM_ 1.0.0 or greater (optional, for DICOM support)
* `Python Imaging Library`_ (optional, for PNG conversion in DICOMFS)
.. check these against pyproject.toml / tox.ini

* Python_ 3.9 or greater
* NumPy_ 1.22 or greater
* Packaging_ 20.0 or greater
* importlib-resources_ 5.12 or greater (or Python 3.12+)
* SciPy_ 1.8 or greater (optional, for full SPM-ANALYZE support)
* h5py_ 3.5 or greater (optional, for MINC2 support)
* PyDICOM_ 2.3.0 or greater (optional, for DICOM support)
* `Python Imaging Library`_ 8.4 or greater (optional, for PNG conversion in DICOMFS)
* pytest_ (optional, to run the tests)
* sphinx_ (optional, to build the documentation)

Expand Down
5 changes: 1 addition & 4 deletions nibabel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,7 @@ def bench(label=None, verbose=1, extra_argv=None):
code : ExitCode
Returns the result of running the tests as a ``pytest.ExitCode`` enum
"""
try:
from importlib.resources import as_file, files
except ImportError:
from importlib_resources import as_file, files
from importlib.resources import as_file, files

args = []
if extra_argv is not None:
Expand Down
7 changes: 2 additions & 5 deletions nibabel/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@

@pytest.fixture(scope='session', autouse=True)
def legacy_printoptions():
from packaging.version import Version

if Version(np.__version__) >= Version('1.22'):
np.set_printoptions(legacy='1.21')
np.set_printoptions(legacy='1.21')


@pytest.fixture
Expand All @@ -24,7 +21,7 @@ def max_digits():
orig_max_str_digits = sys.get_int_max_str_digits()
yield sys.set_int_max_str_digits
sys.set_int_max_str_digits(orig_max_str_digits)
except AttributeError: # pragma: no cover
except AttributeError: # PY310 # pragma: no cover
# Nothing to do for versions of Python that lack these methods
# They were added as DoS protection in Python 3.11 and backported to
# some other versions.
Expand Down
2 changes: 1 addition & 1 deletion nibabel/filebasedimages.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
if ty.TYPE_CHECKING:
from .filename_parser import ExtensionSpec, FileSpec

FileSniff = ty.Tuple[bytes, str]
FileSniff = tuple[bytes, str]

ImgT = ty.TypeVar('ImgT', bound='FileBasedImage')
HdrT = ty.TypeVar('HdrT', bound='FileBasedHeader')
Expand Down
5 changes: 1 addition & 4 deletions nibabel/nicom/ascconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,7 @@ def assign2atoms(assign_ast, default_class=int):
target = target.value
prev_target_type = OrderedDict
elif isinstance(target, ast.Subscript):
if isinstance(target.slice, ast.Constant): # PY39
index = target.slice.value
else: # PY38
index = target.slice.value.n
index = target.slice.value
atoms.append(Atom(target, prev_target_type, index))
target = target.value
prev_target_type = list
Expand Down
2 changes: 1 addition & 1 deletion nibabel/nifti1.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ def _mangle(self, dataset: DicomDataset) -> bytes:
(38, 'eval', NiftiExtension),
(40, 'matlab', NiftiExtension),
(42, 'quantiphyse', NiftiExtension),
(44, 'mrs', NiftiExtension[ty.Dict[str, ty.Any]]),
(44, 'mrs', NiftiExtension[dict[str, ty.Any]]),
),
fields=('code', 'label', 'handler'),
)
Expand Down
6 changes: 1 addition & 5 deletions nibabel/spatialimages.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
from __future__ import annotations

import typing as ty
from functools import cache
from typing import Literal

import numpy as np
Expand All @@ -145,11 +146,6 @@
from .viewers import OrthoSlicer3D
from .volumeutils import shape_zoom_affine

try:
from functools import cache
except ImportError: # PY38
from functools import lru_cache as cache

if ty.TYPE_CHECKING:
import io
from collections.abc import Sequence
Expand Down
6 changes: 1 addition & 5 deletions nibabel/testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import unittest
import warnings
from contextlib import nullcontext
from importlib.resources import as_file, files
from itertools import zip_longest

import numpy as np
Expand All @@ -29,11 +30,6 @@
if ty.TYPE_CHECKING:
from importlib.resources.abc import Traversable

try:
from importlib.resources import as_file, files
except ImportError: # PY38
from importlib_resources import as_file, files


def get_test_data(
subdir: ty.Literal['gifti', 'nicom', 'externals'] | None = None,
Expand Down
Loading