Skip to content

Commit c4a47e3

Browse files
author
Joan Massich
committed
Merge branch 'master' into 8057_sklearn_pr
2 parents 5a11bd0 + 32ac228 commit c4a47e3

File tree

122 files changed

+6883
-2639
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+6883
-2639
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ matrix:
3838
# This environment tests the newest supported Anaconda release (4.4.0)
3939
# It also runs tests requiring Pandas.
4040
- env: DISTRIB="conda" PYTHON_VERSION="3.6.1" INSTALL_MKL="true"
41-
NUMPY_VERSION="1.12.1" SCIPY_VERSION="0.19.0" PANDAS_VERSION="0.20.1"
41+
NUMPY_VERSION="1.13" SCIPY_VERSION="0.19.0" PANDAS_VERSION="0.20.2"
4242
CYTHON_VERSION="0.25.2" COVERAGE=true
4343
# This environment use pytest to run the tests. It uses the newest
4444
# supported Anaconda release (4.4.0). It also runs tests requiring Pandas.
@@ -49,7 +49,7 @@ matrix:
4949
# flake8 linting on diff wrt common ancestor with upstream/master
5050
- env: RUN_FLAKE8="true" SKIP_TESTS="true"
5151
DISTRIB="conda" PYTHON_VERSION="3.5" INSTALL_MKL="true"
52-
NUMPY_VERSION="1.12.1" SCIPY_VERSION="0.19.0" CYTHON_VERSION="0.23.5"
52+
NUMPY_VERSION="1.13" SCIPY_VERSION="0.19.0" CYTHON_VERSION="0.23.5"
5353
# This environment tests scikit-learn against numpy and scipy master
5454
# installed from their CI wheels in a virtualenv with the Python
5555
# interpreter provided by travis.

build_tools/circle/build_doc.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ conda update --yes --quiet conda
109109
conda create -n $CONDA_ENV_NAME --yes --quiet python numpy scipy \
110110
cython nose coverage matplotlib sphinx=1.6.2 pillow
111111
source activate testenv
112-
pip install numpydoc
112+
pip install sphinx-gallery numpydoc
113113

114114
# Build and install scikit-learn in dev mode
115115
python setup.py develop

build_tools/travis/install.sh

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,30 @@ if [[ "$DISTRIB" == "conda" ]]; then
3939

4040
# Configure the conda environment and put it in the path using the
4141
# provided versions
42+
if [[ "$USE_PYTEST" == "true" ]]; then
43+
TEST_RUNNER_PACKAGE=pytest
44+
else
45+
TEST_RUNNER_PACKAGE=nose
46+
fi
47+
4248
if [[ "$INSTALL_MKL" == "true" ]]; then
43-
conda create -n testenv --yes python=$PYTHON_VERSION pip nose pytest \
44-
numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION \
49+
conda create -n testenv --yes python=$PYTHON_VERSION pip \
50+
$TEST_RUNNER_PACKAGE numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION \
4551
mkl cython=$CYTHON_VERSION \
4652
${PANDAS_VERSION+pandas=$PANDAS_VERSION}
4753

4854
else
49-
conda create -n testenv --yes python=$PYTHON_VERSION pip nose pytest \
50-
numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION \
55+
conda create -n testenv --yes python=$PYTHON_VERSION pip \
56+
$TEST_RUNNER_PACKAGE numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION \
5157
nomkl cython=$CYTHON_VERSION \
5258
${PANDAS_VERSION+pandas=$PANDAS_VERSION}
5359
fi
5460
source activate testenv
5561

56-
# Install nose-timer via pip
57-
pip install nose-timer
62+
if [[ $USE_PYTEST != "true" ]]; then
63+
# Install nose-timer via pip
64+
pip install nose-timer
65+
fi
5866

5967
elif [[ "$DISTRIB" == "ubuntu" ]]; then
6068
# At the time of writing numpy 1.9.1 is included in the travis

build_tools/travis/test_script.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,13 @@ run_tests() {
4343
fi
4444
$TEST_CMD sklearn
4545

46-
# Test doc (only with nose until we switch completely to pytest)
47-
if [[ "$USE_PYTEST" != "true" ]]; then
48-
# Going back to git checkout folder needed for make test-doc
49-
cd $OLDPWD
46+
# Going back to git checkout folder needed to test documentation
47+
cd $OLDPWD
48+
49+
if [[ "$USE_PYTEST" == "true" ]]; then
50+
pytest $(find doc -name '*.rst' | sort)
51+
else
52+
# Makefile is using nose
5053
make test-doc
5154
fi
5255
}

conftest.py

Whitespace-only changes.

doc/README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
# Documentation for scikit-learn
22

33
This section contains the full manual and web page as displayed in
4-
http://scikit-learn.org. To generate the full web page, including
5-
the example gallery (this might take a while):
4+
http://scikit-learn.org.
5+
Building the website requires the sphinx and sphinx-gallery packages:
6+
7+
pip install sphinx sphinx-gallery
8+
9+
To generate the full web page, including the example gallery (this might take a
10+
while):
611

712
make html
813

@@ -16,7 +21,6 @@ To build the PDF manual, run
1621

1722
make latexpdf
1823

19-
2024
The website is hosted at github and can be updated manually (for releases)
2125
by pushing to the https://github.com/scikit-learn/scikit-learn.github.io repository.
2226

doc/datasets/conftest.py

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
from os.path import exists
2+
from os.path import join
3+
4+
import numpy as np
5+
6+
from sklearn.utils.testing import SkipTest
7+
from sklearn.utils.testing import check_skip_network
8+
from sklearn.datasets import get_data_home
9+
from sklearn.utils.testing import install_mldata_mock
10+
from sklearn.utils.testing import uninstall_mldata_mock
11+
12+
13+
def setup_labeled_faces():
14+
data_home = get_data_home()
15+
if not exists(join(data_home, 'lfw_home')):
16+
raise SkipTest("Skipping dataset loading doctests")
17+
18+
19+
def setup_mldata():
20+
# setup mock urllib2 module to avoid downloading from mldata.org
21+
install_mldata_mock({
22+
'mnist-original': {
23+
'data': np.empty((70000, 784)),
24+
'label': np.repeat(np.arange(10, dtype='d'), 7000),
25+
},
26+
'iris': {
27+
'data': np.empty((150, 4)),
28+
},
29+
'datasets-uci-iris': {
30+
'double0': np.empty((150, 4)),
31+
'class': np.empty((150,)),
32+
},
33+
})
34+
35+
36+
def teardown_mldata():
37+
uninstall_mldata_mock()
38+
39+
40+
def setup_rcv1():
41+
check_skip_network()
42+
# skip the test in rcv1.rst if the dataset is not already loaded
43+
rcv1_dir = join(get_data_home(), "RCV1")
44+
if not exists(rcv1_dir):
45+
raise SkipTest("Download RCV1 dataset to run this test.")
46+
47+
48+
def setup_twenty_newsgroups():
49+
data_home = get_data_home()
50+
if not exists(join(data_home, '20news_home')):
51+
raise SkipTest("Skipping dataset loading doctests")
52+
53+
54+
def setup_working_with_text_data():
55+
check_skip_network()
56+
57+
58+
def pytest_runtest_setup(item):
59+
fname = item.fspath.strpath
60+
if fname.endswith('datasets/labeled_faces.rst'):
61+
setup_labeled_faces()
62+
elif fname.endswith('datasets/mldata.rst'):
63+
setup_mldata()
64+
elif fname.endswith('datasets/rcv1.rst'):
65+
setup_rcv1()
66+
elif fname.endswith('datasets/twenty_newsgroups.rst'):
67+
setup_twenty_newsgroups()
68+
elif fname.endswith('datasets/working_with_text_data.rst'):
69+
setup_working_with_text_data()
70+
71+
72+
def pytest_runtest_teardown(item):
73+
fname = item.fspath.strpath
74+
if fname.endswith('datasets/mldata.rst'):
75+
teardown_mldata()

doc/datasets/mldata.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
44
>>> import numpy as np
55
>>> import os
6+
>>> import tempfile
7+
>>> # Create a temporary folder for the data fetcher
8+
>>> custom_data_home = tempfile.mkdtemp()
9+
>>> os.makedirs(os.path.join(custom_data_home, 'mldata'))
10+
611

712
.. _mldata:
813

@@ -70,3 +75,8 @@ defaults to individual datasets:
7075
... data_home=custom_data_home)
7176
>>> iris3 = fetch_mldata('datasets-UCI iris', target_name='class',
7277
... data_name='double0', data_home=custom_data_home)
78+
79+
80+
..
81+
>>> import shutil
82+
>>> shutil.rmtree(custom_data_home)

doc/datasets/mldata_fixture.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,12 @@
33
Mock urllib2 access to mldata.org and create a temporary data folder.
44
"""
55

6-
from os import makedirs
7-
from os.path import join
86
import numpy as np
9-
import tempfile
10-
import shutil
117

12-
from sklearn import datasets
138
from sklearn.utils.testing import install_mldata_mock
149
from sklearn.utils.testing import uninstall_mldata_mock
1510

1611

17-
def globs(globs):
18-
# Create a temporary folder for the data fetcher
19-
global custom_data_home
20-
custom_data_home = tempfile.mkdtemp()
21-
makedirs(join(custom_data_home, 'mldata'))
22-
globs['custom_data_home'] = custom_data_home
23-
return globs
24-
25-
2612
def setup_module():
2713
# setup mock urllib2 module to avoid downloading from mldata.org
2814
install_mldata_mock({
@@ -42,4 +28,3 @@ def setup_module():
4228

4329
def teardown_module():
4430
uninstall_mldata_mock()
45-
shutil.rmtree(custom_data_home)

doc/index.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,13 @@
207207
<li><em>On-going development:</em>
208208
<a href="/dev/whats_new.html"><em>What's new</em> (Changelog)</a>
209209
</li>
210-
<li><em>September 2016.</em> scikit-learn 0.18.0 is available for download (<a href="whats_new.html#version-0-18">Changelog</a>).
210+
<li><em>September 2016.</em> scikit-learn 0.18.0 is available for download (<a href="whats_new/v0.18.html">Changelog</a>).
211211
</li>
212-
<li><em>November 2015.</em> scikit-learn 0.17.0 is available for download (<a href="whats_new.html#version-0-17">Changelog</a>).
212+
<li><em>November 2015.</em> scikit-learn 0.17.0 is available for download (<a href="whats_new/v0.17.html">Changelog</a>).
213213
</li>
214-
<li><em>March 2015.</em> scikit-learn 0.16.0 is available for download (<a href="whats_new.html#version-0-16">Changelog</a>).
214+
<li><em>March 2015.</em> scikit-learn 0.16.0 is available for download (<a href="whats_new/v0.16.html">Changelog</a>).
215215
</li>
216-
<li><em>July 2014.</em> scikit-learn 0.15.0 is available for download (<a href="whats_new.html#version-0-15">Changelog</a>).
216+
<li><em>July 2014.</em> scikit-learn 0.15.0 is available for download (<a href="whats_new/v0.15.html">Changelog</a>).
217217
</li>
218218
<li><em>July 14-20th, 2014: international sprint.</em>
219219
During this week-long sprint, we gathered 18 of the core
@@ -227,7 +227,7 @@
227227
<a href="http://www.inria.fr/">Inria</a>,
228228
and <a href="http://www.tinyclues.com/">tinyclues</a>.
229229
</li>
230-
<li><em>August 2013.</em> scikit-learn 0.14 is available for download (<a href="whats_new.html#version-0-14">Changelog</a>).
230+
<li><em>August 2013.</em> scikit-learn 0.14 is available for download (<a href="whats_new/v0.14.html">Changelog</a>).
231231
</li>
232232
</ul>
233233
</div>

0 commit comments

Comments
 (0)