at master 1.9 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 pythonOlder, 5 fetchFromGitHub, 6 setuptools, 7 python-dateutil, 8 pytz, 9 regex, 10 tzlocal, 11 hijridate, 12 convertdate, 13 fasttext, 14 langdetect, 15 parameterized, 16 pytestCheckHook, 17 gitpython, 18 parsel, 19 requests, 20 ruamel-yaml, 21}: 22 23buildPythonPackage rec { 24 pname = "dateparser"; 25 version = "1.2.2"; 26 27 disabled = pythonOlder "3.7"; 28 29 pyproject = true; 30 31 src = fetchFromGitHub { 32 owner = "scrapinghub"; 33 repo = "dateparser"; 34 tag = "v${version}"; 35 hash = "sha256-cUbY6c0JFzs1oZJOTnMXz3uCah2f50g8/3uWQXtwiGY="; 36 }; 37 38 nativeBuildInputs = [ setuptools ]; 39 40 propagatedBuildInputs = [ 41 python-dateutil 42 pytz 43 regex 44 tzlocal 45 ]; 46 47 optional-dependencies = { 48 calendars = [ 49 hijridate 50 convertdate 51 ]; 52 fasttext = [ fasttext ]; 53 langdetect = [ langdetect ]; 54 }; 55 56 nativeCheckInputs = [ 57 parameterized 58 pytestCheckHook 59 gitpython 60 parsel 61 requests 62 ruamel-yaml 63 ] 64 ++ lib.flatten (lib.attrValues optional-dependencies); 65 66 preCheck = '' 67 export HOME="$TEMPDIR" 68 ''; 69 70 # Upstream only runs the tests in tests/ in CI, others use git clone 71 enabledTestPaths = [ "tests" ]; 72 73 disabledTests = [ 74 # access network 75 "test_custom_language_detect_fast_text_0" 76 "test_custom_language_detect_fast_text_1" 77 78 # breaks with latest tzdata: https://github.com/scrapinghub/dateparser/issues/1237 79 # FIXME: look into this more 80 "test_relative_base" 81 ]; 82 83 pythonImportsCheck = [ "dateparser" ]; 84 85 meta = with lib; { 86 changelog = "https://github.com/scrapinghub/dateparser/blob/${src.tag}/HISTORY.rst"; 87 description = "Date parsing library designed to parse dates from HTML pages"; 88 homepage = "https://github.com/scrapinghub/dateparser"; 89 license = licenses.bsd3; 90 mainProgram = "dateparser-download"; 91 maintainers = with maintainers; [ dotlambda ]; 92 }; 93}