Skip to content

Commit

Permalink
Raise deprecation warnings with Python 3.6 and 3.7 (#754)
Browse files Browse the repository at this point in the history
* Add deprecation warnings for Python 3.6 and 3.7

* Remove arrays from exclude in Github action

* Run tests and minimum dependencies on python 3.8

* Run linting and publish on 3.8

* Ignore D401 warnings

* Update setup.cfg

* Update testing.yml
  • Loading branch information
JulioAPeraza authored Jan 11, 2023
1 parent c5f18ee commit be4df90
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.7"]
python-version: ["3.8"]
name: Style check
defaults:
run:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
19 changes: 14 additions & 5 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ jobs:
matrix:
os: ["ubuntu-latest", "macos-latest"]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
include:
# ubuntu-20.04 is used only to test python 3.6
- os: "ubuntu-20.04"
python-version: "3.6"
exclude:
# ubuntu-latest does not support python 3.6
- os: "ubuntu-latest"
python-version: "3.6"

defaults:
run:
shell: bash
Expand Down Expand Up @@ -70,7 +79,7 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.6"]
python-version: ["3.8"]
defaults:
run:
shell: bash
Expand All @@ -79,7 +88,7 @@ jobs:
- name: 'Set up python'
uses: actions/setup-python@v2
with:
python-version: 3.6
python-version: 3.8
- name: 'Install NiMARE'
shell: bash {0}
run: pip install -e .[minimum,tests,peaks2maps-cpu]
Expand All @@ -102,7 +111,7 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.7"]
python-version: ["3.8"]
defaults:
run:
shell: bash
Expand Down Expand Up @@ -134,7 +143,7 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.7"]
python-version: ["3.8"]
defaults:
run:
shell: bash
Expand Down Expand Up @@ -166,7 +175,7 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.7"]
python-version: ["3.8"]
defaults:
run:
shell: bash
Expand Down
32 changes: 32 additions & 0 deletions nimare/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""NiMARE: Neuroimaging Meta-Analysis Research Environment."""
import logging
import sys
import warnings

from ._version import get_versions
Expand Down Expand Up @@ -40,3 +41,34 @@
]

del get_versions


def _py367_deprecation_warning():
"""Deprecation warnings message.
Notes
-----
Adapted from Nilearn.
"""
py36_warning = (
"Python 3.6 and 3.7 support is deprecated and will be removed in release 0.1.0 of NiMARE. "
"Consider switching to Python 3.8, 3.9 or 3.10."
)
warnings.filterwarnings("once", message=py36_warning)
warnings.warn(message=py36_warning, category=FutureWarning, stacklevel=3)


def _python_deprecation_warnings():
"""Raise deprecation warnings.
Notes
-----
Adapted from Nilearn.
"""
if sys.version_info.major == 3 and (
sys.version_info.minor == 6 or sys.version_info.minor == 7
):
_py367_deprecation_warning()


_python_deprecation_warnings()
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,7 @@ max-line-length = 99
exclude = *build/,_version.py
putty-ignore =
*/__init__.py : +F401
per-file-ignores =
*/__init__.py:D401
ignore = E203,E402,E722,W503
docstring-convention = numpy

0 comments on commit be4df90

Please sign in to comment.