about summary refs log tree commit diff
path: root/pkgs/development/python-modules/pytikz-allefeld/default.nix
blob: 9dd0bdb2bbe6b8e278341b725f78c00a345e8fae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{ lib
, stdenv
, fetchFromGitHub
, buildPythonPackage
, pythonOlder
, setuptools
, pymupdf
, numpy
, ipython
, texlive
}:

buildPythonPackage rec {
  pname = "pytikz-allefeld"; # "pytikz" on pypi is a different module
  version = "unstable-2022-11-01";
  pyproject = true;

  disabled = pythonOlder "3.5";

  src = fetchFromGitHub {
    owner = "allefeld";
    repo = "pytikz";
    rev = "f878ebd6ce5a647b1076228b48181b147a61abc1";
    hash = "sha256-G59UUkpjttJKNBN0MB/A9CftO8tO3nv8qlTxt3/fKHk=";
  };

  nativeBuildInputs = [
    setuptools
  ];

  dependencies = [
    pymupdf
    numpy
    ipython
  ];

  pythonImportsCheck = [ "tikz" ];

  nativeCheckInputs = [ texlive.combined.scheme-small ];
  checkPhase = ''
    runHook preCheck
    python -c 'if 1:
      from tikz import *
      pic = Picture()
      pic.draw(line([(0, 0), (1, 1)]))
      print(pic.code())
      pic.write_image("test.pdf")
    '
    test -s test.pdf
    runHook postCheck
  '';

  meta = with lib; {
    homepage = "https://github.com/allefeld/pytikz";
    description = "A Python interface to TikZ";
    license = licenses.gpl3;
    maintainers = with maintainers; [ pbsds ];
    broken = stdenv.isDarwin;
  };
}