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