1{ 2 lib, 3 buildPythonPackage, 4 pythonOlder, 5 fetchFromGitHub, 6 setuptools, 7 python-dateutil, 8 pytz, 9 regex, 10 tzlocal, 11 hijri-converter, 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.1"; 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-O0FsLWbH0kGjwGCTklBMVVqosxXlXRyS9aAcggtBLsA="; 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 hijri-converter 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 ] ++ lib.flatten (lib.attrValues optional-dependencies); 64 65 preCheck = '' 66 export HOME="$TEMPDIR" 67 ''; 68 69 # Upstream only runs the tests in tests/ in CI, others use git clone 70 pytestFlagsArray = [ "tests" ]; 71 72 disabledTests = [ 73 # access network 74 "test_custom_language_detect_fast_text_0" 75 "test_custom_language_detect_fast_text_1" 76 77 # breaks with latest tzdata: https://github.com/scrapinghub/dateparser/issues/1237 78 # FIXME: look into this more 79 "test_relative_base" 80 ]; 81 82 pythonImportsCheck = [ "dateparser" ]; 83 84 meta = with lib; { 85 changelog = "https://github.com/scrapinghub/dateparser/blob/${src.rev}/HISTORY.rst"; 86 description = "Date parsing library designed to parse dates from HTML pages"; 87 homepage = "https://github.com/scrapinghub/dateparser"; 88 license = licenses.bsd3; 89 mainProgram = "dateparser-download"; 90 maintainers = with maintainers; [ dotlambda ]; 91 }; 92}