Skip to content
This repository was archived by the owner on Apr 2, 2020. It is now read-only.

Commit fdc0b37

Browse files
authored
Preparation for last release (#446)
* Preparation for last release - Added New Deprecation warning - Removed old deprecation warnings and test. - Bumped version to 0.0.1rc - Added a max_version for Nilearn to 0.6.3, preventing installation with Nilearn 0.7.0 . - Updated news section & whats_new. * Removed now obviated tests, added test for library deprecation * Testing installation fails when Nilearn >= 0.7.x * Fixed: Install Nistats wheel, not Nilearn wheel * Normalized version number; removed non-implemented key * Added warnings for Nistats retirements & the unit tests * Added partial test for checking import times warnings & their count * Fixed error in partial test for checking import times warnings & their count * Fixed errors in tests * Always build Universal wheels * Test for expected number of correct warning * Trying to raise error on Grep mismatch * Trying to raise error on warn count mismatch
1 parent a2a3928 commit fdc0b37

File tree

7 files changed

+104
-50
lines changed

7 files changed

+104
-50
lines changed

azure-pipelines.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,42 @@ jobs:
3939
testResultsFiles: '**/test-results.xml'
4040
testRunTitle: 'Python $(python.version)'
4141
condition: succeededOrFailed()
42+
43+
44+
- job: 'test_retirement_warning_with_nilearn_07x'
45+
pool:
46+
vmImage: 'ubuntu-18.04'
47+
strategy:
48+
matrix:
49+
Python36:
50+
python.version: '3.6'
51+
maxParallel: 4
52+
53+
steps:
54+
- task: UsePythonVersion@0
55+
inputs:
56+
versionSpec: '$(python.version)'
57+
architecture: 'x64'
58+
59+
- script: |
60+
set -e
61+
python -m pip install --upgrade pip
62+
pip install --prefer-binary setuptools wheel
63+
pip install git+https://github.com/nilearn/nilearn.git@master\#egg\=nilearn
64+
displayName: 'Install Nilearn master (>=0.7.x) & dependencies for building Nistats'
65+
66+
- script: |
67+
set -e
68+
python setup.py sdist bdist_wheel --universal
69+
displayName: 'Build Nistats'
70+
71+
- script: |
72+
set -e
73+
pip install dist/nistats-0.0.1rc0-*-none-any.whl
74+
warn_count=$(python -c "import nistats; from nistats.first_level_model import FirstLevelModel" |& grep -c "Using Nistats with Nilearn versions >= 0.7.0")
75+
echo $warn_count
76+
if [ $warn_count -ne 1 ]
77+
then
78+
exit 1
79+
fi
80+
displayName: 'Install Nistats & check for correct warnings, raised only once'

doc/themes/nistats/layout.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ <h2>Functional MRI Neuro-Imaging in Python</h2>
191191

192192
<h4> News </h4>
193193
<ul>
194+
<li><p> <strong>April 2020</strong>: Nistats 0.0.1rc released</p></li>
194195
<li><p> <strong>February 2020</strong>: Nistats 0.0.1b2 released</p></li>
195196
<li><p> <strong>October 2019</strong>: Nistats 0.0.1b1 released</p></li>
196197
<li><p> <strong>October 2018</strong>: Nistats 0.0.1b0 released</p></li>

doc/whats_new.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
0.1.0rc
2+
=======
3+
4+
.. warning::
5+
6+
This is the LAST release of Nistats.
7+
8+
| All Nistats functionality has been incorporated into Nilearn.
9+
| It will be available as part of Nilearn 0.7.0.
10+
| All future development will be done in Nilearn.
11+
12+
113
0.1.0b2
214
=======
315

nistats/__init__.py

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -26,42 +26,49 @@
2626
utils --- Miscellaneous utilities
2727
"""
2828

29-
import sys
3029
import warnings
30+
from distutils.version import LooseVersion
31+
32+
import nilearn
3133

3234
from .version import _check_module_dependencies, __version__
3335

3436

35-
def _py2_deprecation_warning():
36-
py2_warning = ('Python2 support is deprecated and will be removed in '
37-
'a future release. Consider switching to Python3.')
38-
warnings.filterwarnings('once', message=py2_warning)
39-
warnings.warn(message=py2_warning,
40-
category=DeprecationWarning,
41-
stacklevel=3,
42-
)
37+
def _nistats_deprecation_warning():
38+
warning_msg = (
39+
'\n\n'
40+
' | Starting with Nilearn 0.7.0, all Nistats functionality '
41+
"has been incorporated into Nilearn's stats & reporting modules.\n"
42+
' | Nistats package will no longer be updated or maintained.\n')
43+
warnings.filterwarnings('once', message=warning_msg)
44+
warnings.warn(message=warning_msg,
45+
category=FutureWarning,
46+
stacklevel=4)
4347

4448

45-
def _py34_deprecation_warning():
46-
py34_warning = ('Python 3.4 support is deprecated and will be removed in '
47-
'a future release. '
48-
'Consider switching to Python 3.6 or 3.7.'
49-
)
50-
warnings.filterwarnings('once', message=py34_warning)
51-
warnings.warn(message=py34_warning,
52-
category=DeprecationWarning,
53-
stacklevel=3,
54-
)
49+
def _nistats_redundant_warning():
50+
warning_msg = (
51+
'\n\n'
52+
' | Using Nistats with Nilearn versions >= 0.7.0 '
53+
'is redundant and potentially conflicting.\n'
54+
' | Nilearn versions 0.7.0 and up offer all the functionality of Nistats '
55+
'as well the latest features and fixes.\n'
56+
' | We strongly recommend uninstalling Nistats and using '
57+
"Nilearn's stats & reporting modules.\n")
58+
warnings.filterwarnings('once', message=warning_msg)
59+
warnings.warn(message=warning_msg,
60+
stacklevel=4)
5561

5662

57-
def _python_deprecation_warnings():
58-
if sys.version_info.major == 2:
59-
_py2_deprecation_warning()
60-
elif sys.version_info.major == 3 and sys.version_info.minor == 4:
61-
_py34_deprecation_warning()
63+
def _nistats_retirement_warning():
64+
nilearn_version = LooseVersion(nilearn.__version__)
65+
if nilearn_version.version[1] > 6:
66+
_nistats_redundant_warning()
67+
else:
68+
_nistats_deprecation_warning()
6269

6370

6471
_check_module_dependencies()
65-
_python_deprecation_warnings()
72+
_nistats_retirement_warning()
6673

6774
__all__ = ['__version__', 'datasets', 'design_matrix']

nistats/tests/test_init.py

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,29 @@
11
import sys
22
import warnings
33

4-
54
# import time warnings don't interfere with warning's tests
65
import pytest
76

87
with warnings.catch_warnings(record=True):
9-
from nistats import _py34_deprecation_warning
10-
from nistats import _py2_deprecation_warning
11-
from nistats import _python_deprecation_warnings
12-
13-
14-
def test_py2_deprecation_warning():
15-
with pytest.warns(DeprecationWarning,
16-
match='Python2 support is deprecated'):
17-
_py2_deprecation_warning()
8+
from nistats import (_nistats_deprecation_warning,
9+
_nistats_redundant_warning,
10+
)
1811

1912

20-
def test_py34_deprecation_warning():
21-
with pytest.warns(DeprecationWarning,
22-
match='Python 3.4 support is deprecated'):
23-
_py34_deprecation_warning()
13+
def test_nistats_deprecation_warning():
14+
with pytest.warns(
15+
FutureWarning,
16+
match='\n\n | Starting with Nilearn 0.7.0, all Nistats functionality ',
17+
):
18+
_nistats_deprecation_warning()
2419

2520

26-
def test_python_deprecation_warnings():
27-
if sys.version_info.major == 2:
28-
with pytest.warns(DeprecationWarning,
29-
match='Python2 support is deprecated'):
30-
_python_deprecation_warnings()
31-
elif sys.version_info.major == 3 and sys.version_info.minor == 4:
32-
with pytest.warns(DeprecationWarning,
33-
match='Python 3.4 support is deprecated'):
34-
_python_deprecation_warnings()
21+
def test_nistats_redundant_warning():
22+
with pytest.warns(
23+
UserWarning,
24+
match='\n\n | Using Nistats with Nilearn versions >= 0.7.0 ',
25+
):
26+
_nistats_redundant_warning()
3527

3628

3729
def test_warnings_filter_scope():

nistats/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# Dev branch marker is: 'X.Y.dev' or 'X.Y.devN' where N is an integer.
2222
# 'X.Y.dev0' is the canonical version of 'X.Y.dev'
2323
#
24-
__version__ = '0.0.1b2'
24+
__version__ = '0.0.1rc0'
2525

2626
_NISTATS_INSTALL_MSG = 'See %s for installation information.' % (
2727
'http://nistats.github.io/introduction.html#installation')

setup.cfg

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,7 @@ addopts =
1010
--doctest-modules
1111
-s
1212
-vv
13-
--durations=0
13+
--durations=0
14+
15+
[bdist_wheel]
16+
universal=1

0 commit comments

Comments
 (0)