Skip to content

Commit

Permalink
Merge pull request #122207 from rmcgibbo/mlrose
Browse files Browse the repository at this point in the history
python3Packages.mlrose: fix build
  • Loading branch information
prusnak committed May 9, 2021
2 parents d3ed0f5 + 41e2941 commit cf39516
Showing 1 changed file with 29 additions and 5 deletions.
34 changes: 29 additions & 5 deletions pkgs/development/python-modules/mlrose/default.nix
@@ -1,21 +1,45 @@
{ lib, isPy27, buildPythonPackage, fetchPypi, scikitlearn }:
{ lib
, isPy27
, buildPythonPackage
, fetchFromGitHub
, fetchpatch
, scikitlearn
, pytestCheckHook
, pytest-randomly
}:

buildPythonPackage rec {
pname = "mlrose";
version = "1.3.0";
disabled = isPy27;

src = fetchPypi {
inherit pname version;
sha256 = "cec83253bf6da67a7fb32b2c9ae13e9dbc6cfbcaae2aa3107993e69e9788f15e";
src = fetchFromGitHub {
owner = "gkhayes";
repo = "mlrose";
rev = "v${version}";
sha256 = "1dn43k3rcypj58ymcj849b37w66jz7fphw8842v6mlbij3x0rxfl";
};

patches = [
# Fixes compatibility with scikit-learn 0.24.1
(fetchpatch {
url = "https://github.com/gkhayes/mlrose/pull/55/commits/19caf8616fc194402678aa67917db334ad02852a.patch";
sha256 = "1nivz3bn21nd21bxbcl16a6jmy7y5j8ilz90cjmd0xq4v7flsahf";
})
];

propagatedBuildInputs = [ scikitlearn ];
checkInputs = [ pytest-randomly pytestCheckHook ];

postPatch = ''
sed -i 's,sklearn,scikit-learn,g' setup.py
substituteInPlace setup.py --replace sklearn scikit-learn
'';

pythonImportsCheck = [ "mlrose" ];

# Fix random seed during tests
pytestFlagsArray = [ "--randomly-seed 0" ];

meta = with lib; {
description = "Machine Learning, Randomized Optimization and SEarch";
homepage = "https://github.com/gkhayes/mlrose";
Expand Down

0 comments on commit cf39516

Please sign in to comment.