summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pygerber/default.nix
blob: fa4a9331517e9dd0e815d6394494333573f72213 (plain)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
{
  lib,
  stdenv,
  buildPythonPackage,
  fetchFromGitHub,

  # build-system
  poetry-core,

  # dependencies
  numpy,
  click,
  pillow,
  pydantic,
  pyparsing,
  typing-extensions,

  # optional dependencies
  pygls,
  lsprotocol,
  drawsvg,
  pygments,
  shapely,

  # test
  filelock,
  dulwich,
  tzlocal,
  pytest-xdist,
  pytest-lsp,
  pytest-asyncio,
  pytest-mock,
  pytestCheckHook,

}:

buildPythonPackage rec {
  pname = "pygerber";
  version = "2.4.3";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "Argmaster";
    repo = "pygerber";
    tag = "v${version}";
    hash = "sha256-0AoRmIN1FNlummJSHdysO2IDBHtfNPhVnh9j0lyWNFI=";
  };

  build-system = [ poetry-core ];
  dependencies = [
    numpy
    click
    pillow
    pydantic
    pyparsing
    typing-extensions
  ];

  passthru.optional-dependencies = {
    language_server = [
      pygls
      lsprotocol
    ];
    svg = [ drawsvg ];
    pygments = [ pygments ];
    shapely = [ shapely ];
    all = [
      pygls
      lsprotocol
      drawsvg
      pygments
      shapely
    ];
  };

  nativeCheckInputs = [
    pytest-asyncio
    pytest-xdist
    pytest-lsp
    pytest-mock
    pytestCheckHook
    tzlocal
    drawsvg
    dulwich
    filelock
  ];

  disabledTestPaths = [
    # require network access
    "test/gerberx3/test_assets.py"
    "test/gerberx3/test_language_server/tests.py"
  ];

  disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [
    # FileNotFoundError: [Errno 2] No such file or directory: 'open'
    "test_project_render_with_file_type_tags"
  ];

  pytestFlags = [ "--override-ini=required_plugins=" ];

  pythonImportsCheck = [ "pygerber" ];

  meta = {
    description = "Implementation of the Gerber X3/X2 format, based on Ucamco's The Gerber Layer Format Specification";
    homepage = "https://github.com/Argmaster/pygerber";
    changelog = "https://argmaster.github.io/pygerber/stable/Changelog.html";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ clemjvdm ];
  };
}