about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/wordfreq/default.nix
blob: 0dab52348604e187089138a7eac0ea6e7cd2550c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{ lib
, buildPythonPackage
, regex
, langcodes
, ftfy
, msgpack
, mecab-python3
, jieba
, pytest
, pythonOlder
, fetchFromGitHub
}:

buildPythonPackage {
  pname = "wordfreq";
  version = "2.2.0";

   src = fetchFromGitHub {
    owner = "LuminosoInsight";
    repo = "wordfreq";
    # upstream don't tag by version
    rev = "bc12599010c8181a725ec97d0b3990758a48da36";
    sha256 = "195794vkzq5wsq3mg1dgfhlnz2f7vi1xajlifq6wkg4lzwyq262m";
   };

  checkInputs = [ pytest ];

  checkPhase = ''
    # These languages require additional dictionaries
    pytest tests -k 'not test_japanese and not test_korean and not test_languages and not test_french_and_related'
  '';
   
  propagatedBuildInputs = [ regex langcodes ftfy msgpack mecab-python3 jieba ];
  
  # patch to relax version requirements for regex
  # dependency to prevent break in upgrade
  postPatch = ''
    substituteInPlace setup.py --replace "regex ==" "regex >="
  '';
    
  disabled = pythonOlder "3";

  meta = with lib; {
    description = "A library for looking up the frequencies of words in many languages, based on many sources of data";
    homepage =  "https://github.com/LuminosoInsight/wordfreq/";
    license = licenses.mit;
    maintainers = with maintainers; [ ixxie ];
  };
}