1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6 # build-system
7 poetry-core,
8
9 # dependencies
10 numpy,
11 click,
12 pillow,
13 pydantic,
14 pyparsing,
15 typing-extensions,
16
17 # optional dependencies
18 pygls,
19 lsprotocol,
20 drawsvg,
21 pygments,
22 shapely,
23
24 # test
25 filelock,
26 dulwich,
27 tzlocal,
28 pytest-xdist,
29 pytest-lsp,
30 pytest-asyncio,
31 pytest-mock,
32 pytestCheckHook,
33
34}:
35
36buildPythonPackage rec {
37 pname = "pygerber";
38 version = "2.4.3";
39 pyproject = true;
40
41 disabled = pythonOlder "3.8";
42
43 src = fetchFromGitHub {
44 owner = "Argmaster";
45 repo = "pygerber";
46 tag = "v${version}";
47 hash = "sha256-0AoRmIN1FNlummJSHdysO2IDBHtfNPhVnh9j0lyWNFI=";
48 };
49
50 build-system = [ poetry-core ];
51 dependencies = [
52 numpy
53 click
54 pillow
55 pydantic
56 pyparsing
57 typing-extensions
58 ];
59
60 passthru.optional-dependencies = {
61 language_server = [
62 pygls
63 lsprotocol
64 ];
65 svg = [ drawsvg ];
66 pygments = [ pygments ];
67 shapely = [ shapely ];
68 all = [
69 pygls
70 lsprotocol
71 drawsvg
72 pygments
73 shapely
74 ];
75 };
76
77 nativeCheckInputs = [
78 pytest-asyncio
79 pytest-xdist
80 pytest-lsp
81 pytest-mock
82 pytestCheckHook
83 tzlocal
84 drawsvg
85 dulwich
86 filelock
87 ];
88
89 disabledTestPaths = [
90 # require network access
91 "test/gerberx3/test_assets.py"
92 "test/gerberx3/test_language_server/tests.py"
93 ];
94
95 pytestFlags = [ "--override-ini=required_plugins=" ];
96
97 pythonImportsCheck = [ "pygerber" ];
98
99 meta = {
100 description = "Implementation of the Gerber X3/X2 format, based on Ucamco's The Gerber Layer Format Specification";
101 homepage = "https://github.com/Argmaster/pygerber";
102 changelog = "https://argmaster.github.io/pygerber/stable/Changelog.html";
103 license = lib.licenses.mit;
104 maintainers = with lib.maintainers; [ clemjvdm ];
105 };
106}