summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/kfactory/default.nix
blob: 5e0c219ee58995487f7c7aae240fe5cbd4b44a47 (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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,

  # build-system
  setuptools,
  setuptools-scm,

  # dependencies
  aenum,
  cachetools,
  klayout,
  loguru,
  pydantic-extra-types,
  pydantic-settings,
  pydantic,
  pygit2,
  rapidfuzz,
  rectangle-packer,
  requests,
  ruamel-yaml-string,
  scipy,
  semver,
  toolz,
  typer,

  # tests
  pytest-regressions,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "kfactory";
  version = "2.0.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "gdsfactory";
    repo = "kfactory";
    tag = "v${version}";
    # kfactory uses `.git` to infer the project directory.
    # https://github.com/gdsfactory/kfactory/blob/v2.0.0/src/kfactory/conf.py#L318-L327
    # Otherwise, tests fail with:
    # assert kf.config.project_dir is not None
    # E   AssertionError: assert None is not None
    leaveDotGit = true;
    hash = "sha256-eZRNUb2Qw2HcR2W1pf15ulEt7ZCJwi60SuGdte/cG8E=";
  };

  build-system = [
    setuptools
    setuptools-scm
  ];

  pythonRelaxDeps = [
    "pydantic"
  ];
  dependencies = [
    aenum
    cachetools
    klayout
    loguru
    pydantic
    pydantic-extra-types
    pydantic-settings
    pygit2
    rapidfuzz
    rectangle-packer
    requests
    ruamel-yaml-string
    scipy
    semver
    toolz
    typer
  ];

  pythonImportsCheck = [ "kfactory" ];

  nativeCheckInputs = [
    pytest-regressions
    pytestCheckHook
  ];

  disabledTests = [
    # AssertionError: Binary files ... and ... differ
    "test_array"
    "test_array_indexerror"
    "test_autorename"
    "test_cell_default_fallback"
    "test_cell_in_threads"
    "test_cell_yaml"
    "test_circular_snapping"
    "test_create"
    "test_enclosure_name"
    "test_euler_snapping"
    "test_filter_layer_pt_reg"
    "test_filter_regex"
    "test_flatten"
    "test_info"
    "test_invalid_array"
    "test_kcell_attributes"
    "test_namecollision"
    "test_nested_dic"
    "test_nested_dict_list"
    "test_netlist"
    "test_netlist_equivalent"
    "test_no_snap"
    "test_overwrite"
    "test_ports_cell"
    "test_ports_in_cells"
    "test_ports_instance"
    "test_rename_clockwise"
    "test_rename_clockwise_multi"
    "test_schematic_anchor"
    "test_schematic_create"
    "test_schematic_create_cell"
    "test_schematic_kcl_mix_netlist"
    "test_schematic_mirror_connection"
    "test_schematic_route"
    "test_size_info"
    "test_to_dtype"
  ];

  disabledTestPaths = [
    # https://github.com/gdsfactory/kfactory/issues/511
    "tests/test_pdk.py"
    # NameError
    "tests/test_session.py"

    # AssertionError: Binary files ... and ... differ
    "tests/test_all_angle.py"
    "tests/test_cells.py"
    "tests/test_grid.py"
    "tests/test_l2n.py"
    "tests/test_packing.py"
    "tests/test_pins.py"
    "tests/test_rename.py"
    "tests/test_routing.py"
    "tests/test_spiral.py"
  ];

  meta = {
    description = "KLayout API implementation of gdsfactory";
    homepage = "https://github.com/gdsfactory/kfactory";
    changelog = "https://github.com/gdsfactory/kfactory/blob/${src.tag}/CHANGELOG.md";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ fbeffa ];
  };
}