2023-04-12 12:48:02 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, pythonOlder
|
2023-05-24 13:37:59 +00:00
|
|
|
, fetchFromGitHub
|
2023-04-12 12:48:02 +00:00
|
|
|
, ziafont
|
|
|
|
, pytestCheckHook
|
|
|
|
, nbval
|
|
|
|
, latex2mathml
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "ziamath";
|
2023-07-15 17:15:38 +00:00
|
|
|
version = "0.8.1";
|
|
|
|
format = "pyproject";
|
2023-04-12 12:48:02 +00:00
|
|
|
|
|
|
|
disabled = pythonOlder "3.8";
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
src = fetchFromGitHub {
|
2023-04-12 12:48:02 +00:00
|
|
|
owner = "cdelker";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2023-07-15 17:15:38 +00:00
|
|
|
hash = "sha256-Bbwq4Ods3P/724KO94jSmMLD1ubfaMHP/gTlOL/2pnE=";
|
2023-04-12 12:48:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
ziafont
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeCheckInputs = [
|
|
|
|
pytestCheckHook
|
|
|
|
nbval
|
|
|
|
latex2mathml
|
|
|
|
];
|
|
|
|
|
|
|
|
pytestFlagsArray = [ "--nbval-lax" ];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
# Prevent the test suite from attempting to download fonts
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace test/styles.ipynb \
|
|
|
|
--replace '"def testfont(exprs, fonturl):\n",' '"def testfont(exprs, fonturl):\n", " return\n",' \
|
|
|
|
--replace "mathfont='FiraMath-Regular.otf', " ""
|
|
|
|
'';
|
|
|
|
|
2023-04-12 12:48:02 +00:00
|
|
|
pythonImportsCheck = [ "ziamath" ];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Render MathML and LaTeX Math to SVG without Latex installation";
|
|
|
|
homepage = "https://ziamath.readthedocs.io/en/latest/";
|
|
|
|
changelog = "https://ziamath.readthedocs.io/en/latest/changes.html";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ sfrijters ];
|
|
|
|
};
|
|
|
|
}
|