1{ lib, buildPythonPackage, fetchFromGitHub, isPy3k
2, filelock, protobuf, numpy, pytest, mock, typing-extensions
3, cupy, cudaSupport ? false
4}:
5
6buildPythonPackage rec {
7 pname = "chainer";
8 version = "6.5.0";
9 disabled = !isPy3k; # python2.7 abandoned upstream
10
11 # no tests in Pypi tarball
12 src = fetchFromGitHub {
13 owner = "chainer";
14 repo = "chainer";
15 rev = "v${version}";
16 sha256 = "0ha9fbl6sa3fbnsz3y1pg335iiskdbxw838m5j06zgzy156zna1x";
17 };
18
19 # remove on 7.0 or 6.6 release
20 postPatch = ''
21 sed -i '/typing/d' setup.py
22 '';
23
24 checkInputs = [
25 pytest
26 mock
27 ];
28
29 propagatedBuildInputs = [
30 filelock
31 protobuf
32 numpy
33 typing-extensions
34 ] ++ lib.optionals cudaSupport [ cupy ];
35
36 # avoid gpu tests
37 checkPhase = ''
38 pytest tests/chainer_tests/utils_tests -k 'not gpu and not cupy'
39 '';
40
41 meta = with lib; {
42 description = "A flexible framework of neural networks for deep learning";
43 homepage = "https://chainer.org/";
44 license = licenses.mit;
45 maintainers = with maintainers; [ hyphon81 ];
46 };
47}