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