Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib 2, fetchPypi 3, fetchpatch 4, buildPythonPackage 5, pythonOlder 6, blosc2 7, bzip2 8, c-blosc 9, cython 10, hdf5 11, lzo 12, numpy 13, numexpr 14, packaging 15, sphinx 16 # Test inputs 17, python 18, pytest 19, py-cpuinfo 20}: 21 22buildPythonPackage rec { 23 pname = "tables"; 24 version = "3.8.0"; 25 26 disabled = pythonOlder "3.8"; 27 28 src = fetchPypi { 29 inherit pname version; 30 hash = "sha256-NPP6I2bOILGPHfVzp3wdJzBs4fKkHZ+e/2IbUZLqh4g="; 31 }; 32 33 patches = [ 34 (fetchpatch { 35 name = "numpy-1.25-compatibility.patch"; 36 url = "https://github.com/PyTables/PyTables/commit/337792561e5924124efd20d6fea6bbbd2428b2aa.patch"; 37 hash = "sha256-pz3A/jTPWXXlzr+Yl5PRUvdSAinebFsoExfek4RUHkc="; 38 }) 39 ]; 40 41 nativeBuildInputs = [ 42 blosc2 43 cython 44 sphinx 45 ]; 46 47 buildInputs = [ 48 bzip2 49 c-blosc 50 hdf5 51 lzo 52 ]; 53 54 propagatedBuildInputs = [ 55 blosc2 56 py-cpuinfo 57 numpy 58 numexpr 59 packaging # uses packaging.version at runtime 60 ]; 61 62 # When doing `make distclean`, ignore docs 63 postPatch = '' 64 substituteInPlace Makefile --replace "src doc" "src" 65 # Force test suite to error when unittest runner fails 66 substituteInPlace tables/tests/test_suite.py \ 67 --replace "return 0" "assert result.wasSuccessful(); return 0" \ 68 --replace "return 1" "assert result.wasSuccessful(); return 1" 69 substituteInPlace requirements.txt \ 70 --replace "cython>=0.29.21" "" \ 71 --replace "blosc2~=2.0.0" "blosc2" 72 ''; 73 74 # Regenerate C code with Cython 75 preBuild = '' 76 make distclean 77 ''; 78 79 setupPyBuildFlags = [ 80 "--hdf5=${lib.getDev hdf5}" 81 "--lzo=${lib.getDev lzo}" 82 "--bzip2=${lib.getDev bzip2}" 83 "--blosc=${lib.getDev c-blosc}" 84 ]; 85 86 nativeCheckInputs = [ 87 pytest 88 ]; 89 90 preCheck = '' 91 cd .. 92 ''; 93 94 # Runs the light (yet comprehensive) subset of the test suite. 95 # The whole "heavy" test suite supposedly takes ~4 hours to run. 96 checkPhase = '' 97 runHook preCheck 98 ${python.interpreter} -m tables.tests.test_all 99 runHook postCheck 100 ''; 101 102 pythonImportsCheck = [ "tables" ]; 103 104 meta = with lib; { 105 description = "Hierarchical datasets for Python"; 106 homepage = "https://www.pytables.org/"; 107 changelog = "https://github.com/PyTables/PyTables/releases/tag/v${version}"; 108 license = licenses.bsd2; 109 maintainers = with maintainers; [ drewrisinger ]; 110 }; 111}