Skip to content

Commit 14e7c32

Browse files
jnothmanogrisel
authored andcommitted
Restructure access to vendored/site Joblib (#11471)
In order to fix #11408, this swaps `joblib` and `_joblib`. It however, allows users to access joblib's `Memory` or `Parallel` functionality without accessing `sklearn.externals._joblib` by importing `Memory`, `Parallel`, etc. into `sklearn.utils`.
1 parent 8a15053 commit 14e7c32

Some content is hidden

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

74 files changed

+151
-88
lines changed

.travis.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ matrix:
3838
NUMPY_VERSION="1.10.4" SCIPY_VERSION="0.16.1" CYTHON_VERSION="0.25.2"
3939
PILLOW_VERSION="4.0.0" COVERAGE=true
4040
if: type != cron
41-
# This environment tests the newest supported Anaconda release (5.0.0)
42-
# It also runs tests requiring Pandas and PyAMG
41+
# This environment tests the newest supported Anaconda release.
42+
# It runs tests requiring pandas and PyAMG.
43+
# It also runs with the site joblib instead of the vendored copy of joblib.
4344
- env: DISTRIB="conda" PYTHON_VERSION="3.6.2" INSTALL_MKL="true"
4445
NUMPY_VERSION="1.14.2" SCIPY_VERSION="1.0.0" PANDAS_VERSION="0.20.3"
4546
CYTHON_VERSION="0.26.1" PYAMG_VERSION="3.3.2" PILLOW_VERSION="4.3.0"
46-
COVERAGE=true
47+
JOBLIB_VERSION="0.12.0" COVERAGE=true
4748
CHECK_PYTEST_SOFT_DEPENDENCY="true" TEST_DOCSTRINGS="true"
49+
SKLEARN_SITE_JOBLIB=1
4850
if: type != cron
4951
# flake8 linting on diff wrt common ancestor with upstream/master
5052
- env: RUN_FLAKE8="true" SKIP_TESTS="true"

benchmarks/bench_covertype.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
from sklearn.ensemble import RandomForestClassifier, ExtraTreesClassifier
6060
from sklearn.ensemble import GradientBoostingClassifier
6161
from sklearn.metrics import zero_one_loss
62-
from sklearn.externals.joblib import Memory
62+
from sklearn.utils import Memory
6363
from sklearn.utils import check_array
6464

6565
# Memoize the data extraction and memory map the resulting

benchmarks/bench_mnist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
from sklearn.ensemble import ExtraTreesClassifier
4242
from sklearn.ensemble import RandomForestClassifier
4343
from sklearn.dummy import DummyClassifier
44-
from sklearn.externals.joblib import Memory
44+
from sklearn.utils import Memory
4545
from sklearn.kernel_approximation import Nystroem
4646
from sklearn.kernel_approximation import RBFSampler
4747
from sklearn.metrics import zero_one_loss

benchmarks/bench_plot_nmf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from sklearn.decomposition.nmf import _initialize_nmf
2323
from sklearn.decomposition.nmf import _beta_divergence
2424
from sklearn.decomposition.nmf import INTEGER_TYPES, _check_init
25-
from sklearn.externals.joblib import Memory
25+
from sklearn.utils import Memory
2626
from sklearn.exceptions import ConvergenceWarning
2727
from sklearn.utils.extmath import safe_sparse_dot, squared_norm
2828
from sklearn.utils import check_array

benchmarks/bench_rcv1_logreg_convergence.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import gc
99
import time
1010

11-
from sklearn.externals.joblib import Memory
11+
from sklearn.utils import Memory
1212
from sklearn.linear_model import (LogisticRegression, SGDClassifier)
1313
from sklearn.datasets import fetch_rcv1
1414
from sklearn.linear_model.sag import get_auto_step_size

benchmarks/bench_saga.py

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

1313
from sklearn.datasets import fetch_rcv1, load_iris, load_digits, \
1414
fetch_20newsgroups_vectorized
15-
from sklearn.externals.joblib import delayed, Parallel, Memory
15+
from sklearn.utils import delayed, Parallel, Memory
1616
from sklearn.linear_model import LogisticRegression
1717
from sklearn.metrics import log_loss
1818
from sklearn.model_selection import train_test_split

benchmarks/bench_tsne_mnist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import json
1616
import argparse
1717

18-
from sklearn.externals.joblib import Memory
18+
from sklearn.utils import Memory
1919
from sklearn.datasets import fetch_mldata
2020
from sklearn.manifold import TSNE
2121
from sklearn.neighbors import NearestNeighbors

build_tools/travis/install.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ if [[ "$DISTRIB" == "conda" ]]; then
5959
TO_INSTALL="$TO_INSTALL pillow=$PILLOW_VERSION"
6060
fi
6161

62+
if [[ -n "$JOBLIB_VERSION" ]]; then
63+
TO_INSTALL="$TO_INSTALL joblib=$JOBLIB_VERSION"
64+
fi
65+
6266
conda create -n testenv --yes $TO_INSTALL
6367
source activate testenv
6468

doc/developers/utilities.rst

Lines changed: 1 addition & 1 deletion

doc/glossary.rst

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)