at 24.11-pre 2.1 kB view raw
1{ 2 lib, 3 fetchPypi, 4 buildPythonPackage, 5 pythonOlder, 6 setuptools, 7 wheel, 8 numpy, 9 hdf5, 10 cython_0, 11 pkgconfig, 12 mpi4py ? null, 13 openssh, 14 pytestCheckHook, 15 cached-property, 16}: 17 18assert hdf5.mpiSupport -> mpi4py != null && hdf5.mpi == mpi4py.mpi; 19 20let 21 mpi = hdf5.mpi; 22 mpiSupport = hdf5.mpiSupport; 23in 24buildPythonPackage rec { 25 version = "3.11.0"; 26 pname = "h5py"; 27 pyproject = true; 28 29 disabled = pythonOlder "3.7"; 30 31 src = fetchPypi { 32 inherit pname version; 33 hash = "sha256-e36PeAcqLt7IfJg28l80ID/UkqRHVwmhi0F6M8+yH6k="; 34 }; 35 36 patches = [ 37 # Unlock an overly strict locking of mpi4py version (seems not to be necessary). 38 # See also: https://github.com/h5py/h5py/pull/2418/files#r1589372479 39 ./mpi4py-requirement.patch 40 ]; 41 42 # avoid strict pinning of numpy 43 postPatch = '' 44 substituteInPlace pyproject.toml \ 45 --replace-fail "numpy >=2.0.0rc1" "numpy" 46 ''; 47 48 HDF5_DIR = "${hdf5}"; 49 HDF5_MPI = if mpiSupport then "ON" else "OFF"; 50 51 postConfigure = '' 52 # Needed to run the tests reliably. See: 53 # https://bitbucket.org/mpi4py/mpi4py/issues/87/multiple-test-errors-with-openmpi-30 54 ${lib.optionalString mpiSupport "export OMPI_MCA_rmaps_base_oversubscribe=yes"} 55 ''; 56 57 preBuild = lib.optionalString mpiSupport "export CC=${lib.getDev mpi}/bin/mpicc"; 58 59 nativeBuildInputs = [ 60 cython_0 61 numpy 62 pkgconfig 63 setuptools 64 wheel 65 ]; 66 67 buildInputs = [ hdf5 ] ++ lib.optional mpiSupport mpi; 68 69 propagatedBuildInputs = 70 [ numpy ] 71 ++ lib.optionals mpiSupport [ 72 mpi4py 73 openssh 74 ] 75 ++ lib.optionals (pythonOlder "3.8") [ cached-property ]; 76 77 # tests now require pytest-mpi, which isn't available and difficult to package 78 doCheck = false; 79 nativeCheckInputs = [ 80 pytestCheckHook 81 openssh 82 ]; 83 84 pythonImportsCheck = [ "h5py" ]; 85 86 meta = with lib; { 87 changelog = "https://github.com/h5py/h5py/blob/${version}/docs/whatsnew/${lib.versions.majorMinor version}.rst"; 88 description = "Pythonic interface to the HDF5 binary data format"; 89 homepage = "http://www.h5py.org/"; 90 license = licenses.bsd3; 91 maintainers = [ ]; 92 }; 93}