1{ 2 lib, 3 buildPythonPackage, 4 fetchPypi, 5 pythonOlder, 6 pythonAtLeast, 7 numpy, 8}: 9let 10 pname = "paddle-bfloat"; 11 version = "0.1.7"; 12in 13buildPythonPackage { 14 inherit pname version; 15 format = "setuptools"; 16 17 src = fetchPypi { 18 pname = "paddle_bfloat"; 19 inherit version; 20 hash = "sha256-mrjQCtLsXOvqeHHMjuMx65FvMfZ2+wTh1ao9ZJE+9xw="; 21 }; 22 23 postPatch = '' 24 sed '1i#include <memory>' -i bfloat16.cc # gcc12 25 # replace deprecated function for python3.11 26 substituteInPlace bfloat16.cc \ 27 --replace "Py_TYPE(&NPyBfloat16_Descr) = &PyArrayDescr_Type" "Py_SET_TYPE(&NPyBfloat16_Descr, &PyArrayDescr_Type)" 28 ''; 29 30 disabled = pythonOlder "3.9" || pythonAtLeast "3.12"; 31 32 propagatedBuildInputs = [ numpy ]; 33 34 pythonImportsCheck = [ "paddle_bfloat" ]; 35 36 # upstream has no tests 37 doCheck = false; 38 39 meta = with lib; { 40 description = "Paddle numpy bfloat16 package"; 41 homepage = "https://pypi.org/project/paddle-bfloat"; 42 license = licenses.asl20; 43 maintainers = with maintainers; [ happysalada ]; 44 }; 45}