<commit_before>{ stdenv, lib
, buildPythonPackage, fetchPypi, isPy3k
, filelock, protobuf, numpy, pytest, mock
, cupy, cudaSupport ? false
}:

buildPythonPackage rec {
  pname = "chainer";
  version = "6.4.0";

  src = fetchPypi {
    inherit pname version;
    sha256 = "dacbcaa361cebdfbf6f212d138570333611b8f5de553093b1752c578b022a774";
  };

  checkInputs = [
    pytest
    mock
  ];

  propagatedBuildInputs = [
    filelock
    protobuf
    numpy
  ] ++ lib.optionals cudaSupport [ cupy ];

  # In python3, test was failed...
  doCheck = !isPy3k;

  meta = with stdenv.lib; {<commit_msg>python3Packages.chainer: 6.4.0 -> 6.5.0<commit_after>{ lib, buildPythonPackage, fetchFromGitHub, isPy3k
, filelock, protobuf, numpy, pytest, mock, typing-extensions
, cupy, cudaSupport ? false
}:

buildPythonPackage rec {
  pname = "chainer";
  version = "6.5.0";
  disabled = !isPy3k; # python2.7 abandoned upstream

  # no tests in Pypi tarball
  src = fetchFromGitHub {
    owner = "chainer";
    repo = "chainer";
    rev = "v${version}";
    sha256 = "0ha9fbl6sa3fbnsz3y1pg335iiskdbxw838m5j06zgzy156zna1x";
  };

  # remove on 7.0 or 6.6 release
  postPatch = ''
    sed -i '/typing/d' setup.py
  '';

  checkInputs = [
    pytest
    mock
  ];

  propagatedBuildInputs = [
    filelock
    protobuf
    numpy
    typing-extensions
  ] ++ lib.optionals cudaSupport [ cupy ];

  # avoid gpu tests
  checkPhase = ''
    pytest tests/chainer_tests/utils_tests -k 'not gpu and not cupy'
  '';

  meta = with lib; {
{'fraction_non_alphanumeric': 0.11538461538461539, 'fraction_numerical': 0.059018567639257294, 'mean_word_length': 3.191666666666667, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4327258', 'n_tokens_mistral': 628, 'n_tokens_neox': 580, 'n_words': 126}