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}:
15
16buildPythonPackage rec {
17 pname = "schemdraw";
18 version = "0.19";
19 pyproject = true;
20
21 disabled = pythonOlder "3.8";
22
23 src = fetchFromGitHub {
24 owner = "cdelker";
25 repo = pname;
26 rev = version;
27 hash = "sha256-vqEHcazE5DNHr0FceOWLqq+RZmMK5ovHDVjy/2wbTJU=";
28 };
29
30 build-system = [ setuptools ];
31
32 dependencies = [ pyparsing ];
33
34 optional-dependencies = {
35 matplotlib = [ matplotlib ];
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 preCheck = "rm test/test_pictorial.ipynb"; # Tries to download files
58
59 pytestFlagsArray = [ "--nbval-lax" ];
60
61 pythonImportsCheck = [ "schemdraw" ];
62
63 meta = with lib; {
64 description = "A package for producing high-quality electrical circuit schematic diagrams";
65 homepage = "https://schemdraw.readthedocs.io/en/latest/";
66 changelog = "https://schemdraw.readthedocs.io/en/latest/changes.html";
67 license = licenses.mit;
68 maintainers = with maintainers; [ sfrijters ];
69 };
70}