1{ lib 2, buildPythonPackage 3, pythonOlder 4, fetchFromGitHub 5, fetchpatch 6, python-dateutil 7, pytz 8, regex 9, tzlocal 10, hijri-converter 11, convertdate 12, fasttext 13, langdetect 14, parameterized 15, pytestCheckHook 16, gitpython 17, parsel 18, requests 19, ruamel-yaml 20}: 21 22buildPythonPackage rec { 23 pname = "dateparser"; 24 version = "1.1.8"; 25 26 disabled = pythonOlder "3.7"; 27 28 format = "setuptools"; 29 30 src = fetchFromGitHub { 31 owner = "scrapinghub"; 32 repo = "dateparser"; 33 rev = "refs/tags/v${version}"; 34 hash = "sha256-52g8defF5bsisBv2QoyUymXcf0sljOI9PjeR4l0Pw6k="; 35 }; 36 37 propagatedBuildInputs = [ 38 python-dateutil 39 pytz 40 regex 41 tzlocal 42 ]; 43 44 passthru.optional-dependencies = { 45 calendars = [ hijri-converter convertdate ]; 46 fasttext = [ fasttext ]; 47 langdetect = [ langdetect ]; 48 }; 49 50 nativeCheckInputs = [ 51 parameterized 52 pytestCheckHook 53 gitpython 54 parsel 55 requests 56 ruamel-yaml 57 ] ++ lib.flatten (lib.attrValues passthru.optional-dependencies); 58 59 preCheck = '' 60 export HOME="$TEMPDIR" 61 ''; 62 63 # Upstream only runs the tests in tests/ in CI, others use git clone 64 pytestFlagsArray = [ "tests" ]; 65 66 disabledTests = [ 67 # access network 68 "test_custom_language_detect_fast_text_0" 69 "test_custom_language_detect_fast_text_1" 70 ]; 71 72 pythonImportsCheck = [ "dateparser" ]; 73 74 meta = with lib; { 75 changelog = "https://github.com/scrapinghub/dateparser/blob/${src.rev}/HISTORY.rst"; 76 description = "Date parsing library designed to parse dates from HTML pages"; 77 homepage = "https://github.com/scrapinghub/dateparser"; 78 license = licenses.bsd3; 79 maintainers = with maintainers; [ dotlambda ]; 80 }; 81}