nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 setuptools,
6 ziafont,
7 pytestCheckHook,
8 nbval,
9 latex2mathml,
10 writableTmpDirAsHomeHook,
11 fetchurl,
12}:
13buildPythonPackage rec {
14 pname = "ziamath";
15 version = "0.13";
16 pyproject = true;
17
18 src = fetchFromGitHub {
19 owner = "cdelker";
20 repo = "ziamath";
21 tag = version;
22 hash = "sha256-4TSKxCCU4DP+CQKJoi3nBqstHVUb9ycz+JAlYctxGxY=";
23 };
24
25 build-system = [ setuptools ];
26
27 dependencies = [ ziafont ];
28
29 nativeCheckInputs = [
30 pytestCheckHook
31 nbval
32 latex2mathml
33 writableTmpDirAsHomeHook
34 ];
35
36 preCheck =
37 let
38 # The test notebooks try to download font files, unless they already exist in the test directory,
39 # so we prepare them in advance.
40 checkFonts = lib.map fetchurl (import ./checkfonts.nix);
41 copyFontCmd = font: "cp ${font} test/${lib.last (lib.splitString "/" font.url)}\n";
42 in
43 lib.concatMapStrings copyFontCmd checkFonts;
44
45 pytestFlags = [ "--nbval-lax" ];
46
47 pythonImportsCheck = [ "ziamath" ];
48
49 meta = {
50 description = "Render MathML and LaTeX Math to SVG without Latex installation";
51 homepage = "https://ziamath.readthedocs.io/en/latest/";
52 changelog = "https://ziamath.readthedocs.io/en/latest/changes.html";
53 license = lib.licenses.mit;
54 maintainers = [ lib.maintainers.sfrijters ];
55 };
56}