Skip to content

Commit

Permalink
[MAINT] drop python 3.7 (#4033)
Browse files Browse the repository at this point in the history
* drop python 3.7

* update pre-commit

* rm python deprecation warning
  • Loading branch information
Remi-Gau authored Oct 25, 2023
1 parent 12a417a commit 0fa9ba3
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ body:
label: Python version
description: What python version are you using?
options:
- label: '3.12'
- label: '3.11'
- label: '3.10'
- label: '3.9'
- label: '3.8'
- label: '3.7'

- type: textarea
attributes:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
min_requirements:
if: github.repository == 'nilearn/nilearn'
runs-on: ubuntu-latest
name: Python 3.7, minimal requirements without Matplotlib
name: minimal requirements without Matplotlib
defaults:
run:
shell: bash
Expand All @@ -22,10 +22,10 @@ jobs:
steps:
- name: Checkout nilearn
uses: actions/checkout@v4
- name: Setup python '3.7'
- name: Setup python '3.8'
uses: actions/setup-python@v4
with:
python-version: '3.7'
python-version: '3.8'
- name: Display Python version
shell: bash -l {0}
run: python -c "import sys; print(sys.version)"
Expand All @@ -45,7 +45,7 @@ jobs:
min_requirements_matplotlib:
if: github.repository == 'nilearn/nilearn'
runs-on: ubuntu-latest
name: Python 3.7, minimal requirements with Matplotlib
name: minimal requirements with Matplotlib
defaults:
run:
shell: bash
Expand All @@ -58,7 +58,7 @@ jobs:
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.7'
python-version: '3.8'
- name: Display Python version
shell: bash -l {0}
run: python -c "import sys; print(sys.version)"
Expand All @@ -79,7 +79,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.9', '3.10', '3.11', '3.12']
name: ${{ matrix.os }} with Python ${{ matrix.python-version }} and latest package versions
defaults:
run:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ repos:
rev: v3.15.0
hooks:
- id: pyupgrade
args: [--py36-plus]
args: [--py38-plus]

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
Expand Down
22 changes: 0 additions & 22 deletions nilearn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,35 +40,13 @@
"""

import gzip
import sys
import warnings

try:
from ._version import __version__ # noqa: F401
except ImportError:
__version__ = "0+unknown"


def _py37_deprecation_warning():
py37_warning = (
"Python 3.7 support is deprecated and will be removed in "
"release 0.12 of Nilearn. Consider switching to "
"Python 3.9 or 3.10."
)
warnings.filterwarnings("once", message=py37_warning)
warnings.warn(
message=py37_warning, category=DeprecationWarning, stacklevel=3
)


def _python_deprecation_warnings():
if sys.version_info.major == 3 and sys.version_info.minor == 7:
_py37_deprecation_warning()


_python_deprecation_warnings()


# Monkey-patch gzip to have faster reads on large gzip files
if hasattr(gzip.GzipFile, "max_read_chunk"):
gzip.GzipFile.max_read_chunk = 100 * 1024 * 1024 # 100Mb
Expand Down
24 changes: 0 additions & 24 deletions nilearn/tests/test_init.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import sys
import warnings

import pytest

import nilearn


Expand All @@ -11,22 +6,3 @@ def test_version_number():
assert nilearn.__version__ == nilearn._version.__version__
except AttributeError:
assert nilearn.__version__ == "0+unknown"


with warnings.catch_warnings(record=True):
from nilearn import _py37_deprecation_warning, _python_deprecation_warnings


def test_py37_deprecation_warning():
with pytest.warns(
DeprecationWarning, match="Python 3.7 support is deprecated"
):
_py37_deprecation_warning()


def test_python_deprecation_warnings():
if sys.version_info.major == 3 and sys.version_info.minor == 6:
with pytest.warns(
DeprecationWarning, match="Python 3.6 support is deprecated"
):
_python_deprecation_warnings()
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ classifiers = [
"Operating System :: POSIX",
"Operating System :: Unix",
"Operating System :: MacOS",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand All @@ -41,7 +40,7 @@ license = {text = "new BSD"}
maintainers = [{name = "Bertrand Thirion", email = "bertrand.thirion@inria.fr"}]
name = "nilearn"
readme = "README.rst"
requires-python = ">=3.7"
requires-python = ">=3.8"

[project.optional-dependencies]
# A combination of dependencies useful for developers
Expand Down

0 comments on commit 0fa9ba3

Please sign in to comment.