1{ lib
2, buildPythonPackage
3, pythonOlder
4, fetchFromGitHub
5, pyparsing
6, matplotlib
7, latex2mathml
8, ziafont
9, ziamath
10, pytestCheckHook
11, nbval
12}:
13
14buildPythonPackage rec {
15 pname = "schemdraw";
16 version = "0.17";
17 format = "pyproject";
18
19 disabled = pythonOlder "3.8";
20
21 src = fetchFromGitHub {
22 owner = "cdelker";
23 repo = pname;
24 rev = version;
25 hash = "sha256-wa/IeNGZynU/xKwyFwebXcFaruhBFqGWsrZYaIEVa8Q=";
26 };
27
28 propagatedBuildInputs = [
29 pyparsing
30 ];
31
32 passthru.optional-dependencies = {
33 matplotlib = [
34 matplotlib
35 ];
36 svgmath = [
37 latex2mathml
38 ziafont
39 ziamath
40 ];
41 };
42
43 nativeCheckInputs = [
44 pytestCheckHook
45 nbval
46 matplotlib
47 latex2mathml
48 ziafont
49 ziamath
50 ];
51
52 # Strip out references to unfree fonts from the test suite
53 postPatch = ''
54 substituteInPlace test/test_styles.ipynb --replace "font='Times', " ""
55 '';
56
57 pytestFlagsArray = [ "--nbval-lax" ];
58
59 pythonImportsCheck = [ "schemdraw" ];
60
61 meta = with lib; {
62 description = "A package for producing high-quality electrical circuit schematic diagrams";
63 homepage = "https://schemdraw.readthedocs.io/en/latest/";
64 changelog = "https://schemdraw.readthedocs.io/en/latest/changes.html";
65 license = licenses.mit;
66 maintainers = with maintainers; [ sfrijters ];
67 };
68}