Merge branch 'master' into staging

This commit is contained in:
Robert Schütz
2018-07-15 12:31:18 +02:00
127 changed files with 1842 additions and 1472 deletions

View File

@@ -1,4 +1,4 @@
{ stdenv, buildPythonPackage, fetchPypi, iana-etc, libredirect,
{ stdenv, buildPythonPackage, fetchPypi, fetchpatch, iana-etc, libredirect,
pytest, case, kombu, billiard, pytz, anyjson, amqp, eventlet
}:
@@ -11,6 +11,13 @@ buildPythonPackage rec {
sha256 = "ff727c115533edbc7b81b2b4ba1ec88d1c2fc4836e1e2f4c3c33a76ff53e5d7f";
};
# Skip test_RedisBackend.test_timeouts_in_url_coerced
# See https://github.com/celery/celery/pull/4847
patches = fetchpatch {
url = https://github.com/celery/celery/commit/b2668607c909c61becd151905b4525190c19ff4a.patch;
sha256 = "11w0z2ycyh8kccj4y69zb7bxppiipcwwigg6jn1q9yrcsvz170jq";
};
# make /etc/protocols accessible to fix socket.getprotobyname('tcp') in sandbox
preCheck = stdenv.lib.optionalString stdenv.isLinux ''
export NIX_REDIRECTS=/etc/protocols=${iana-etc}/etc/protocols \

View File

@@ -1,17 +1,15 @@
{ stdenv, fetchPypi, buildPythonPackage, pythonOlder
, pyperclip, six, pyparsing, vim
{ stdenv, fetchPypi, buildPythonPackage, pythonOlder, isPy3k
, pyperclip, six, pyparsing, vim, wcwidth, colorama
, contextlib2 ? null, subprocess32 ? null
, pytest, mock, which, fetchFromGitHub, glibcLocales
}:
buildPythonPackage rec {
pname = "cmd2";
version = "0.8.0";
version = "0.9.1";
src = fetchFromGitHub {
owner = "python-cmd2";
repo = "cmd2";
rev = version;
sha256 = "0nw2b7n7zg51bc3glxw0l9fn91mwjnjshklhmxhyvjbsg7khf64z";
src = fetchPypi {
inherit pname version;
sha256 = "1wpw4f9zix30hfncm0hwxjjdx78zq26x3r8s9nvsq9vnxf41xb49";
};
LC_ALL="en_US.UTF-8";
@@ -31,14 +29,16 @@ buildPythonPackage rec {
py.test -k 'not test_path_completion_user_expansion'
'';
doCheck = !stdenv.isDarwin;
disabled = !isPy3k;
propagatedBuildInputs = [
colorama
pyperclip
six
pyparsing
wcwidth
]
++ stdenv.lib.optional (pythonOlder "3.5") contextlib2
++ stdenv.lib.optional (pythonOlder "3.0") subprocess32
;
meta = with stdenv.lib; {

View File

@@ -0,0 +1,49 @@
{ stdenv, fetchPypi, buildPythonPackage, pythonOlder
, pyperclip, six, pyparsing, vim
, contextlib2 ? null, subprocess32 ? null
, pytest, mock, which, fetchFromGitHub, glibcLocales
}:
buildPythonPackage rec {
pname = "cmd2";
version = "0.8.0";
src = fetchFromGitHub {
owner = "python-cmd2";
repo = "cmd2";
rev = version;
sha256 = "0nw2b7n7zg51bc3glxw0l9fn91mwjnjshklhmxhyvjbsg7khf64z";
};
LC_ALL="en_US.UTF-8";
postPatch = stdenv.lib.optional stdenv.isDarwin ''
# Fake the impure dependencies pbpaste and pbcopy
mkdir bin
echo '#/bin/sh' > bin/pbpaste
echo '#/bin/sh' > bin/pbcopy
chmod +x bin/{pbcopy,pbpaste}
export PATH=$(realpath bin):$PATH
'';
checkInputs= [ pytest mock which vim glibcLocales ];
checkPhase = ''
# test_path_completion_user_expansion might be fixed in the next release
py.test -k 'not test_path_completion_user_expansion'
'';
doCheck = !stdenv.isDarwin;
propagatedBuildInputs = [
pyperclip
six
pyparsing
]
++ stdenv.lib.optional (pythonOlder "3.5") contextlib2
++ stdenv.lib.optional (pythonOlder "3.0") subprocess32
;
meta = with stdenv.lib; {
description = "Enhancements for standard library's cmd module";
homepage = https://github.com/python-cmd2/cmd2;
maintainers = with maintainers; [ teto ];
};
}

View File

@@ -46,6 +46,11 @@ buildPythonPackage rec {
export CVXOPT_FFTW_INC_DIR=${fftw.dev}/include
'';
# https://github.com/cvxopt/cvxopt/issues/122
# This is fixed on staging (by #43234, status 2018-07-15), but until that
# lands we should disable the tests. Otherwise the 99% of use cases that
# should be unaffected by that failure are affected.
doCheck = false;
checkPhase = ''
${python.interpreter} -m unittest discover -s tests
'';

View File

@@ -7,16 +7,15 @@
, gmp
, cython
, cysignals
, six
}:
buildPythonPackage rec {
pname = "cypari2";
version = "1.1.4"; # remove six dependency on upgrade to >1.1.4
version = "1.2.1";
src = fetchPypi {
inherit pname version;
sha256 = "0n0mp8qmvvzmfaawg39d3mkyzf65q2zkz7bnqyk4sfjbz4xwc6mb";
sha256 = "0v2kikwf0advq8j76nwzhlacwj1yys9cvajm4fqgmasjdsnf1q4k";
};
# This differs slightly from the default python installPhase in that it pip-installs
@@ -39,7 +38,6 @@ buildPythonPackage rec {
propagatedBuildInputs = [
cysignals
cython
six # after 1.1.4: will not be needed
];
checkPhase = ''

View File

@@ -1,5 +1,6 @@
{ lib, buildPythonPackage, fetchPypi,
celery, django, psycopg2
{ lib, buildPythonPackage, fetchPypi
, glibcLocales
, celery, django, psycopg2
}:
buildPythonPackage rec {
@@ -7,7 +8,7 @@ buildPythonPackage rec {
version = "1.1.0";
meta = {
description = "Simple, powerfull and nonobstructive django email middleware.";
description = "Simple, powerfull and nonobstructive django email middleware";
homepage = https://github.com/bameda/djmail;
license = lib.licenses.bsd3;
};
@@ -17,6 +18,10 @@ buildPythonPackage rec {
sha256 = "87d2a8b4bdf67ae9b312e127ccc873a53116cf297ec786460d782ce82eaa76b5";
};
nativeBuildInputs = [ glibcLocales ];
LC_ALL = "en_US.UTF-8";
propagatedBuildInputs = [ celery django psycopg2 ];
# django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

View File

@@ -4,17 +4,12 @@
buildPythonPackage rec {
pname = "Eve";
version = "0.8";
name = "${pname}-${version}";
src = fetchPypi {
inherit pname version;
sha256 = "9f926c715f88c7a92dc2b950ccc09cccd91f72fe0e93cde806b85d25b947df2f";
};
patches = [
./setup.patch
];
propagatedBuildInputs = [
cerberus
events

View File

@@ -1,21 +0,0 @@
diff --git i/setup.py w/setup.py
index 0176467..2b74988 100755
--- i/setup.py
+++ w/setup.py
@@ -9,11 +9,11 @@ install_requires = [
'cerberus>=0.9.2,<0.10',
'events>=0.2.1,<0.3',
'simplejson>=3.3.0,<4.0',
- 'werkzeug>=0.9.4,<=0.11.15',
- 'markupsafe>=0.23,<1.0',
- 'jinja2>=2.8,<3.0',
- 'itsdangerous>=0.24,<1.0',
- 'flask>=0.10.1,<=0.12',
+ 'werkzeug>=0.9.4',
+ 'markupsafe>=0.23',
+ 'jinja2>=2.8',
+ 'itsdangerous>=0.24',
+ 'flask>=0.10.1',
'pymongo>=3.4',
'flask-pymongo>=0.4',
]

View File

@@ -0,0 +1,17 @@
{ lib, buildPythonPackage, fetchPypi }:
buildPythonPackage rec {
pname = "Events";
version = "0.3";
src = fetchPypi {
inherit pname version;
sha256 = "f4d9c41a5c160ce504278f219fe56f44242ca63794a0ad638b52d1e087ac2a41";
};
meta = with lib; {
homepage = http://events.readthedocs.org;
description = "Bringing the elegance of C# EventHanlder to Python";
license = licenses.bsd3;
};
}

View File

@@ -0,0 +1,25 @@
{ lib, buildPythonPackage, fetchPypi, pytest, case, pytz, amqp }:
buildPythonPackage rec {
pname = "kombu";
version = "4.2.1";
src = fetchPypi {
inherit pname version;
sha256 = "86adec6c60f63124e2082ea8481bbe4ebe04fde8ebed32c177c7f0cd2c1c9082";
};
postPatch = ''
substituteInPlace requirements/test.txt --replace "pytest-sugar" ""
'';
checkInputs = [ pytest case pytz ];
propagatedBuildInputs = [ amqp ];
meta = with lib; {
description = "Messaging library for Python";
homepage = https://github.com/celery/kombu;
license = licenses.bsd3;
};
}

View File

@@ -14,6 +14,10 @@ buildPythonPackage rec {
sha256 = "5ca0ad32ee04abe0d4ba02c8d89d501b4e5e0304bdf4d45c2e9875a735b323a0";
};
# basically https://github.com/scikit-learn/scikit-learn/pull/10723,
# but rebased onto 0.19.1
patches = [ ./n_iter-should-be-less-than-max_iter-using-lbgfs.patch ];
buildInputs = [ nose pillow gfortran glibcLocales ];
propagatedBuildInputs = [ numpy scipy numpy.blas ];

View File

@@ -0,0 +1,73 @@
diff --git a/sklearn/linear_model/huber.py b/sklearn/linear_model/huber.py
index e17dc1e..665654d 100644
--- a/sklearn/linear_model/huber.py
+++ b/sklearn/linear_model/huber.py
@@ -181,7 +181,11 @@ class HuberRegressor(LinearModel, RegressorMixin, BaseEstimator):
n_iter_ : int
Number of iterations that fmin_l_bfgs_b has run for.
- Not available if SciPy version is 0.9 and below.
+
+ .. versionchanged:: 0.20
+
+ In SciPy <= 1.0.0 the number of lbfgs iterations may exceed
+ ``max_iter``. ``n_iter_`` will now report at most ``max_iter``.
outliers_ : array, shape (n_samples,)
A boolean mask which is set to True where the samples are identified
@@ -272,7 +276,9 @@ class HuberRegressor(LinearModel, RegressorMixin, BaseEstimator):
raise ValueError("HuberRegressor convergence failed:"
" l-BFGS-b solver terminated with %s"
% dict_['task'].decode('ascii'))
- self.n_iter_ = dict_.get('nit', None)
+ # In scipy <= 1.0.0, nit may exceed maxiter.
+ # See https://github.com/scipy/scipy/issues/7854.
+ self.n_iter_ = min(dict_.get('nit', None), self.max_iter)
self.scale_ = parameters[-1]
if self.fit_intercept:
self.intercept_ = parameters[-2]
diff --git a/sklearn/linear_model/logistic.py b/sklearn/linear_model/logistic.py
index 8646c9a..c72a7d9 100644
--- a/sklearn/linear_model/logistic.py
+++ b/sklearn/linear_model/logistic.py
@@ -718,7 +718,9 @@ def logistic_regression_path(X, y, pos_class=None, Cs=10, fit_intercept=True,
warnings.warn("lbfgs failed to converge. Increase the number "
"of iterations.")
try:
- n_iter_i = info['nit'] - 1
+ # In scipy <= 1.0.0, nit may exceed maxiter.
+ # See https://github.com/scipy/scipy/issues/7854.
+ n_iter_i = min(info['nit'], max_iter)
except:
n_iter_i = info['funcalls'] - 1
elif solver == 'newton-cg':
@@ -1115,6 +1117,11 @@ class LogisticRegression(BaseEstimator, LinearClassifierMixin,
it returns only 1 element. For liblinear solver, only the maximum
number of iteration across all classes is given.
+ .. versionchanged:: 0.20
+
+ In SciPy <= 1.0.0 the number of lbfgs iterations may exceed
+ ``max_iter``. ``n_iter_`` will now report at most ``max_iter``.
+
See also
--------
SGDClassifier : incrementally trained logistic regression (when given
diff --git a/sklearn/linear_model/tests/test_huber.py b/sklearn/linear_model/tests/test_huber.py
index 08f4fdf..ca1092f 100644
--- a/sklearn/linear_model/tests/test_huber.py
+++ b/sklearn/linear_model/tests/test_huber.py
@@ -42,6 +42,13 @@ def test_huber_equals_lr_for_high_epsilon():
assert_almost_equal(huber.intercept_, lr.intercept_, 2)
+def test_huber_max_iter():
+ X, y = make_regression_with_outliers()
+ huber = HuberRegressor(max_iter=1)
+ huber.fit(X, y)
+ assert huber.n_iter_ == huber.max_iter
+
+
def test_huber_gradient():
# Test that the gradient calculated by _huber_loss_and_gradient is correct
rng = np.random.RandomState(1)

View File

@@ -0,0 +1,26 @@
{ stdenv, fetchurl, buildPythonPackage }:
buildPythonPackage rec {
name = "wcwidth-${version}";
version = "0.1.7";
src = fetchurl {
url = "mirror://pypi/w/wcwidth/${name}.tar.gz";
sha256 = "0pn6dflzm609m4r3i8ik5ni9ijjbb5fa3vg1n7hn6vkd49r77wrx";
};
# Checks fail due to missing tox.ini file:
doCheck = false;
meta = with stdenv.lib; {
description = "Measures number of Terminal column cells of wide-character codes";
longDescription = ''
This API is mainly for Terminal Emulator implementors -- any Python
program that attempts to determine the printable width of a string on
a Terminal. It is implemented in python (no C library calls) and has
no 3rd-party dependencies.
'';
homepage = https://github.com/jquast/wcwidth;
license = licenses.mit;
};
}