1{ lib 2, buildPythonPackage 3, fetchFromGitHub 4 5# propagates 6, chardet 7, regex 8, packaging 9 10# optionals 11, faust-cchardet 12, pandas 13, tabview 14# TODO: , wilderness 15 16# tests 17, python 18, pytestCheckHook 19}: 20 21buildPythonPackage rec { 22 pname = "clevercsv"; 23 version = "0.8.2"; 24 format = "setuptools"; 25 26 src = fetchFromGitHub { 27 owner = "alan-turing-institute"; 28 repo = "CleverCSV"; 29 rev = "refs/tags/v${version}"; 30 hash = "sha256-yyPUNFDq9W5OW1muHtQ10QgAHhXI8w7CY77fsWhIy0k="; 31 }; 32 33 propagatedBuildInputs = [ 34 chardet 35 regex 36 packaging 37 ]; 38 39 passthru.optional-dependencies = { 40 full = [ 41 faust-cchardet 42 pandas 43 tabview 44 # TODO: wilderness 45 ]; 46 }; 47 48 nativeCheckInputs = [ 49 pytestCheckHook 50 ] ++ passthru.optional-dependencies.full; 51 52 pythonImportsCheck = [ 53 "clevercsv" 54 "clevercsv.cparser" 55 ]; 56 57 preCheck = '' 58 # by linking the installed version the tests also have access to compiled native libraries 59 rm -r clevercsv 60 ln -s $out/${python.sitePackages}/clevercsv/ clevercsv 61 ''; 62 63 # their ci only runs unit tests, there are also integration and fuzzing tests 64 pytestFlagsArray = [ 65 "./tests/test_unit" 66 ]; 67 68 disabledTestPaths = [ 69 # ModuleNotFoundError: No module named 'wilderness' 70 "tests/test_unit/test_console.py" 71 ]; 72 73 meta = with lib; { 74 description = "CleverCSV is a Python package for handling messy CSV files"; 75 longDescription = '' 76 CleverCSV is a Python package for handling messy CSV files. It provides 77 a drop-in replacement for the builtin CSV module with improved dialect 78 detection, and comes with a handy command line application for working 79 with CSV files. 80 ''; 81 homepage = "https://github.com/alan-turing-institute/CleverCSV"; 82 changelog = "https://github.com/alan-turing-institute/CleverCSV/blob/${src.rev}/CHANGELOG.md"; 83 license = licenses.mit; 84 maintainers = with maintainers; [ hexa ]; 85 }; 86}