git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #122207 from rmcgibbo/mlrose

python3Packages.mlrose: fix build

commitcf395160355536ee699161fded986cfc1b9a585d authorPavol Rusnak <pavol@rusnak.io> dateSun 9 May 2021, 10:51 (6 years ago) parentd3ed0f541e2941
1 file changed+29−5
pkgs/development/python-modules/mlrose/default.nix+29−5
pkgs/development/python-modules/mlrose/default.nix+29−5
@@ -1,21 +1,45 @@
1−{ lib, isPy27, buildPythonPackage, fetchPypi, scikitlearn }:
1+{ lib
2+, isPy27
3+, buildPythonPackage
4+, fetchFromGitHub
5+, fetchpatch
6+, scikitlearn
7+, pytestCheckHook
8+, pytest-randomly
9+}:
210
311buildPythonPackage rec {
412 pname = "mlrose";
513 version = "1.3.0";
614 disabled = isPy27;
715
8− src = fetchPypi {
9− inherit pname version;
10− sha256 = "cec83253bf6da67a7fb32b2c9ae13e9dbc6cfbcaae2aa3107993e69e9788f15e";
16+ src = fetchFromGitHub {
17+ owner = "gkhayes";
18+ repo = "mlrose";
19+ rev = "v${version}";
20+ sha256 = "1dn43k3rcypj58ymcj849b37w66jz7fphw8842v6mlbij3x0rxfl";
1121 };
1222
23+ patches = [
24+ # Fixes compatibility with scikit-learn 0.24.1
25+ (fetchpatch {
26+ url = "https://github.com/gkhayes/mlrose/pull/55/commits/19caf8616fc194402678aa67917db334ad02852a.patch";
27+ sha256 = "1nivz3bn21nd21bxbcl16a6jmy7y5j8ilz90cjmd0xq4v7flsahf";
28+ })
29+ ];
30+
1331 propagatedBuildInputs = [ scikitlearn ];
32+ checkInputs = [ pytest-randomly pytestCheckHook ];
1433
1534 postPatch = ''
16− sed -i 's,sklearn,scikit-learn,g' setup.py
35+ substituteInPlace setup.py --replace sklearn scikit-learn
1736 '';
1837
38+ pythonImportsCheck = [ "mlrose" ];
39+
40+ # Fix random seed during tests
41+ pytestFlagsArray = [ "--randomly-seed 0" ];
42+
1943 meta = with lib; {
2044 description = "Machine Learning, Randomized Optimization and SEarch";
2145 homepage = "https://github.com/gkhayes/mlrose";