Skip to content

Commit 2937a3a

Browse files
authored
Merge pull request #1079 from effigies/mnt/nep29
NEP29: Require Python 3.7+, numpy 1.17+, declare 3.10 support
2 parents 4ecf756 + d90e8a0 commit 2937a3a

16 files changed

+34
-99
lines changed

.github/workflows/pre-release.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
strategy:
2727
matrix:
2828
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
29-
python-version: ["3.8", "3.9", "3.10.0-rc.1"]
29+
python-version: ["3.9", "3.10"]
3030
architecture: ['x64', 'x86']
3131
install: ['setup']
3232
check: ['test']
@@ -36,7 +36,7 @@ jobs:
3636
include:
3737
# Pydicom master
3838
- os: ubuntu-latest
39-
python-version: 3.8
39+
python-version: "3.10"
4040
install: setup
4141
check: test
4242
pip-flags: ''
@@ -47,10 +47,6 @@ jobs:
4747
architecture: x86
4848
- os: macos-latest
4949
architecture: x86
50-
- os: windows-latest
51-
python-version: "3.10.0-rc.1"
52-
- os: macos-latest
53-
python-version: "3.10.0-rc.1"
5450

5551
env:
5652
DEPENDS: ${{ matrix.depends }}

.github/workflows/stable.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
strategy:
3030
matrix:
3131
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
32-
python-version: [3.6, 3.7, 3.8, 3.9]
32+
python-version: [3.7, 3.8, 3.9, "3.10"]
3333
architecture: ['x64', 'x86']
3434
install: ['pip']
3535
check: ['test']
@@ -39,52 +39,52 @@ jobs:
3939
include:
4040
# Basic dependencies only
4141
- os: ubuntu-latest
42-
python-version: 3.6
42+
python-version: 3.7
4343
install: setup
4444
check: test
4545
pip-flags: ''
4646
depends: REQUIREMENTS
4747
optional-depends: ''
4848
# Absolute minimum dependencies
4949
- os: ubuntu-latest
50-
python-version: 3.6
50+
python-version: 3.7
5151
install: setup
5252
check: test
5353
pip-flags: ''
5454
depends: MIN_REQUIREMENTS
5555
optional-depends: ''
5656
# Absolute minimum dependencies plus old MPL, Pydicom, Pillow
5757
- os: ubuntu-latest
58-
python-version: 3.6
58+
python-version: 3.7
5959
install: setup
6060
check: test
6161
pip-flags: ''
6262
depends: MIN_REQUIREMENTS
6363
optional-depends: MIN_OPT_DEPENDS
6464
# Clean install imports only with package-declared dependencies
6565
- os: ubuntu-latest
66-
python-version: 3.6
66+
python-version: 3.7
6767
install: pip
6868
check: skiptests
6969
pip-flags: ''
7070
depends: ''
7171
# Check all installation methods
7272
- os: ubuntu-latest
73-
python-version: 3.8
73+
python-version: "3.10"
7474
install: wheel
7575
check: test
7676
pip-flags: ''
7777
depends: REQUIREMENTS
7878
optional-depends: DEFAULT_OPT_DEPENDS
7979
- os: ubuntu-latest
80-
python-version: 3.8
80+
python-version: "3.10"
8181
install: sdist
8282
check: test
8383
pip-flags: ''
8484
depends: REQUIREMENTS
8585
optional-depends: DEFAULT_OPT_DEPENDS
8686
- os: ubuntu-latest
87-
python-version: 3.8
87+
python-version: "3.10"
8888
install: archive
8989
check: test
9090
pip-flags: ''

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
os: linux
88
arch: arm64
9-
dist: xenial
9+
dist: focal
1010
language: python
1111
cache: pip
1212

@@ -21,10 +21,10 @@ env:
2121
- CHECK_TYPE="test"
2222

2323
python:
24-
- 3.6
2524
- 3.7
2625
- 3.8
2726
- 3.9
27+
- "3.10"
2828

2929
# Set up virtual environment, build package, build from depends
3030
before_install:

min-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Auto-generated by tools/update_requirements.py
2-
numpy ==1.15
2+
numpy ==1.17
33
packaging ==17.0
44
setuptools

nibabel/_h5py_compat.py

Lines changed: 0 additions & 12 deletions
This file was deleted.

nibabel/minc2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class Minc2Image(Minc1Image):
158158
def from_file_map(klass, file_map, *, mmap=True, keep_file_open=None):
159159
# Import of h5py might take awhile for MPI-enabled builds
160160
# So we are importing it here "on demand"
161-
from ._h5py_compat import h5py
161+
import h5py
162162
holder = file_map['image']
163163
if holder.filename is None:
164164
raise MincError('MINC2 needs filename for load')

nibabel/testing/__init__.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,7 @@
2424

2525
from itertools import zip_longest
2626

27-
try:
28-
from contextlib import nullcontext
29-
except ImportError: # PY36
30-
from contextlib import contextmanager
31-
@contextmanager
32-
def nullcontext():
33-
yield
27+
from contextlib import nullcontext
3428

3529

3630
def test_data(subdir=None, fname=None):

nibabel/tests/test_h5py_compat.py

Lines changed: 0 additions & 46 deletions
This file was deleted.

nibabel/tests/test_image_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
from ..optpkg import optional_package
3434
_, have_scipy, _ = optional_package('scipy')
35-
from .._h5py_compat import have_h5py
35+
_, have_h5py, _ = optional_package('h5py')
3636

3737
from .. import (AnalyzeImage, Spm99AnalyzeImage, Spm2AnalyzeImage,
3838
Nifti1Pair, Nifti1Image, Nifti2Pair, Nifti2Image,

nibabel/tests/test_imageclasses.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@
1010
from nibabel.analyze import AnalyzeImage
1111
from nibabel.nifti1 import Nifti1Image
1212
from nibabel.nifti2 import Nifti2Image
13-
from .._h5py_compat import have_h5py
1413

1514
from nibabel import imageclasses
1615
from nibabel.imageclasses import spatial_axes_first, class_map, ext_map
1716

18-
17+
from nibabel.optpkg import optional_package
1918
from nibabel.testing import clear_and_catch_warnings
2019

2120

21+
have_h5py = optional_package('h5py')[1]
22+
2223
DATA_DIR = pjoin(dirname(__file__), 'data')
2324

2425
MINC_3DS = ('minc1_1_scale.mnc',)

nibabel/tests/test_loadsave.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ def test_read_img_data():
3636
]
3737
fnames_test += [pathlib.Path(p) for p in fnames_test]
3838
for fname in fnames_test:
39-
# os.path.join doesn't work between str / os.PathLike in py3.5
40-
fpath = pjoin(data_path, str(fname))
39+
fpath = pjoin(data_path, fname)
4140
if isinstance(fname, pathlib.Path):
4241
fpath = pathlib.Path(fpath)
4342
img = load(fpath)
@@ -56,8 +55,7 @@ def test_read_img_data():
5655
up_fpath = pjoin(tmpdir, str(fname).upper())
5756
if isinstance(fname, pathlib.Path):
5857
up_fpath = pathlib.Path(up_fpath)
59-
# shutil doesn't work with os.PathLike in py3.5
60-
shutil.copyfile(str(fpath), str(up_fpath))
58+
shutil.copyfile(fpath, up_fpath)
6159
img = load(up_fpath)
6260
assert_array_equal(img.dataobj, data)
6361
del img

nibabel/tests/test_minc2.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@
1313

1414
from .. import minc2
1515
from ..minc2 import Minc2File, Minc2Image
16-
from .._h5py_compat import h5py, have_h5py, setup_module
1716

17+
from ..optpkg import optional_package
1818
from ..testing import data_path
1919

2020
from . import test_minc1 as tm2
2121

22+
h5py, have_h5py, setup_module = optional_package('h5py')
23+
2224
# Example images in format expected for ``test_image_api``, adding ``zooms``
2325
# item.
2426
EXAMPLE_IMAGES = [

nibabel/tests/test_minc2_data.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@
1414

1515
import numpy as np
1616

17-
from .._h5py_compat import h5py, have_h5py, setup_module
18-
1917
from .nibabel_data import get_nibabel_data, needs_nibabel_data
2018
from .. import load as top_load, Nifti1Image
19+
from ..optpkg import optional_package
2120

2221
from numpy.testing import (assert_array_equal, assert_almost_equal)
2322

23+
h5py, have_h5py, setup_module = optional_package('h5py')
24+
2425
MINC2_PATH = pjoin(get_nibabel_data(), 'nitest-minc2')
2526

2627

nibabel/tests/test_proxy_api.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
from .. import minc1
4545
from ..externals.netcdf import netcdf_file
4646
from .. import minc2
47-
from .._h5py_compat import h5py, have_h5py
4847
from .. import ecat
4948
from .. import parrec
5049
from ..casting import have_binary128
@@ -57,12 +56,15 @@
5756

5857
from ..testing import data_path as DATA_PATH, assert_dt_equal, clear_and_catch_warnings
5958
from ..deprecator import ExpiredDeprecationError
59+
from ..optpkg import optional_package
6060

6161
from ..tmpdirs import InTemporaryDirectory
6262

6363
from .test_api_validators import ValidateAPI
6464
from .test_parrec import EG_REC, VARY_REC
6565

66+
h5py, have_h5py, _ = optional_package('h5py')
67+
6668

6769
def _some_slicers(shape):
6870
ndim = len(shape)

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Auto-generated by tools/update_requirements.py
2-
numpy >=1.15
2+
numpy >=1.17
33
packaging >=17.0
44
setuptools

setup.cfg

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ classifiers =
1313
License :: OSI Approved :: MIT License
1414
Operating System :: OS Independent
1515
Programming Language :: Python
16-
Programming Language :: Python :: 3.6
1716
Programming Language :: Python :: 3.7
1817
Programming Language :: Python :: 3.8
1918
Programming Language :: Python :: 3.9
19+
Programming Language :: Python :: 3.10
2020
Topic :: Scientific/Engineering
2121
license = MIT License
2222
description = Access a multitude of neuroimaging data formats
@@ -28,9 +28,9 @@ provides =
2828
nisext
2929

3030
[options]
31-
python_requires = >=3.6
31+
python_requires = >=3.7
3232
install_requires =
33-
numpy >=1.15
33+
numpy >=1.17
3434
packaging >=17.0
3535
setuptools
3636
zip_safe = False
@@ -59,7 +59,6 @@ style =
5959
test =
6060
coverage
6161
pytest !=5.3.4
62-
pytest <7 ; python_version == "3.6"
6362
pytest-cov
6463
pytest-doctestplus
6564
zstd =

0 commit comments

Comments
 (0)