Skip to content

Remove python < 3.5 from CI #12746

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 32 commits into from
Dec 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
8f2febf
[MRG] Remove Python < 3.5 from continuous integration
Sep 4, 2018
91026e3
merge
Dec 8, 2018
fc3345e
Merge remote-tracking branch 'upstream/master' into maint/remove-pyth…
adrinjalali Dec 9, 2018
345aedc
fix circleci merge issues
adrinjalali Dec 9, 2018
9c6c673
add min-required versions
adrinjalali Dec 9, 2018
4cd0788
make ubuntu use python3, remove python3.4 from conda scripts
adrinjalali Dec 9, 2018
21168d0
change to xenial dist on travis
adrinjalali Dec 9, 2018
bd1d1ad
libatlas-base-dev may be required?
adrinjalali Dec 9, 2018
7b7aeda
test python3.5 on win 32
adrinjalali Dec 9, 2018
f57d73e
try the latest cython on old ubuntu
adrinjalali Dec 10, 2018
84f6d96
add joblib to ubuntu instance
adrinjalali Dec 10, 2018
d2eb633
test cython 0.26.1
adrinjalali Dec 10, 2018
05ebd29
test cython 0.27.3
adrinjalali Dec 10, 2018
e2d6495
use cython 0.28.6 (0.28 is the first to support Python3.7)
adrinjalali Dec 10, 2018
dd9cf94
update setup.py
adrinjalali Dec 10, 2018
db6f012
fix validation.py
adrinjalali Dec 10, 2018
feb551b
fix remaining LooseVersion usages
adrinjalali Dec 10, 2018
c9d370f
update utils.fixes
adrinjalali Dec 10, 2018
cfef60d
add a comment for when euler_gamma was added to np
adrinjalali Dec 10, 2018
b79a0bf
remove unused imports
adrinjalali Dec 10, 2018
6629f08
remove more unused imports
adrinjalali Dec 10, 2018
d0fcb01
make collecting tests pass
adrinjalali Dec 10, 2018
8bd0a87
use the right part of the code in the test
adrinjalali Dec 10, 2018
ab8c767
test an env w/o SKLEARN_SITE_JOBLIB set
adrinjalali Dec 10, 2018
15cc2b8
remove externals/funcsigs
adrinjalali Dec 10, 2018
1c835ad
fix test_deprecation
adrinjalali Dec 10, 2018
349427a
fix datasets
adrinjalali Dec 10, 2018
6960322
fix more issues detected by codecov
adrinjalali Dec 10, 2018
088f284
add python3-min-dependency-versions to Circle-CI
adrinjalali Dec 11, 2018
a0d9953
run the job in circle-ci
adrinjalali Dec 11, 2018
9f99aa5
find min compatible versions on conda
adrinjalali Dec 11, 2018
3e1e8b7
change circle-ci job names
adrinjalali Dec 13, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
version: 2

jobs:
python3:
doc-min-dependencies:
docker:
- image: circleci/python:3.6.1
environment:
- MINICONDA_PATH: ~/miniconda
- CONDA_ENV_NAME: testenv
- PYTHON_VERSION: 3
- PYTHON_VERSION: 3.5
- NUMPY_VERSION: 1.11.0
- SCIPY_VERSION: 0.17.0
- PANDAS_VERSION: 0.18.0
- MATPLOTLIB_VERSION: 1.5.1
- SCIKIT_IMAGE_VERSION: 0.12.3
steps:
- checkout
- run: ./build_tools/circle/checkout_merge_commit.sh
Expand All @@ -30,31 +35,21 @@ jobs:
root: doc/_build/html
paths: .


python2:
doc:
docker:
# We use the python 3 docker image for simplicity. Python is installed
# through conda and the python version actually used is set via the
# PYTHON_VERSION environment variable.
- image: circleci/python:3.6.1
environment:
# Test examples run with minimal dependencies
- MINICONDA_PATH: ~/miniconda
- CONDA_ENV_NAME: testenv
- PYTHON_VERSION: "2"
- NUMPY_VERSION: "1.10"
- SCIPY_VERSION: "0.16"
- MATPLOTLIB_VERSION: "1.4"
- SCIKIT_IMAGE_VERSION: "0.11"
- PANDAS_VERSION: "0.17.1"
- PYTHON_VERSION: 3
steps:
- checkout
- run: ./build_tools/circle/checkout_merge_commit.sh
- restore_cache:
key: v1-datasets-{{ .Branch }}-python2
key: v1-datasets-{{ .Branch }}
- run: ./build_tools/circle/build_doc.sh
- save_cache:
key: v1-datasets-{{ .Branch }}-python2
key: v1-datasets-{{ .Branch }}
paths:
- ~/scikit_learn_data
- store_artifacts:
Expand All @@ -63,6 +58,11 @@ jobs:
- store_artifacts:
path: ~/log.txt
destination: log.txt
# Persists generated documentation so that it can be attached and deployed
# in the 'deploy' step.
- persist_to_workspace:
root: doc/_build/html
paths: .

lint:
docker:
Expand Down Expand Up @@ -114,8 +114,8 @@ workflows:
version: 2
build-doc-and-deploy:
jobs:
- python3
- python2
- doc
- doc-min-dependencies
- lint
- pypy3:
filters:
Expand Down
25 changes: 14 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ cache:
- $HOME/.cache/pip
- $HOME/.ccache

dist: trusty
dist: xenial

env:
global:
Expand All @@ -21,26 +21,29 @@ env:
matrix:
include:
# This environment tests that scikit-learn can be built against
# versions of numpy, scipy with ATLAS that comes with Ubuntu Trusty 14.04
# i.e. numpy 1.8.2 and scipy 0.13.3
- env: DISTRIB="ubuntu" PYTHON_VERSION="2.7" CYTHON_VERSION="0.23.5"
COVERAGE=true
# versions of numpy, scipy with ATLAS that comes with Ubuntu Xenial 16.04
# i.e. numpy 1.11 and scipy 0.17
- env: DISTRIB="ubuntu" PYTHON_VERSION="3.5" CYTHON_VERSION="0.28.6"
NUMPY_VERSION="1.11.0" SCIPY_VERSION="0.17.0"
PILLOW_VERSION="4.0.0" COVERAGE=true
SKLEARN_SITE_JOBLIB=1 JOBLIB_VERSION="0.11"
if: type != cron
addons:
apt:
packages:
# these only required by the DISTRIB="ubuntu" builds:
- python-scipy
- python3-scipy
- libatlas3-base
- libatlas-base-dev
- libatlas-dev
# Python 3.4 build
- env: DISTRIB="conda" PYTHON_VERSION="3.4" INSTALL_MKL="false"
NUMPY_VERSION="1.10.4" SCIPY_VERSION="0.16.1" CYTHON_VERSION="0.25.2"
# Python 3.5 build without SITE_JOBLIB
- env: DISTRIB="conda" PYTHON_VERSION="3.5" INSTALL_MKL="false"
NUMPY_VERSION="1.11.0" SCIPY_VERSION="0.17.0" CYTHON_VERSION="0.25.2"
PILLOW_VERSION="4.0.0" COVERAGE=true
if: type != cron
# Python 3.5 build
- env: DISTRIB="conda" PYTHON_VERSION="3.5" INSTALL_MKL="false"
NUMPY_VERSION="1.10.4" SCIPY_VERSION="0.16.1" CYTHON_VERSION="0.25.2"
NUMPY_VERSION="1.11.0" SCIPY_VERSION="0.17.0" CYTHON_VERSION="0.25.2"
PILLOW_VERSION="4.0.0" COVERAGE=true
SKLEARN_SITE_JOBLIB=1 JOBLIB_VERSION="0.11"
if: type != cron
Expand All @@ -57,7 +60,7 @@ matrix:
# This environment tests scikit-learn against numpy and scipy master
# installed from their CI wheels in a virtualenv with the Python
# interpreter provided by travis.
- python: 3.6
- python: 3.7
env: DISTRIB="scipy-dev" CHECK_WARNINGS="true"
if: type = cron OR commit_message =~ /\[scipy-dev\]/

Expand Down
5 changes: 2 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ environment:
PYTHON_ARCH: "64"
CHECK_WARNINGS: "true"

- PYTHON: "C:\\Python27"
PYTHON_VERSION: "2.7.8"
- PYTHON: "C:\\Python35"
PYTHON_VERSION: "3.5.6"
PYTHON_ARCH: "32"


# Because we only have a single worker, we don't want to waste precious
# appveyor CI time and make other PRs wait for repeated failures in a failing
# PR. The following option cancels pending jobs in a given PR after the first
Expand Down
9 changes: 2 additions & 7 deletions build_tools/travis/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,16 @@ if [[ "$DISTRIB" == "conda" ]]; then
fi
make_conda $TO_INSTALL

# for python 3.4, conda does not have recent pytest packages
if [[ "$PYTHON_VERSION" == "3.4" ]]; then
pip install pytest==3.5
fi

elif [[ "$DISTRIB" == "ubuntu" ]]; then
# At the time of writing numpy 1.9.1 is included in the travis
# virtualenv but we want to use the numpy installed through apt-get
# install.
deactivate
# Create a new virtualenv using system site packages for python, numpy
# and scipy
virtualenv --system-site-packages testvenv
virtualenv --system-site-packages --python=python3 testvenv
source testvenv/bin/activate
pip install pytest pytest-cov cython==$CYTHON_VERSION
pip install pytest pytest-cov cython==$CYTHON_VERSION joblib==$JOBLIB_VERSION

elif [[ "$DISTRIB" == "scipy-dev" ]]; then
make_conda python=3.7
Expand Down
7 changes: 1 addition & 6 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
import pytest
from _pytest.doctest import DoctestItem

from sklearn.utils.fixes import PY3_OR_LATER

PYTEST_MIN_VERSION = '3.3.0'

if LooseVersion(pytest.__version__) < PYTEST_MIN_VERSION:
Expand Down Expand Up @@ -47,11 +45,8 @@ def pytest_collection_modifyitems(config, items):
item.add_marker(skip_network)

# numpy changed the str/repr formatting of numpy arrays in 1.14. We want to
# run doctests only for numpy >= 1.14. We want to skip the doctest for
# python 2 due to unicode.
# run doctests only for numpy >= 1.14.
skip_doctests = False
if not PY3_OR_LATER:
skip_doctests = True
try:
import numpy as np
if LooseVersion(np.__version__) < LooseVersion('1.14'):
Expand Down
2 changes: 1 addition & 1 deletion examples/model_selection/plot_precision_recall.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
# ................................
from sklearn.metrics import precision_recall_curve
import matplotlib.pyplot as plt
from sklearn.utils.fixes import signature
from inspect import signature

precision, recall, _ = precision_recall_curve(y_test, y_score)

Expand Down
13 changes: 3 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@
from distutils.command.clean import clean as Clean
from pkg_resources import parse_version
import traceback

if sys.version_info[0] < 3:
import __builtin__ as builtins
else:
import builtins
import builtins

# This is a bit (!) hackish: we are setting a global variable so that the main
# sklearn __init__ can detect if it is being loaded by the setup routine, to
Expand Down Expand Up @@ -45,8 +41,8 @@
SCIPY_MIN_VERSION = '1.1.0'
NUMPY_MIN_VERSION = '1.14.0'
else:
SCIPY_MIN_VERSION = '0.13.3'
NUMPY_MIN_VERSION = '1.8.2'
SCIPY_MIN_VERSION = '0.17.0'
NUMPY_MIN_VERSION = '1.11.0'


# Optional setuptools features
Expand Down Expand Up @@ -183,10 +179,7 @@ def setup_package():
'Operating System :: POSIX',
'Operating System :: Unix',
'Operating System :: MacOS',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
Expand Down
2 changes: 1 addition & 1 deletion sklearn/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
import copy
import warnings
from collections import defaultdict
from inspect import signature

import numpy as np
from scipy import sparse
from .externals import six
from .utils.fixes import signature
from . import __version__


Expand Down
2 changes: 1 addition & 1 deletion sklearn/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

from __future__ import division
import warnings
from inspect import signature

from math import log
import numpy as np
Expand All @@ -20,7 +21,6 @@
from .preprocessing import label_binarize, LabelBinarizer
from .utils import check_X_y, check_array, indexable, column_or_1d
from .utils.validation import check_is_fitted, check_consistent_length
from .utils.fixes import signature
from .isotonic import IsotonicRegression
from .svm import LinearSVC
from .model_selection import check_cv
Expand Down
4 changes: 0 additions & 4 deletions sklearn/cluster/tests/test_k_means.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,6 @@ def test_k_means_new_centers():

@if_safe_multiprocessing_with_blas
def test_k_means_plus_plus_init_2_jobs():
if sys.version_info[:2] < (3, 4):
raise SkipTest(
"Possible multi-process bug with some BLAS under Python < 3.4")

km = KMeans(init="k-means++", n_clusters=n_clusters, n_jobs=2,
random_state=42).fit(X)
_check_fitted_model(km)
Expand Down
3 changes: 1 addition & 2 deletions sklearn/datasets/covtype.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from gzip import GzipFile
import logging
from os.path import dirname, exists, join
from os import remove
from os import remove, makedirs

import numpy as np

Expand All @@ -26,7 +26,6 @@
from .base import RemoteFileMetadata
from ..utils import Bunch
from .base import _pkl_filepath
from ..utils.fixes import makedirs
from ..utils import _joblib
from ..utils import check_random_state

Expand Down
9 changes: 1 addition & 8 deletions sklearn/datasets/kddcup99.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,7 @@ def _fetch_brute_kddcup99(data_home=None,
"""

data_home = get_data_home(data_home=data_home)
if sys.version_info[0] == 3:
# The zlib compression format use by joblib is not compatible when
# switching from Python 2 to Python 3, let us use a separate folder
# under Python 3:
dir_suffix = "-py3"
else:
# Backward compat for Python 2 users
dir_suffix = ""
dir_suffix = "-py3"

if percent10:
kddcup_dir = join(data_home, "kddcup99_10" + dir_suffix)
Expand Down
13 changes: 3 additions & 10 deletions sklearn/datasets/mldata.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,9 @@
from os.path import join, exists
import re
import numbers
try:
# Python 2
from urllib2 import HTTPError
from urllib2 import quote
from urllib2 import urlopen
except ImportError:
# Python 3+
from urllib.error import HTTPError
from urllib.parse import quote
from urllib.request import urlopen
from urllib.error import HTTPError
from urllib.parse import quote
from urllib.request import urlopen

import numpy as np
import scipy as sp
Expand Down
25 changes: 5 additions & 20 deletions sklearn/datasets/openml.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,14 @@
from contextlib import closing
from functools import wraps

try:
# Python 3+
from urllib.request import urlopen, Request
except ImportError:
# Python 2
from urllib2 import urlopen, Request

from urllib.request import urlopen, Request

import numpy as np
import scipy.sparse

from sklearn.externals import _arff
from .base import get_data_home
from ..externals.six import string_types, PY2, BytesIO
from ..externals.six import string_types
from ..externals.six.moves.urllib.error import HTTPError
from ..utils import Bunch

Expand Down Expand Up @@ -89,8 +83,6 @@ def is_gzip(_fsrc):
if data_home is None:
fsrc = urlopen(req)
if is_gzip(fsrc):
if PY2:
fsrc = BytesIO(fsrc.read())
return gzip.GzipFile(fileobj=fsrc, mode='rb')
return fsrc

Expand Down Expand Up @@ -357,16 +349,9 @@ def _arff_load():
else:
return_type = _arff.DENSE

if PY2:
arff_file = _arff.load(
response.read(),
encode_nominal=encode_nominal,
return_type=return_type,
)
else:
arff_file = _arff.loads(response.read().decode('utf-8'),
encode_nominal=encode_nominal,
return_type=return_type)
arff_file = _arff.loads(response.read().decode('utf-8'),
encode_nominal=encode_nominal,
return_type=return_type)
return arff_file

return _arff_load()
Expand Down
Loading