Skip to content

CI: use conda-forge on 3.6 build #15668

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

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ matrix:
- JOB_NAME: "36"
- TEST_ARGS="--skip-slow --skip-network"
- PANDAS_TESTING_MODE="deprecate"
- CONDA_FORGE=true
addons:
apt:
packages:
Expand Down
7 changes: 5 additions & 2 deletions ci/install_travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,17 @@ conda config --set ssl_verify false || exit 1
conda config --set always_yes true --set changeps1 false || exit 1
conda update -q conda

echo "[add channels]"
# add the pandas channel to take priority
# to add extra packages
echo "[add channels]"
conda config --add channels pandas || exit 1
conda config --remove channels defaults || exit 1
conda config --add channels defaults || exit 1

conda install anaconda-client
if [ "$CONDA_FORGE" ]; then
# add conda-forge channel as priority
conda config --add channels conda-forge || exit 1
fi

# Useful for debugging any issues with conda
conda info -a || exit 1
Expand Down
1 change: 1 addition & 0 deletions ci/requirements-3.6.run
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ html5lib
jinja2
sqlalchemy
pymysql
feather-format
# psycopg2 (not avail on defaults ATM)
beautifulsoup4
s3fs
Expand Down
7 changes: 0 additions & 7 deletions ci/requirements-3.6.sh

This file was deleted.

3 changes: 2 additions & 1 deletion pandas/tests/frame/test_missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,8 @@ def test_interp_nan_idx(self):
df.interpolate(method='values')

def test_interp_various(self):
tm._skip_if_no_scipy()
tm.skip_if_no_package('scipy', max_version='0.19.0')

df = DataFrame({'A': [1, 2, np.nan, 4, 5, np.nan, 7],
'C': [1, 2, 3, 5, 8, 13, 21]})
df = df.set_index('C')
Expand Down
3 changes: 2 additions & 1 deletion pandas/tests/frame/test_rank.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ def test_rank_axis(self):
tm.assert_frame_equal(df.rank(axis=1), df.rank(axis='columns'))

def test_rank_methods_frame(self):
tm.skip_if_no_package('scipy', '0.13', 'scipy.stats.rankdata')
tm.skip_if_no_package('scipy', min_version='0.13',
app='scipy.stats.rankdata')
import scipy
from scipy.stats import rankdata

Expand Down
7 changes: 4 additions & 3 deletions pandas/tests/series/test_missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,8 @@ def test_interp_quad(self):
assert_series_equal(result, expected)

def test_interp_scipy_basic(self):
tm._skip_if_no_scipy()
tm.skip_if_no_package('scipy', max_version='0.19.0')

s = Series([1, 3, np.nan, 12, np.nan, 25])
# slinear
expected = Series([1., 3., 7.5, 12., 18.5, 25.])
Expand Down Expand Up @@ -1027,8 +1028,8 @@ def test_spline(self):

def test_spline_extrapolate(self):
tm.skip_if_no_package(
'scipy', '0.15',
'setting ext on scipy.interpolate.UnivariateSpline')
'scipy', min_version='0.15',
app='setting ext on scipy.interpolate.UnivariateSpline')
s = Series([1, 2, 3, 4, np.nan, 6, np.nan])
result3 = s.interpolate(method='spline', order=1, ext=3)
expected3 = Series([1., 2., 3., 4., 5., 6., 6.])
Expand Down
3 changes: 2 additions & 1 deletion pandas/tests/series/test_rank.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ def _check(s, expected, method='average'):
_check(series, results[method], method=method)

def test_rank_methods_series(self):
tm.skip_if_no_package('scipy', '0.13', 'scipy.stats.rankdata')
tm.skip_if_no_package('scipy', min_version='0.13',
app='scipy.stats.rankdata')
import scipy
from scipy.stats import rankdata

Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/sparse/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,7 @@ def test_isnotnull(self):
@pytest.mark.parametrize('dtype', [object, bool, int, float, np.uint16])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might as well push something to remove this object. 😛

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we just not test this at all (object I mean)? I don't actually have scipy 0.19.0 installed, so can't really test this.

Copy link
Contributor

@kernc kernc Mar 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what I quickly tested (0.18.1) only simple methods and properties, like .tocoo(), .todok(), .dtype, .shape work with spmatrices of object dtype. While we do preserve this dtype if encountered, I see little harm in skipping it altogether.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok separated out the object test. skips on 0.19.0.

def test_from_to_scipy(spmatrix, index, columns, fill_value, dtype):
# GH 4343
tm._skip_if_no_scipy()
tm.skip_if_no_package('scipy', max_version='0.19.0')

# Make one ndarray and from it one sparse matrix, both to be used for
# constructing frames and comparing results
Expand Down
14 changes: 5 additions & 9 deletions pandas/tests/test_nanops.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import warnings
import numpy as np
from pandas import Series, isnull
from pandas import Series, isnull, _np_version_under1p9
from pandas.types.common import is_integer_dtype
import pandas.core.nanops as nanops
import pandas.util.testing as tm
Expand Down Expand Up @@ -338,8 +338,7 @@ def test_nanmean_overflow(self):
# is now consistent with numpy

# numpy < 1.9.0 is not computing this correctly
from distutils.version import LooseVersion
if LooseVersion(np.__version__) >= '1.9.0':
if not _np_version_under1p9:
for a in [2 ** 55, -2 ** 55, 20150515061816532]:
s = Series(a, index=range(500), dtype=np.int64)
result = s.mean()
Expand Down Expand Up @@ -388,8 +387,7 @@ def test_nanstd(self):
allow_tdelta=True, allow_obj='convert')

def test_nansem(self):
tm.skip_if_no_package('scipy.stats')
tm._skip_if_scipy_0_17()
tm.skip_if_no_package('scipy', min_version='0.17.0')
from scipy.stats import sem
self.check_funs_ddof(nanops.nansem, sem, allow_complex=False,
allow_str=False, allow_date=False,
Expand Down Expand Up @@ -448,16 +446,14 @@ def _skew_kurt_wrap(self, values, axis=None, func=None):
return result

def test_nanskew(self):
tm.skip_if_no_package('scipy.stats')
tm._skip_if_scipy_0_17()
tm.skip_if_no_package('scipy', min_version='0.17.0')
from scipy.stats import skew
func = partial(self._skew_kurt_wrap, func=skew)
self.check_funs(nanops.nanskew, func, allow_complex=False,
allow_str=False, allow_date=False, allow_tdelta=False)

def test_nankurt(self):
tm.skip_if_no_package('scipy.stats')
tm._skip_if_scipy_0_17()
tm.skip_if_no_package('scipy', min_version='0.17.0')
from scipy.stats import kurtosis
func1 = partial(kurtosis, fisher=True)
func = partial(self._skew_kurt_wrap, func=func1)
Expand Down
10 changes: 5 additions & 5 deletions pandas/tests/test_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ def test_cmov_window_na_min_periods(self):

def test_cmov_window_regular(self):
# GH 8238
tm._skip_if_no_scipy()
tm.skip_if_no_package('scipy', max_version='0.19.0')

win_types = ['triang', 'blackman', 'hamming', 'bartlett', 'bohman',
'blackmanharris', 'nuttall', 'barthann']
Expand Down Expand Up @@ -938,7 +938,7 @@ def test_cmov_window_regular(self):

def test_cmov_window_regular_linear_range(self):
# GH 8238
tm._skip_if_no_scipy()
tm.skip_if_no_package('scipy', max_version='0.19.0')

win_types = ['triang', 'blackman', 'hamming', 'bartlett', 'bohman',
'blackmanharris', 'nuttall', 'barthann']
Expand All @@ -955,7 +955,7 @@ def test_cmov_window_regular_linear_range(self):

def test_cmov_window_regular_missing_data(self):
# GH 8238
tm._skip_if_no_scipy()
tm.skip_if_no_package('scipy', max_version='0.19.0')

win_types = ['triang', 'blackman', 'hamming', 'bartlett', 'bohman',
'blackmanharris', 'nuttall', 'barthann']
Expand Down Expand Up @@ -988,7 +988,7 @@ def test_cmov_window_regular_missing_data(self):

def test_cmov_window_special(self):
# GH 8238
tm._skip_if_no_scipy()
tm.skip_if_no_package('scipy', max_version='0.19.0')

win_types = ['kaiser', 'gaussian', 'general_gaussian', 'slepian']
kwds = [{'beta': 1.}, {'std': 1.}, {'power': 2.,
Expand All @@ -1015,7 +1015,7 @@ def test_cmov_window_special(self):

def test_cmov_window_special_linear_range(self):
# GH 8238
tm._skip_if_no_scipy()
tm.skip_if_no_package('scipy', max_version='0.19.0')

win_types = ['kaiser', 'gaussian', 'general_gaussian', 'slepian']
kwds = [{'beta': 1.}, {'std': 1.}, {'power': 2.,
Expand Down
28 changes: 13 additions & 15 deletions pandas/util/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,14 +304,6 @@ def _skip_if_no_scipy():
pytest.skip('scipy.sparse missing')


def _skip_if_scipy_0_17():
import scipy
v = scipy.__version__
if v >= LooseVersion("0.17.0"):
import pytest
pytest.skip("scipy 0.17")


def _check_if_lzma():
try:
return compat.import_lzma()
Expand Down Expand Up @@ -2020,15 +2012,18 @@ def __init__(self, *args, **kwargs):

# Dependency checks. Copied this from Nipy/Nipype (Copyright of
# respective developers, license: BSD-3)
def package_check(pkg_name, version=None, app='pandas', checker=LooseVersion):
"""Check that the minimal version of the required package is installed.
def package_check(pkg_name, min_version=None, max_version=None, app='pandas',
checker=LooseVersion):
"""Check that the min/max version of the required package is installed.
Parameters
----------
pkg_name : string
Name of the required package.
version : string, optional
min_version : string, optional
Minimal version number for required package.
max_version : string, optional
Max version number for required package.
app : string, optional
Application that is performing the check. For instance, the
name of the tutorial being executed that depends on specific
Expand All @@ -2040,7 +2035,6 @@ def package_check(pkg_name, version=None, app='pandas', checker=LooseVersion):
Examples
--------
package_check('numpy', '1.3')
package_check('networkx', '1.0', 'tutorial1')
"""

Expand All @@ -2049,8 +2043,10 @@ def package_check(pkg_name, version=None, app='pandas', checker=LooseVersion):
msg = '%s requires %s' % (app, pkg_name)
else:
msg = 'module requires %s' % pkg_name
if version:
msg += ' with version >= %s' % (version,)
if min_version:
msg += ' with version >= %s' % (min_version,)
if max_version:
msg += ' with version < %s' % (max_version,)
try:
mod = __import__(pkg_name)
except ImportError:
Expand All @@ -2059,7 +2055,9 @@ def package_check(pkg_name, version=None, app='pandas', checker=LooseVersion):
have_version = mod.__version__
except AttributeError:
pytest.skip('Cannot find version for %s' % pkg_name)
if version and checker(have_version) < checker(version):
if min_version and checker(have_version) < checker(min_version):
pytest.skip(msg)
if max_version and checker(have_version) >= checker(max_version):
pytest.skip(msg)


Expand Down