1{ stdenv
2, lib
3, fetchPypi
4, buildPythonPackage
5, cmake
6, python
7, zlib
8, ncurses
9, docutils
10, pygments
11, numpy
12, scipy
13, scikit-learn
14, spdlog
15, fmt
16, rapidjson
17}:
18
19buildPythonPackage rec {
20 pname = "vowpalwabbit";
21 version = "9.8.0";
22
23 src = fetchPypi{
24 inherit pname version;
25 hash = "sha256-s2q9K2tuILQATSjUKXe/hYdQW84bSIHwh/gfWM0/NTM=";
26 };
27
28 nativeBuildInputs = [
29 cmake
30 ];
31
32 buildInputs = [
33 docutils
34 ncurses
35 pygments
36 python.pkgs.boost
37 zlib.dev
38 spdlog
39 fmt
40 rapidjson
41 ];
42
43 # As we disable configure via cmake, pass explicit global options to enable
44 # spdlog and fmt packages
45 setupPyGlobalFlags = [ "--cmake-options=\"-DSPDLOG_SYS_DEP=ON;-DFMT_SYS_DEP=ON\"" ];
46
47 propagatedBuildInputs = [
48 numpy
49 scikit-learn
50 scipy
51 ];
52
53 # Python build script uses CMake, but we don't want CMake to do the
54 # configuration.
55 dontUseCmakeConfigure = true;
56
57 # Python ctypes.find_library uses DYLD_LIBRARY_PATH.
58 preConfigure = lib.optionalString stdenv.isDarwin ''
59 export DYLD_LIBRARY_PATH="${python.pkgs.boost}/lib"
60 '';
61
62 checkPhase = ''
63 # check-manifest requires a git clone, not a tarball
64 # check-manifest --ignore "Makefile,PACKAGE.rst,*.cc,tox.ini,tests*,examples*,src*"
65 ${python.interpreter} setup.py check -ms
66 '';
67
68 meta = with lib; {
69 description = "Vowpal Wabbit is a fast machine learning library for online learning, and this is the python wrapper for the project.";
70 homepage = "https://github.com/JohnLangford/vowpal_wabbit";
71 license = licenses.bsd3;
72 broken = stdenv.isAarch64;
73 maintainers = with maintainers; [ teh ];
74 };
75}