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