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