1{ lib
2, fetchPypi
3, fetchpatch
4, buildPythonPackage
5, pythonOlder
6, bzip2
7, c-blosc
8, cython
9, hdf5
10, lzo
11, numpy
12, numexpr
13, packaging
14 # Test inputs
15, pytestCheckHook
16}:
17
18buildPythonPackage rec {
19 pname = "tables";
20 version = "3.7.0";
21 disabled = pythonOlder "3.5";
22
23 src = fetchPypi {
24 inherit pname version;
25 sha256 = "sha256-6SqIetbyqYPlZKaZAt5KdkXDAGn8AavTU+xdolXF4f4=";
26 };
27
28 nativeBuildInputs = [ cython ];
29
30 buildInputs = [
31 bzip2
32 c-blosc
33 hdf5
34 lzo
35 ];
36 propagatedBuildInputs = [
37 numpy
38 numexpr
39 packaging # uses packaging.version at runtime
40 ];
41
42 # When doing `make distclean`, ignore docs
43 postPatch = ''
44 substituteInPlace Makefile --replace "src doc" "src"
45 # Force test suite to error when unittest runner fails
46 substituteInPlace tables/tests/test_suite.py \
47 --replace "return 0" "assert result.wasSuccessful(); return 0" \
48 --replace "return 1" "assert result.wasSuccessful(); return 1"
49 '';
50
51 # Regenerate C code with Cython
52 preBuild = ''
53 make distclean
54 '';
55
56 setupPyBuildFlags = [
57 "--hdf5=${lib.getDev hdf5}"
58 "--lzo=${lib.getDev lzo}"
59 "--bzip2=${lib.getDev bzip2}"
60 "--blosc=${lib.getDev c-blosc}"
61 ];
62
63 checkInputs = [ pytestCheckHook ];
64 preCheck = ''
65 cd ..
66 '';
67 # Runs the test suite as one single test via unittest. The whole "heavy" test suite supposedly takes ~5 hours to run.
68 pytestFlagsArray = [
69 "--pyargs"
70 "tables.tests.test_suite"
71 ];
72
73 pythonImportsCheck = [ "tables" ];
74
75 meta = with lib; {
76 description = "Hierarchical datasets for Python";
77 homepage = "https://www.pytables.org/";
78 license = licenses.bsd2;
79 maintainers = with maintainers; [ drewrisinger ];
80 };
81}