1{ lib
2, buildPythonPackage
3, pythonOlder
4, fetchFromGitHub
5, ziafont
6, pytestCheckHook
7, nbval
8, latex2mathml
9}:
10
11buildPythonPackage rec {
12 pname = "ziamath";
13 version = "0.8.1";
14 format = "pyproject";
15
16 disabled = pythonOlder "3.8";
17
18 src = fetchFromGitHub {
19 owner = "cdelker";
20 repo = pname;
21 rev = version;
22 hash = "sha256-Bbwq4Ods3P/724KO94jSmMLD1ubfaMHP/gTlOL/2pnE=";
23 };
24
25 propagatedBuildInputs = [
26 ziafont
27 ];
28
29 nativeCheckInputs = [
30 pytestCheckHook
31 nbval
32 latex2mathml
33 ];
34
35 pytestFlagsArray = [ "--nbval-lax" ];
36
37 # Prevent the test suite from attempting to download fonts
38 postPatch = ''
39 substituteInPlace test/styles.ipynb \
40 --replace '"def testfont(exprs, fonturl):\n",' '"def testfont(exprs, fonturl):\n", " return\n",' \
41 --replace "mathfont='FiraMath-Regular.otf', " ""
42 '';
43
44 pythonImportsCheck = [ "ziamath" ];
45
46 meta = with lib; {
47 description = "Render MathML and LaTeX Math to SVG without Latex installation";
48 homepage = "https://ziamath.readthedocs.io/en/latest/";
49 changelog = "https://ziamath.readthedocs.io/en/latest/changes.html";
50 license = licenses.mit;
51 maintainers = with maintainers; [ sfrijters ];
52 };
53}