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