1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 fetchFromGitHub,
6 setuptools,
7 pyparsing,
8 matplotlib,
9 latex2mathml,
10 ziafont,
11 ziamath,
12 pytestCheckHook,
13 nbval,
14 writableTmpDirAsHomeHook,
15}:
16
17buildPythonPackage rec {
18 pname = "schemdraw";
19 version = "0.21";
20 pyproject = true;
21
22 disabled = pythonOlder "3.9";
23
24 src = fetchFromGitHub {
25 owner = "cdelker";
26 repo = "schemdraw";
27 tag = version;
28 hash = "sha256-+pvVt7Of5v17PNdZMj8hHvE5tICiTRMelp4trdUZsz4=";
29 };
30
31 build-system = [ setuptools ];
32
33 dependencies = [ pyparsing ];
34
35 optional-dependencies = {
36 matplotlib = [ matplotlib ];
37 svgmath = [
38 latex2mathml
39 ziafont
40 ziamath
41 ];
42 };
43
44 nativeCheckInputs = [
45 pytestCheckHook
46 nbval
47 matplotlib
48 latex2mathml
49 ziafont
50 ziamath
51 writableTmpDirAsHomeHook
52 ];
53
54 # Strip out references to unfree fonts from the test suite
55 postPatch = ''
56 substituteInPlace test/test_backend.ipynb --replace-fail "(font='Times')" "()"
57 '';
58
59 preCheck = "rm test/test_pictorial.ipynb"; # Tries to download files
60
61 pytestFlags = [ "--nbval-lax" ];
62
63 pythonImportsCheck = [ "schemdraw" ];
64
65 meta = with lib; {
66 description = "Package for producing high-quality electrical circuit schematic diagrams";
67 homepage = "https://schemdraw.readthedocs.io/en/latest/";
68 changelog = "https://schemdraw.readthedocs.io/en/latest/changes.html";
69 license = licenses.mit;
70 maintainers = with maintainers; [ sfrijters ];
71 };
72}