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